Welcome to Xendit’s latest documentation. For legacy content, access the previous version here.

Fixed amount Subscriptions

Prev Next

Fixed amount subscription is the most common type of subscription, where payments are made at fixed intervals and the amount remains the same for each cycle. Common use cases include media subscriptions, insurance premiums, membership fees, or loan repayments.

How to integrate

Fixed amount subscriptions basically only need single setup upfront during Subscriptions creation and Xendit will then automatically maintain the scheduler up until the Subscriptions reach the final cycle that you desired.

  1. Your app will need to display the Subscriptions for the end user to choose the option. This step it should just sit on your system, no interaction yet to Xendit environment. You can do similar like this

  2. Once the end user choose their desired plan, you can create the Subscriptions plan to Xendit.

    Example payload:

    Request - POST /recurring/plans

    {
        "reference_id": "ref-{{$timestamp}}",
        "customer_id": "cust-7e34f507-808d-44f8-a4a6-aea89a14a89c",
        "recurring_action": "PAYMENT",
        "currency": "IDR",
        "amount": 13579,
        "schedule": {
            "reference_id": "test-{{$timestamp}}",
            "interval": "MONTH",
            "interval_count": 1,
            "total_recurrence": 6,
            "anchor_date": "2025-02-15T09:44:19.546Z",
            "retry_interval": "DAY",
            "retry_interval_count": 1,
            "total_retry": 3,
            "failed_attempt_notifications": [
                1,3
            ]
        },
        "notification_config": {
            "locale": "en",
            "recurring_created": [
                "WHATSAPP",
                "EMAIL"
            ],
            "recurring_succeeded": [
                "WHATSAPP",
                "EMAIL"
            ],
            "recurring_failed": [
                "WHATSAPP",
                "EMAIL"
            ]
        },
        "failed_cycle_action": "STOP",
        "immediate_action_type": "FULL_AMOUNT",
        "payment_link_for_failed_attempt": true,
        "metadata": null,
        "description": "Xendit Recurring Test",
        "success_return_url": "https://www.xendit.co/",
        "failure_return_url": "https://www.xendit.co/"
    }

    Response - POST /recurring/plans

    {
        "id": "repl_c87f3312-a9c1-4eee-932c-38479f911830",
        "reference_id": "ref-1733299168",
        "customer_id": "cust-7e34f507-808d-44f8-a4a6-aea89a14a89c",
        "recurring_action": "PAYMENT",
        "failed_cycle_action": "STOP",
        "recurring_cycle_count": 0,
        "currency": "IDR",
        "amount": 13579,
        "status": "REQUIRES_ACTION",
        "created": "2024-12-04T07:59:28.553Z",
        "updated": "2024-12-04T07:59:28.553Z",
        "schedule_id": "resc_07d3197d-f860-47dc-bc6e-b87deaf34735",
        "payment_methods": [],
        "schedule": {
            "id": "resc_07d3197d-f860-47dc-bc6e-b87deaf34735",
            "reference_id": "test-1733299168",
            "business_id": "62440e322008e87fb29c1fd0",
            "interval": "MONTH",
            "interval_count": 1,
            "total_recurrence": 6,
            "anchor_date": "2025-02-15T09:44:19.546Z",
            "retry_interval": "DAY",
            "retry_interval_count": 1,
            "total_retry": 3,
            "failed_attempt_notifications": [
                1,
                3
            ],
            "created": "2024-12-04T07:59:28.545Z",
            "updated": "2024-12-04T07:59:28.545Z"
        },
        "immediate_action_type": "FULL_AMOUNT",
        "notification_config": {
            "locale": "en",
            "recurring_created": [
                "WHATSAPP",
                "EMAIL"
            ],
            "recurring_succeeded": [
                "WHATSAPP",
                "EMAIL"
            ],
            "recurring_failed": [
                "WHATSAPP",
                "EMAIL"
            ]
        },
        "metadata": null,
        "description": "Xendit Recurring Test",
        "actions": [
            {
                "url": "https://linking-dev.xendit.co/pali_a757f019-19b9-4522-91fe-03b6dc00368a",
                "action": "AUTH",
                "method": "GET",
                "url_type": "WEB"
            }
        ],
        "success_return_url": "https://www.xendit.co/",
        "failure_return_url": "https://www.xendit.co/",
        "items": null,
        "payment_link_for_failed_attempt": true,
        "failure_code": null
    }
  3. After creating a subscription, redirect your user to the Xendit-hosted page using the actions object from the API response. This step allows the end user to link their payment method to the subscription plan.

  4. Once the end user successfully links their payment method, Xendit will send a recurring.plan.activation webhook to confirm the activation of the subscription plan.

  5. Listen to the cycle webhooks (recurring.cycle) to track the status of each subscription cycle. Continue monitoring until all cycles are completed to ensure seamless execution and visibility into the subscription process.

For fixed-amount subscriptions, minimal setup is required on your end. Once the subscription is created, Xendit will automatically process each cycle according to the defined schedule until all cycles are completed.