Vault

June 5, 2026 ยท View on GitHub

Use the /vault resource to create, retrieve, and delete payment and setup tokens.

VaultController vaultController = client.getVaultController();

Class Name

VaultController

Methods

Create Payment Token

Creates a Payment Token from the given payment source and adds it to the Vault of the associated customer.

CompletableFuture<ApiResponse<PaymentTokenResponse>> createPaymentTokenAsync(
    final CreatePaymentTokenInput input)

Authentication

This endpoint requires Oauth2

Parameters

ParameterTypeTagsDescription
inputCreatePaymentTokenInputRequiredInput structure for the method CreatePaymentTokenAsync

Response Type

200: Idempotent response for a successful creation of payment token.

This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type PaymentTokenResponse.

Example Usage

CreatePaymentTokenInput createPaymentTokenInput = new CreatePaymentTokenInput.Builder(
    null,
    new PaymentTokenRequest.Builder(
        new PaymentTokenRequestPaymentSource.Builder()
            .build()
    )
    .build()
)
.build();

vaultController.createPaymentTokenAsync(createPaymentTokenInput).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    Throwable cause = exception.getCause();

    if (cause instanceof ErrorException) {
        ErrorException errorException = (ErrorException) cause;
        errorException.printStackTrace();
    } else {
        // fallback for unexpected errors
        exception.printStackTrace();
    }

    return null;
});

Errors

HTTP Status CodeError DescriptionException Class
400Request is not well-formed, syntactically incorrect, or violates schema.ErrorException
403Authorization failed due to insufficient permissions.ErrorException
404Request contains reference to resources that do not exist.ErrorException
422The requested action could not be performed, semantically incorrect, or failed business validation.ErrorException
500An internal server error has occurred.ErrorException

List Customer Payment Tokens

Returns all payment tokens for a customer.

CompletableFuture<ApiResponse<CustomerVaultPaymentTokensResponse>> listCustomerPaymentTokensAsync(
    final ListCustomerPaymentTokensInput input)

Authentication

This endpoint requires Oauth2

Parameters

ParameterTypeTagsDescription
inputListCustomerPaymentTokensInputRequiredInput structure for the method ListCustomerPaymentTokensAsync

Response Type

200: Successful execution.

This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type CustomerVaultPaymentTokensResponse.

Example Usage

ListCustomerPaymentTokensInput listCustomerPaymentTokensInput = new ListCustomerPaymentTokensInput.Builder(
    "customer_id8"
)
.pageSize(5)
.page(1)
.totalRequired(false)
.build();

vaultController.listCustomerPaymentTokensAsync(listCustomerPaymentTokensInput).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    Throwable cause = exception.getCause();

    if (cause instanceof ErrorException) {
        ErrorException errorException = (ErrorException) cause;
        errorException.printStackTrace();
    } else {
        // fallback for unexpected errors
        exception.printStackTrace();
    }

    return null;
});

Errors

HTTP Status CodeError DescriptionException Class
400Request is not well-formed, syntactically incorrect, or violates schema.ErrorException
403Authorization failed due to insufficient permissions.ErrorException
500An internal server error has occurred.ErrorException

Get Payment Token

Returns a readable representation of vaulted payment source associated with the payment token id.

CompletableFuture<ApiResponse<PaymentTokenResponse>> getPaymentTokenAsync(
    final String id)

Authentication

This endpoint requires Oauth2

Parameters

ParameterTypeTagsDescription
idStringTemplate, RequiredID of the payment token.

Constraints: Minimum Length: 1, Maximum Length: 36, Pattern: ^[0-9a-zA-Z_-]+$

Response Type

200: Successful execution.

This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type PaymentTokenResponse.

Example Usage

String id = "id0";

vaultController.getPaymentTokenAsync(id).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    Throwable cause = exception.getCause();

    if (cause instanceof ErrorException) {
        ErrorException errorException = (ErrorException) cause;
        errorException.printStackTrace();
    } else {
        // fallback for unexpected errors
        exception.printStackTrace();
    }

    return null;
});

Errors

HTTP Status CodeError DescriptionException Class
403Authorization failed due to insufficient permissions.ErrorException
404The specified resource does not exist.ErrorException
422The requested action could not be performed, semantically incorrect, or failed business validation.ErrorException
500An internal server error has occurred.ErrorException

Delete Payment Token

Delete the payment token associated with the payment token id.

CompletableFuture<ApiResponse<Void>> deletePaymentTokenAsync(
    final String id)

Authentication

This endpoint requires Oauth2

Parameters

ParameterTypeTagsDescription
idStringTemplate, RequiredID of the payment token.

Constraints: Minimum Length: 1, Maximum Length: 36, Pattern: ^[0-9a-zA-Z_-]+$

Response Type

204: The server has successfully executed the method, but there is no entity body to return.

void

Example Usage

String id = "id0";

vaultController.deletePaymentTokenAsync(id).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    Throwable cause = exception.getCause();

    if (cause instanceof ErrorException) {
        ErrorException errorException = (ErrorException) cause;
        errorException.printStackTrace();
    } else {
        // fallback for unexpected errors
        exception.printStackTrace();
    }

    return null;
});

Errors

HTTP Status CodeError DescriptionException Class
400Request is not well-formed, syntactically incorrect, or violates schema.ErrorException
403Authorization failed due to insufficient permissions.ErrorException
500An internal server error has occurred.ErrorException

Create Setup Token

Creates a Setup Token from the given payment source and adds it to the Vault of the associated customer.

CompletableFuture<ApiResponse<SetupTokenResponse>> createSetupTokenAsync(
    final CreateSetupTokenInput input)

Authentication

This endpoint requires Oauth2

Parameters

ParameterTypeTagsDescription
inputCreateSetupTokenInputRequiredInput structure for the method CreateSetupTokenAsync

Response Type

200: Idempotent response for a successful creation of setup token.

This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type SetupTokenResponse.

Example Usage

CreateSetupTokenInput createSetupTokenInput = new CreateSetupTokenInput.Builder(
    null,
    new SetupTokenRequest.Builder(
        new SetupTokenRequestPaymentSource.Builder()
            .build()
    )
    .build()
)
.build();

vaultController.createSetupTokenAsync(createSetupTokenInput).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    Throwable cause = exception.getCause();

    if (cause instanceof ErrorException) {
        ErrorException errorException = (ErrorException) cause;
        errorException.printStackTrace();
    } else {
        // fallback for unexpected errors
        exception.printStackTrace();
    }

    return null;
});

Errors

HTTP Status CodeError DescriptionException Class
400Request is not well-formed, syntactically incorrect, or violates schema.ErrorException
403Authorization failed due to insufficient permissions.ErrorException
422The requested action could not be performed, semantically incorrect, or failed business validation.ErrorException
500An internal server error has occurred.ErrorException

Get Setup Token

Returns a readable representation of temporarily vaulted payment source associated with the setup token id.

CompletableFuture<ApiResponse<SetupTokenResponse>> getSetupTokenAsync(
    final String id)

Authentication

This endpoint requires Oauth2

Parameters

ParameterTypeTagsDescription
idStringTemplate, RequiredID of the setup token.

Constraints: Minimum Length: 7, Maximum Length: 36, Pattern: ^[0-9a-zA-Z_-]+$

Response Type

200: Found requested setup-token, returned a payment method associated with the token.

This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type SetupTokenResponse.

Example Usage

String id = "id0";

vaultController.getSetupTokenAsync(id).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    Throwable cause = exception.getCause();

    if (cause instanceof ErrorException) {
        ErrorException errorException = (ErrorException) cause;
        errorException.printStackTrace();
    } else {
        // fallback for unexpected errors
        exception.printStackTrace();
    }

    return null;
});

Errors

HTTP Status CodeError DescriptionException Class
403Authorization failed due to insufficient permissions.ErrorException
404The specified resource does not exist.ErrorException
422The requested action could not be performed, semantically incorrect, or failed business validation.ErrorException
500An internal server error has occurred.ErrorException