Update subscription's payment method

Changed on

Integrators can this API Endpoint to update a payment method token which has been invalidated. All invoice created by the subscription payment plan will use the updated payment method token.

This API is mostly use when a customer wants to change an old payment method details or the payment method token has been invalidated.

The payment method token used, needs to be linked to the customer Id first before the payment method token can be used.

put/billing/subscriptions/{subscriptionId}/paymentmethod/{paymentMethodToken}

Request

  • Base URL
    https://api-sandbox.ezypay.com/v2
  • URL
    https://api-sandbox.ezypay.com/v2/billing/subscriptions/{subscriptionId}/paymentmethod/{paymentMethodToken}
  • Auth
    OAuth 2
    Client credentials
    Token URL: https://identity-sandbox.ezypay.com/token

Path parameters

subscriptionIdstring required

Auto-generated unique identifier of the subscription.

paymentMethodTokenstring required

Payment method token that will replaced the existing

Headers

merchantstring required

Merchant ID

Request body

{}string required

Response

200

idstring
customerIdstring
planIdstring
namestring
statusstring
startDatestring
endDateunknown
paymentMethodTokenstring
accountingCodestring
nextBillingDatestring
intervalinteger
intervalUnitstring
totalBillingCyclesinteger
remainingToPayunknown
remainingBillingCyclesunknown
endTargetAmountunknown
endTargetBillingCyclesunknown
cancelledDateunknown
failedPaymentHandlingunknown
failedAttemptsCountinteger
metadataunknown
createdOnstring
autoPaymentboolean
setupPaymentsunknown
paymentMethodInvalidReasonunknown
paymentMethodInvalidDescriptionunknown
paymentMethodInvalidboolean

Example response

{
  "id": "ae2c3a26-5b33-4578-bf5d-2f77ffdbee60",
  "customerId": "a355617b-19a4-4a4c-833d-66b295d6055d",
  "planId": "30343e1a-6219-450b-a803-17bb5464f433",
  "name": "Test_OngoingPlan",
  "status": "PAST_DUE",
  "startDate": "2021-09-22",
  "paymentMethodToken": "d608e57b-fae0-4157-8785-cf6719e10c59",
  "accountingCode": "test",
  "amount": {
    "currency": "AUD",
    "value": 100
  },
  "tax": {
    "rate": 10
  },
  "nextBillingDate": "2021-10-06",
  "nextFutureInvoice": {
    "subscriptionId": "ae2c3a26-5b33-4578-bf5d-2f77ffdbee60",
    "date": "2021-10-06",
    "cycleStartDate": "2021-10-06",
    "cycleEndDate": "2021-10-19",
    "items": [
      {
        "description": "Test_OngoingPlan",
        "amount": {
          "currency": "AUD",
          "value": 100
        },
        "tax": {
          "rate": 10
        },
        "type": "subscription_payment",
        "accountingCode": "test"
      }
    ],
    "amount": {
      "currency": "AUD",
      "value": 100.87
    },
    "totalTax": {
      "currency": "AUD",
      "value": 9.09
    }
  },
  "interval": 2,
  "intervalUnit": "WEEK",
  "totalPaid": {
    "currency": "AUD"
  },
  "totalBillingCycles": 1,
  "failedAttemptsCount": 1,
  "totalPastDue": {
    "currency": "AUD",
    "value": 100
  },
  "totalDiscounted": {
    "currency": "AUD"
  },
  "createdOn": "2021-09-22T09:01:18.778",
  "autoPayment": true
}

Changes