Search Overlay

Customer Vault Service

Please Note: As an ISV / Paysafe Partner, you will need to complete all of the below "merchant" steps on behalf of the Parent Merchant Legal Entity (PMLE) that your merchants will be operating under.

In order to be able to create single-use tokens that can be used to process transactions in your app, you need two components - Paysafe API Client and Customer Vault Service.

Initializing the Paysafe API Client

Please refer to here for more information.

Initializing the Customer Vault Service

The Customer Vault Service uses internally Customer Vault API to create different types of single-use tokens which can be used to process transactions in your app.

Here is an example of creating an instance of the Customer Vault Service:

customerVaultService = new CustomerVaultService.Builder()
.withApiClient(client) // the client from the previous step
.build();

Create single-use tokens

You can create two types of tokens - Card single-use token and Google Pay single-use token.

You have to generate a new single-use token for each Card/Google Pay transaction you wish to process. Single-use tokens are valid for only 15 minutes and are not consumed by verification.

Once a single-use token is received from the Customer Vault API, it must be sent to the merchant's server. The merchant must then include it in the payment request that is sent to the Card Payments API (using the API key for server-to-server API calls).

Create Card single-use token

You need to pass SingleUseTokenParams object which contains information about card holder, card data and billing address to createSingleUseToken() method of the Customer Vault Service.

The createSingleUseToken() method will call the provided CustomerVaultCallback when it's done generating a card single-use token.

customerVaultService.createSingleUseToken(
new SingleUseTokenParams.Builder()
.withCard(new SingleUseTokenParams.Card.Builder()
.withHolderName("Danail Alexiev")
.withCardNumber("4000 0000 0000 1091")
.withCardExpiry(new CardExpiry.Builder()
.withMonth(10)
.withYear(2022)
.build()
)
.withBillingAddress(new BillingAddress.Builder()
.onStreet("Address1")
.onStreet2("Address2")
.inCity("Sofia")
.inCountry("Bulgaria")
.inState("Sofia")
.withZip("1000")
.build())
.build())
.build(),
new CustomerVaultCallback<SingleUseToken>() {
@Override
public void onSuccess(@NonNull SingleUseToken token) {
// Send the generated single-use token to your backend
}
@Override
public void onError(@NonNull Error error) {
// Handle the error
}
});

Create Google Paysingle-use token

You need to pass GooglePayTokenParams object which contains payment information generated from the Android device for Google Pay to createGooglePayPaymentToken() method of the Customer Vault Service.

The createGooglePayPaymentToken() method will call the provided CustomerVaultCallback when it's done generating a google pay single-use token.

customerVaultService.createGooglePayPaymentToken(
new GooglePayTokenParams.Builder()
.withToken(new GooglePayTokenParams.GooglePayPaymentToken.Builder()
.withProtocolVersion(GooglePayTokenParams.GooglePayPaymentToken.PROTOCOL_EC_V1)
.withSignedMessage("message")
.withSignature("signature")
.build())
.build(),
new CustomerVaultCallback<GooglePaySingleUseToken>() {
@Override
public void onSuccess(@NonNull GooglePaySingleUseToken token) {
// Send the generated single-use token to your backend
}
@Override
public void onError(@NonNull Error error) {
// Handle the error
}
});