v1

latestOpenAPI 3.1.02026-07-26500375.1 KB
Subscriptions

Create Subscription

The following endpoint registers a recurring billing agreement for a customer and returns the subscription in pending status. No payment method is collected at this step. The subscription is activated separately by its first payment (hosted checkout, or the Charge Subscription endpoint).

post/v1/subscriptions

Headers

Content-Typestring required

Indicates the media type of the resource. value: application/json

X-Request-IDstring

Optional client-supplied idempotency and tracing ID, echoed back in the response.

Request body

customer_idstring required

Durianpay customer ID.

interval'daily' | 'weekly' | 'monthly' | 'annually' required

Billing frequency unit.

interval_countinteger

Multiplier for interval (3 + monthly = every 3 months). Defaults to 1.

return_urlstring uri required

URL the customer is redirected to after hosted checkout.

subscription_ref_idstring

Optional. Your own reference for this subscription, returned unchanged for reconciliation.

Example request

{
  "customer_id": "cus_456",
  "amount": {
    "currency": "IDR",
    "value": "10000.00"
  },
  "interval_count": 1,
  "return_url": "https://merchant.com/subscription/success",
  "subscription_ref_id": "sub-ref-0001"
}

Response

Subscription created in pending status.

statusstring

Example response

{
  "status": "success",
  "data": {
    "id": "sub_xyz123",
    "merchant_id": "mer_123",
    "customer_id": "cus_456",
    "amount": {
      "currency": "IDR",
      "value": "10000.00"
    },
    "interval_count": 1,
    "checkout_url": "https://checkout.durianpay.id/s/sub_xyz123",
    "return_url": "https://merchant.com/subscription/success",
    "subscription_ref_id": "sub-ref-0001",
    "created_at": "2026-03-01T10:00:00Z",
    "updated_at": "2026-03-01T10:00:00Z"
  }
}