Welcome to Xendit’s latest documentation. For legacy content, access the previous documentation here or the previous API reference here.

Cancel and deactivate a payment token

Prev Next
Post
/v3/payment_tokens/{payment_token_id}/cancel

Cancel your payment token.

Security
HTTP
Type basic
Header parameters
api-version
string
Valid values[ "2024-11-11" ]
Path parameters
payment_token_id
stringRequired
Min length39
Max length39
Examplept-56ef1da0-6c92-490a-9ea8-803eaf404ce1
Responses
200

Cancel Payment Token

cancelPaymentToken
{
  "payment_token_id": "pt-1402feb0-bb79-47ae-9d1e-e69394d3949c",
  "business_id": "5f27a14a9bf05c73dd040bc8",
  "reference_id": "90392f42-d98a-49ef-a7f3-abcezas123",
  "customer_id": "cust-b98d6f63-d240-44ec-9bd5-aa42954c4f48",
  "country": "ID",
  "currency": "IDR",
  "channel_code": "OVO",
  "channel_properties": {
    "failure_return_url": "https://xendit.co/failure",
    "success_return_url": "https://xendit.co/success"
  },
  "actions": [
    {
      "type": "REDIRECT_CUSTOMER",
      "descriptor": "WEB_URL",
      "value": "https://xendit.co/"
    }
  ],
  "status": "CANCELED",
  "token_details": {
    "account_name": "John Doe",
    "account_balance": "1000001",
    "account_point_balance": "50000"
  },
  "metadata": {
    "metametadata": "metametametadata"
  },
  "created": "2029-12-31T23:59:59Z",
  "updated": "2029-12-31T23:59:59Z"
}
Expand All
object

Payment Token object

payment_token_id
string

Xendit unique Payment Token ID generated as reference for reusable payment details of the end user.

Examplept-cc3938dc-c2a5-43c4-89d7-7570793348c2
channel_code
string

Channel code used to select the payment method provider. Use routing payment channels mapping for full list of channel codes.

country
string

ISO 3166-1 alpha-2 two-letter country code for the country of transaction.

Valid values[ "ID", "PH", "VN", "TH", "SG", "MY" ]
ExampleID
business_id
string

Xendit-generated identifier for the business that owns the transaction

Example5f27a14a9bf05c73dd040bc8
customer_id
string

Xendit unique Capture ID generated as reference for the end user

Max length41
Examplecust-b98d6f63-d240-44ec-9bd5-aa42954c4f48
reference_id
string

A Reference ID from merchants to identify their request.

Min length1
Max length255
currency
string

ISO 4217 three-letter currency code for the payment.

Valid values[ "IDR", "PHP", "VND", "THB", "SGD", "MYR", "USD" ]
ExampleIDR
channel_properties
object (Payments_API_ChannelProperties)

Data required to initiate transaction with payment method provider. Use routing payment channels mapping for full list of data required.

actions
Array of object (Payments_API_Actions)
object

Actions object contains possible next steps merchants can take to proceed with payment collection from end user

type

The type of action that merchant system will need to handle to complete payment.

Valid values[ "PRESENT_TO_CUSTOMER", "REDIRECT_CUSTOMER", "API_POST_REQUEST" ]
descriptor

The type of action that merchant system will need to handle to complete payment.

Valid values[ "CAPTURE_PAYMENT", "PAYMENT_CODE", "QR_STRING", "VIRTUAL_ACCOUNT_NUMBER", "WEB_URL", "DEEPLINK_URL", "VALIDATE_OTP", "RESEND_OTP" ]
value
string

The specific value that will be used by merchant to complete the action

status
string

Status of the payment token.

Valid values[ "REQUIRES_ACTION", "PENDING", "ACTIVE", "FAILED", "EXPIRED", "CANCELED" ]
ExampleACTIVE
token_details
object (Payments_API_TokenDetails)

Account information provided by the payment method provider. Fields returned are dependent on what is made available by the provider.

authorization_data
object (Payments_API_AuthorizationData)

Specific to cards transaction only. Details about the card authorization processing.

authorization_code
string

Authorization approval code from the scheme. 6 alphanumeric characters.

cvn_verification_result
string

Whether CVN input matches with the issuer's data.

Valid values[ "M", "N" ]
address_verification_result
string

Whether the end user's address input matches with the issuer's data.

Valid values[ "M", "N" ]
retrieval_reference_number
string

Receipt reference number communicated to the end user by their card issuer for this specific payment. This a commonly used reference number for the end users to raise tickets.

network_response_code
string

The response code returned by the scheme (Visa, Mastercard, JCB, China Unionpay or Amex).

network_response_code_descriptor
string

Description of the response code.

network_transaction_id
string

Transaction ID received from the card scheme. Only available for merchants on switcher model.

acquirer_merchant_id
string

Acquirer's record of the MID that was used to process this transaction. Only available for merchants on switcher model.

reconciliation_id
string

Acquirer's transaction record of the payment on their settlement statement. Only available for merchants on switcher model.

authentication_data
object (Payments_API_AuthenticationData)

Specific to cards transaction only. Details about the card authentication.

flow
string

Indicates the flow that was used for the 3DS authentication.

Valid values[ "FULL_AUTH", "FRICTIONLESS" ]
a_res
object

Details about the card authentication response from the 3DS server.

eci
string

Payment system-specific value provided by the ACS or DS to indicate the results of the attempt to authenticate the Cardholder.

message_version
string

The 3DS protocol version which has been used to perform 3DS.

authentication_value
string

The result value from the 3DS transaction received from the ACS. This value is no longer present on responses after 45 days have passed after the authentication. Note that Mastercard and Visa use a different underlying format.

ds_trans_id
string

Universally unique transaction identifier assigned by the DS to identify a single transaction.

account_name
string

Name of the owner of the account bound to the token.

account_balance
string

Balance of the account bound to the token.

account_point_balance
string

Point balance of the account bound to the token.

account_number
string

Account number bound to the token.

failure_code
string

Failure codes for payment tokens.

Valid values[ "ACCOUNT_ALREADY_LINKED", "INVALID_ACCOUNT_DETAILS", "AUTHENTICATION_FAILED", "CARD_DECLINED", "CAPTURE_AMOUNT_EXCEEDED ", "INSUFFICIENT_BALANCE", "ISSUER_UNAVAILABLE", "CHANNEL_UNAVAILABLE", "INVALID_MERCHANT_SETTINGS" ]
ExampleAUTHENTICATION_FAILED
metadata
object (Payments_API_MerchantMetadata)

Key-value entries for your custom data. You can specify up to 50 keys, with key names up to 40 characters and values up to 500 characters. This is for your convenience. Xendit will not use this data for any processing.

Example{ "my_custom_id": "merchant-123", "my_custom_order_id": "order-123" }
description
string

A custom description for the Payment Request.

Min length1
Max length1000
ExamplePayment for your order #123
created
string (date-time)

ISO 8601 date-time format.

Example2021-12-31T23:59:59Z
updated
string (date-time)

ISO 8601 date-time format.

Example2021-12-31T23:59:59Z
400

Bad request

OneOf
Payments_API_Http400InactivePaymentRequest
object (Payments_API_Http400InactivePaymentRequest)
error_code
string
Valid values[ "INACTIVE_PAYMENT_REQUEST" ]
message
string

Payment request is already inactive.

Payments_API_Http400ApiValidationError
object (Payments_API_Http400ApiValidationError)
error_code
string
Valid values[ "API_VALIDATION_ERROR" ]
message
string

Fields or values in the payment request does not comply with our API specification. Check the specific error message for debugging.

Payments_API_Http400TemporarilyUnavailable
object (Payments_API_Http400TemporarilyUnavailable)
error_code
string
Valid values[ "TEMPORARILY_UNAVAILABLE" ]
message
string

Requested feature is unavailable during this timing.

Payments_API_Http400IneligibleTransactionStatus
object (Payments_API_Http400IneligibleTransactionStatus)
error_code
string
Valid values[ "INELIGIBLE_TRANSACTION_STATUS" ]
message
string

Feature is not allowed for the payment request because of its current status. Check the specific error message for debugging.

404

Not found

OneOf
Payments_API_Http404DataNotFound
object (Payments_API_Http404DataNotFound)
error_code
string
Valid values[ "DATA_NOT_FOUND" ]
message
string

ID specified in request cannot be found.

500

Internal server error

OneOf
Payments_API_Http500ServerError
object (Payments_API_Http500ServerError)
error_code
string
Valid values[ "SERVER_ERROR" ]
message
string

An unexpected error occured, our team has been notified and will troubleshoot the issue

503

Service unavailable

OneOf
Payments_API_Http503ChannelUnavailable
object (Payments_API_Http503ChannelUnavailable)
error_code
string
Valid values[ "CHANNEL_UNAVAILABLE" ]
message
string

The channel requested is currently experiencing unexpected issues. The provider will be notified to resolve this issue.