Replace a payment method

Changed on

Replace a payment method with another payment method while keeping all existing customer, subscription and invoice links. This is useful when replacing invalid payment methods to existing customers without needing to additionally update their subscription and invoice details.

put/billing/customers/{customerId}/paymentmethods/{paymentMethodToken}/new

Request

  • Base URL
    https://api-sandbox.ezypay.com/v2
  • URL
    https://api-sandbox.ezypay.com/v2/billing/customers/{customerId}/paymentmethods/{paymentMethodToken}/new
  • Auth
    OAuth 2
    Client credentials
    Token URL: https://identity-sandbox.ezypay.com/token

Path parameters

paymentMethodTokenstring required

Auto-generated unique identifier of the payment method token generated by vault.

customerIdstring required

Auto-generated unique identifier of the customer.

Headers

merchantstring required

Merchant ID

Request body

newPaymentMethodTokenstring required

Auto-generated unique identifier of the payment method token generated by vault.

primarystring

Indicator to set this payment method as Customer's preferred Payment Method. PromptPay payment method token cannot be set as the primary payment method.

Response

200

paymentMethodTokenstring
customerIdstring
typestring
bankunknown
invalidReasonunknown
lastUsedOnunknown
validboolean
primaryboolean

Example response

{
  "paymentMethodToken": "187b485f-1f40-4c35-8c0d-81f87888ffcd",
  "customerId": "37a2e1dd-c1d9-4fda-a077-6908877aa84c",
  "type": "CARD",
  "card": {
    "first6": "498765",
    "last4": "8769",
    "accountHolderName": "JaneDoe",
    "type": "VISA",
    "expiryMonth": "12",
    "expiryYear": "25"
  },
  "replacedPaymentMethodData": {
    "paymentMethodToken": "f8b0b190-9680-47cb-9992-7c6a29a6b3bd",
    "customerId": "37a2e1dd-c1d9-4fda-a077-6908877aa84c",
    "type": "CARD",
    "card": {
      "first6": "411111",
      "last4": "1111",
      "accountHolderName": "JaneDoe",
      "type": "VISA",
      "expiryMonth": "01",
      "expiryYear": "99"
    },
    "valid": true
  },
  "valid": true,
  "primary": true
}

Changes