Create Subscription
Authorizations
Basic authentication header of the form Basic <encoded-value>
, where <encoded-value>
is the base64-encoded string username:password
.
Body
The amount in lowest count unit. e.g.: For USD 1, amount is 100 representing 100 cents (The minimum amount should be greater than 1 USD)
100
Three letter abbreviation of the currency. Refer supported currencies
"USD"
Details about the customer
The URL we will callback to with the order status once it finishes.
"https://example.com/callback"
The interval group between subscriptions.
DAY
, WEEK
, MONTH
, YEAR
"MONTH"
The number of intervals between subscription billings. For example, interval = MONTH
and intervalCount = 3
bills every 3 months.
2
The number of billing cycles for which the subscription will renew before ending. The first cycle is included in this count.
2
Your identifier of the order
"order123"
Description of the order, if any
"Order for 2 items"
The URL to redirect the customer to when they cancel the subscription. If not provided, the callbackUrl will be used as fallback.
"https://example.com/cancel"
The amount to be charged at the start of the subscription. The upfront amount replaces the first subscription cycle amount. Regular amount apply from the next cycle.
200
A collection of key-value pairs that can be attached to an object for storing additional structured information. This is useful for capturing custom data or context-specific attributes.
Constraints:
- Maximum of 50 key-value pairs allowed.
- Each key must be no longer than 40 characters.
- Each value must be a string and cannot exceed 500 characters.
{
"orderId": "12345",
"customerNote": "Deliver after 5 PM"
}
Response
Unique identifier of the subscription
"66f53a6e2097773e4f0112c8"
Timestamp of when the subscription was created
"2024-09-26T10:41:50.472+00:00"
The URL to redirect the customer to the xPay payment gateway for payment.
"https://pay.xpaycheckout.com/?subscription_id=67f53a6e2097773e4f0112c8"
Was this page helpful?