Skip to main content
POST
Add Saved Payment
This call places a real MYR 1.00 verification transaction. CommercePay charges the customer’s payment method MYR 1.00 through the provider to verify the card/wallet is valid, then automatically refunds it once the save completes. Expect the normal payment callback/webhook activity for this verification transaction — no separate refund call is needed on your side.
One saved payment per customer per channel. If customer.username already has a saved payment method on the given channelId, this call fails with UserIsSavedPayment (2103) instead of replacing it. To save a new payment method for that customer/channel, first revoke the existing one via Revoke Saved Payment.

Errors

In addition to standard signature errors, this endpoint can return:

Headers

Abp-TenantId
string
required

Your unique Merchant ID assigned by CommercePay.

Authorization
string
required

Your API credentials used for authentication (typically a Bearer token).

cap-signature
string
required

A unique security hash used to verify the integrity of the request body. See Generate Signature for how to generate this.

Body

channelId
integer<int32>
required

An identifier that represents a CommercePay payments channel. Refer id on response end points Get Channel List. Must be a channel whose provider supports saved payments, otherwise the request fails with ChannelNotSupportPreAddPayment (2104).

referenceCode
string
required

Merchant Reference Code

Maximum string length: 50
ipAddress
string
required

Customer’s IP address captured by the merchant system

Maximum string length: 50
returnUrl
string
required

Return URL supplied by the merchant server for the payment response and used by CommercePay to redirect the customer's browser back to the desired page on the Merchant’s site

Maximum string length: 500
Example:

"https://returnurl.com/"

currencyCode
string | null

Currency code with a 3-letter ISO 4217 standard code.

Example:

"MYR"

userAgent
string | null

[Conditional] Customer’s user agent. It is recommended to input for a better user experience for specific channels due to different platforms such as desktop, mobile, or app view. Example channels impact: ShopeePay

Maximum string length: 200
callbackUrl
string | null

Callback URL is host-to-host communication. CommercePay sends the transaction response to the merchant callback server based on the callback URL given, including for the automatic MYR 1.00 verification charge and its refund. If the URL is provided, the callback will be triggered; otherwise, it would not trigger. Refer to the Merchant Callback URL to know more

Maximum string length: 500
Example:

"https://callback.com/"

customer
object
tenantId
integer<int32> | null

Fill in provided Tenant Id.

timestamp
integer<int64>

new Date().getTime()

Example:

1621851652617

Response

Success

transactionNumber
string | null

Unique CAP Transaction Number for the underlying MYR 1.00 verification transaction (automatically refunded).

Maximum string length: 24
redirectUrl
string | null

URL used for the customer to redirect to the payment page