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 payment channel. Refer to the id from the response of the Get Channel List. Must be a channel whose provider supports saved payments, otherwise the request fails with ChannelNotSupportPreAddPayment (2104).

referenceCode
string
required

The merchant-side unique order reference or invoice tracking sequence code.

Maximum string length: 50
ipAddress
string
required

The customer's IP address captured by the merchant server.

Maximum string length: 50
returnUrl
string
required

The synchronous return URL where the customer's browser is automatically redirected after the transaction is completed.

Maximum string length: 500
Example:

"https://returnurl.com/"

currencyCode
string | null

Currency code with a 3-letter ISO 4217 standard code (e.g., MYR).

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. See Callback Notifications for the payload and signature verification steps.

Maximum string length: 500
Example:

"https://callback.com/"

customer
object
tenantId
integer<int32> | null

Your unique Merchant ID assigned by CommercePay.

timestamp
integer<int64>

Numeric timestamp in milliseconds representing request validation freshness, generated via new Date().getTime(). Example: 1621851652617.

Example:

1621851652617

Response

Success

transactionNumber
string | null

Unique CommercePay 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