Use the /vault resource to create, retrieve, and delete payment and setup tokens.
VaultController vaultController = client.getVaultController();VaultController
- Create Payment Token
- List Customer Payment Tokens
- Get Payment Token
- Delete Payment Token
- Create Setup Token
- Get Setup 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)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
CreatePaymentTokenInput |
Required | Input structure for the method CreatePaymentTokenAsync |
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.
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;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Request is not well-formed, syntactically incorrect, or violates schema. | ErrorException |
| 403 | Authorization failed due to insufficient permissions. | ErrorException |
| 404 | Request contains reference to resources that do not exist. | ErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | ErrorException |
| 500 | An internal server error has occurred. | ErrorException |
Returns all payment tokens for a customer.
CompletableFuture<ApiResponse<CustomerVaultPaymentTokensResponse>> listCustomerPaymentTokensAsync(
final ListCustomerPaymentTokensInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
ListCustomerPaymentTokensInput |
Required | Input structure for the method ListCustomerPaymentTokensAsync |
200: Successful execution.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type CustomerVaultPaymentTokensResponse.
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;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Request is not well-formed, syntactically incorrect, or violates schema. | ErrorException |
| 403 | Authorization failed due to insufficient permissions. | ErrorException |
| 500 | An internal server error has occurred. | ErrorException |
Returns a readable representation of vaulted payment source associated with the payment token id.
CompletableFuture<ApiResponse<PaymentTokenResponse>> getPaymentTokenAsync(
final String id)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
id |
String |
Template, Required | ID of the payment token. Constraints: Minimum Length: 1, Maximum Length: 36, Pattern: ^[0-9a-zA-Z_-]+$ |
200: Successful execution.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type PaymentTokenResponse.
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;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 403 | Authorization failed due to insufficient permissions. | ErrorException |
| 404 | The specified resource does not exist. | ErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | ErrorException |
| 500 | An internal server error has occurred. | ErrorException |
Delete the payment token associated with the payment token id.
CompletableFuture<ApiResponse<Void>> deletePaymentTokenAsync(
final String id)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
id |
String |
Template, Required | ID of the payment token. Constraints: Minimum Length: 1, Maximum Length: 36, Pattern: ^[0-9a-zA-Z_-]+$ |
204: The server has successfully executed the method, but there is no entity body to return.
void
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;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Request is not well-formed, syntactically incorrect, or violates schema. | ErrorException |
| 403 | Authorization failed due to insufficient permissions. | ErrorException |
| 500 | An internal server error has occurred. | ErrorException |
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)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
CreateSetupTokenInput |
Required | Input structure for the method CreateSetupTokenAsync |
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.
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;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Request is not well-formed, syntactically incorrect, or violates schema. | ErrorException |
| 403 | Authorization failed due to insufficient permissions. | ErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | ErrorException |
| 500 | An internal server error has occurred. | ErrorException |
Returns a readable representation of temporarily vaulted payment source associated with the setup token id.
CompletableFuture<ApiResponse<SetupTokenResponse>> getSetupTokenAsync(
final String id)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
id |
String |
Template, Required | ID of the setup token. Constraints: Minimum Length: 7, Maximum Length: 36, Pattern: ^[0-9a-zA-Z_-]+$ |
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.
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;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 403 | Authorization failed due to insufficient permissions. | ErrorException |
| 404 | The specified resource does not exist. | ErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | ErrorException |
| 500 | An internal server error has occurred. | ErrorException |