Future Cancellation Subscription

Integrators will be able to set a future date cancellation on a subscription. Listed below are the details on how this can be achieved.

1. Get Subscription

[GET] https://api-sandbox.ezypay.com/v2/billing/subscriptions/{{Subscription_Id}}

{
    "id": "ffe30113-d39a-4bee-88ad-0570a515a6ea",
    "customerId": "aaf40599-0fbc-44d3-8902-55365c6de9e5",
    "planId": "adff8a30-5032-4202-833c-5abb7b229dcf",
    "name": "Testing using ongoing plan",
    "status": "ACTIVE",
    "startDate": "2019-06-28",
    "endDate": "2019-11-01",
    "paymentMethodToken": "0890e4f9-71b7-468a-bff6-199bb979daab",
    "accountingCode": "ABC123_NSW",
    "amount": {
        "currency": "AUD",
        "value": 200,
        "type": null
    },
    "tax": {
        "rate": 10
    },
    "nextBillingDate": "2019-07-12",
    "nextFutureInvoice": {
        "subscriptionId": "ffe30113-d39a-4bee-88ad-0570a515a6ea",
        "date": "2019-07-12",
        "cycleStartDate": "2019-07-12",
        "cycleEndDate": "2019-07-25",
        "items": [
            {
                "description": "Testing using ongoing plan",
                "amount": {
                    "currency": "AUD",
                    "value": 200,
                    "type": null
                },
                "tax": {
                    "rate": 10
                },
                "type": "subscription_payment",
                "accountingCode": "ABC123_NSW"
            },
            {
                "description": "Transaction Fee",
                "amount": {
                    "currency": "AUD",
                    "value": 2.98,
                    "type": null
                },
                "tax": {
                    "rate": 10
                },
                "type": "transaction_fee",
                "accountingCode": null
            }
        ],
        "amount": {
            "currency": "AUD",
            "value": 202.98,
            "type": null
        },
        "totalTax": {
            "currency": "AUD",
            "value": 18.45,
            "type": null
        }
    },
    "interval": 2,
    "intervalUnit": "WEEK",
    "totalPaid": {
        "currency": "AUD",
        "value": 200,
        "type": null
    },
    "totalBillingCycles": 1,
    "remainingToPay": {
        "currency": "AUD",
        "value": 1800,
        "type": null
    },
    "remainingBillingCycles": null,
    "endTargetAmount": {
        "currency": "AUD",
        "value": 2000,
        "type": null
    },
    "endTargetBillingCycles": null,
    "cancelledDate": null,
    "failedPaymentHandling": null,
    "failedAttemptsCount": 0,
    "totalPastDue": {
        "currency": "AUD",
        "value": 0,
        "type": null
    },
    "totalDiscounted": {
        "currency": "AUD",
        "value": 0,
        "type": null
    },
    "metadata": null,
    "createdOn": "2019-06-28T07:24:44.669",
    "autoPayment": true,
    "setupPayments": null
}

2. Update Future Cancellation Subscription Date

[PUT] https://api-sandbox.ezypay.com/v2/billing/subscriptions/{{Subscription_Id}}/cancel

This feature allows an integrator to determine when a future end date for the subscription will be set.

{
    "cancellationDate":"{{cancellation date}}"
}
{
    "id": "93cbe6dc-ea24-4fc3-930f-b3b6562938ec",
    "customerId": "aaf40599-0fbc-44d3-8902-55365c6de9e5",
    "planId": "bff146cb-871d-4618-8b9f-215cd72c3e67",
    "name": "Test Subscription 006",
    "status": "PENDING_CANCELLATION",
    "startDate": "2019-06-25",
    "endDate": "2019-10-29",
    "paymentMethodToken": "0890e4f9-71b7-468a-bff6-199bb979daab",
    "accountingCode": "ABC123_NSW",
    "amount": {
        "currency": "AUD",
        "value": 200,
        "type": null
    },
    "tax": {
        "rate": 10
    },
    "nextBillingDate": "2019-07-09",
    "nextFutureInvoice": null,
    "interval": 2,
    "intervalUnit": "WEEK",
    "totalPaid": {
        "currency": "AUD",
        "value": 200,
        "type": null
    },
    "totalBillingCycles": 1,
    "remainingToPay": {
        "currency": "AUD",
        "value": 1800,
        "type": null
    },
    "remainingBillingCycles": null,
    "endTargetAmount": {
        "currency": "AUD",
        "value": 2000,
        "type": null
    },
    "endTargetBillingCycles": null,
    "cancelledDate": "2019-07-05",
    "failedPaymentHandling": null,
    "failedAttemptsCount": 1,
    "totalPastDue": {
        "currency": "AUD",
        "value": 0,
        "type": null
    },
    "totalDiscounted": {
        "currency": "AUD",
        "value": 0,
        "type": null
    },
    "metadata": null,
    "createdOn": "2019-06-25T07:43:58.791",
    "autoPayment": true,
    "setupPayments": null
}

3. Remove a Future Cancellation Subscription

[POST] https://api-sandbox.ezypay.com/v2/billing/subscriptions/{{subscription_Id}}/undo-cancel

{
    "id": "93cbe6dc-ea24-4fc3-930f-b3b6562938ec",
    "customerId": "aaf40599-0fbc-44d3-8902-55365c6de9e5",
    "planId": "bff146cb-871d-4618-8b9f-215cd72c3e67",
    "name": "Test Subscription 006",
    "status": "ACTIVE",
    "startDate": "2019-06-25",
    "endDate": "2019-10-29",
    "paymentMethodToken": "0890e4f9-71b7-468a-bff6-199bb979daab",
    "accountingCode": "ABC123_NSW",
    "amount": {
        "currency": "AUD",
        "value": 200,
        "type": null
    },
    "tax": {
        "rate": 10
    },
    "nextBillingDate": "2019-07-09",
    "nextFutureInvoice": null,
    "interval": 2,
    "intervalUnit": "WEEK",
    "totalPaid": {
        "currency": "AUD",
        "value": 200,
        "type": null
    },
    "totalBillingCycles": 1,
    "remainingToPay": {
        "currency": "AUD",
        "value": 1800,
        "type": null
    },
    "remainingBillingCycles": null,
    "endTargetAmount": {
        "currency": "AUD",
        "value": 2000,
        "type": null
    },
    "endTargetBillingCycles": null,
    "cancelledDate": null,
    "failedPaymentHandling": null,
    "failedAttemptsCount": 1,
    "totalPastDue": {
        "currency": "AUD",
        "value": 0,
        "type": null
    },
    "totalDiscounted": {
        "currency": "AUD",
        "value": 0,
        "type": null
    },
    "metadata": null,
    "createdOn": "2019-06-25T07:43:58.791",
    "autoPayment": true,
    "setupPayments": null
}

📘

NOTE:

Only Subscription that is pending cancellation can be undo. Once the subscription is cancelled, it cannot be undo.


Did this page help you?