Skip to main content

Add Payment Method

Tokenize a new card and attach it to a customer.

URL

POST /api/c2a/customer/payment/methods/add

Request Parameters

Body: PaymentMethodAddRequest.

NameTypeDescription
customerUrnstringRequired. Target customer.
paymentMethodobject (PaymentMethodDto)Required. Channel + card payload. See Submit Checkout for the full DTO.

Request Example

{
"customerUrn": "cu.00.482",
"paymentMethod": {
"paymentChannel": "CreditCard",
"creditCard": {
"cardHolderName": "Jane Doe",
"cardNumber": "4111111111111111",
"expireMonth": "12",
"expireYear": "2029",
"cvc": "123",
"cardAlias": "Personal Visa"
}
}
}

Response Parameters

PaymentMethodAddResponse wraps AzottePaymentMethod.

NameTypeDescription
result.paymentMethodUrnstringURN to reference the stored card.
result.customerUrnstringOwning customer.
result.paymentChannelstringCreditCard / PayPal / etc.
result.maskedCardNumberstringe.g. 411111******1111.
result.cardTypestringVISA, MASTERCARD, etc.
result.expireMonthstringMM.
result.expireYearstringYYYY.
result.cardAliasstringOptional user-facing label.
result.statestringActive on success.
result.storedAtstring (date-time)UTC timestamp.
statusobject (AzotteStatus)Operation status envelope.

Sample Response

{
"result": {
"paymentMethodUrn": "pm.00.482.7",
"customerUrn": "cu.00.482",
"paymentChannel": "CreditCard",
"maskedCardNumber": "411111******1111",
"cardType": "VISA",
"expireMonth": "12",
"expireYear": "2029",
"cardAlias": "Personal Visa",
"state": "Active",
"storedAt": "2026-05-25T10:15:00Z"
},
"status": { "messageCode": "SUCCESS" }
}

PSP rejected

{
"result": null,
"status": { "messageCode": "CARD_DECLINED" }
}

Behaviour

  • Raw PAN/CVC are sent over TLS to the PSP adapter; nothing sensitive is logged.
  • On PSP failure, the response carries a non-success AzotteStatus (e.g. CARD_DECLINED, INVALID_CARD).
  • Re-adding the same card creates a new record + new URN; Azotte does not deduplicate.

Sample Codes

curl --location 'https://acme.sandbox.azotte.com/api/v1/c2a/customer/payment/methods/add' \
--header 'Content-Type: application/json' \
--header 'x-tn: e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f' \
--header 'x-api-key: sk_dev_acme_sample_123456789' \
--data '{
"customerUrn": "cu.00.482",
"paymentMethod": {
"paymentChannel": "CreditCard",
"creditCard": {
"cardHolderName": "Jane Doe",
"cardNumber": "4111111111111111",
"expireMonth": "12",
"expireYear": "2029",
"cvc": "123",
"cardAlias": "Personal Visa"
}
}
}'