Skip to main content

Place Subscription Order

Place a new order for a subscription product (e.g., specific software licenses or services). This endpoint handles starting trials, activating paid subscriptions, and renewing existing ones.

Endpoint

POST /v1/orders/b2b/direct-checkout

Headers

HeaderTypeDescriptionRequired
x-client-idStringYour clientID✅ Yes
x-client-secretStringYour clientSecret✅ Yes
Content-TypeStringMust be application/json✅ Yes

Request Body

Use this format when starting a trial, activating, or renewing a subscription.

FieldTypeDescriptionRequired
dpIDStringYour delivery partner ID (same as clientID)✅ Yes
variantIDStringProduct variant identifier✅ Yes
externalRefIDStringUnique reference ID provided by client✅ Yes
actionStringAction: TRIAL, ACTIVATE, RENEW✅ Yes
subscriberIDStringThe unique ID of the user (e.g., your internal userId) for whom the order is being placed.✅ Yes
Understanding Subscriber ID

The subscriberID MUST be the userId of the specific user for whom the order is being placed. If you are integrating this as a company, use the unique internal userId of your user who will consume this subscription.

Subscription Actions Explained

ActionDescriptionDependencies
TRIALStart a new trial subscriptionsubscriberID IS required
ACTIVATEStart a new paid subscriptionsubscriberID IS required
RENEWRenew an existing subscriptionsubscriberID IS required

Subscription Lifecycle and Billing

Wallet Deduction

  • TRIAL: No wallet balance is deducted when starting a trial.
  • ACTIVATE & RENEW: The required amount will be deducted from your wallet immediately upon placing the order.

Trial Duration and Notifications

  • The duration of a TRIAL subscription depends on the configuration of the specific product variant.
  • Subscription expiry notifications will be sent to the Delivery Partner (DP) when only 7 days are remaining before the subscription expires.

Post-Trial Behavior

Once the trial period ends, the system automatically attempts to renew the subscription:

  1. Successful Renewal: If your wallet has sufficient balance, the subscription is automatically renewed, and the balance is deducted.
  2. Cancellation: If there is insufficient balance in your wallet at the end of the trial, the subscription will be automatically cancelled.
Trial Limitation

A trial is applicable only once per user across all subscription products. This means if a user has already used a trial for any subscription product, they cannot initiate another trial for any other product.

Subscription Cancellation

To manually cancel a TRIAL subscription before it ends, use the Cancel Subscription endpoint.

Example Request

curl --location 'https://stage-platform-exlr8.exlr8now.com/v1/orders/b2b/direct-checkout' \
--header 'x-client-id: YOUR_CLIENT_ID' \
--header 'x-client-secret: YOUR_CLIENT_SECRET' \
--header 'Content-Type: application/json' \
--data '{
"dpID": "{YOUR_DP_ID}",
"variantID": "VAR-SUBS-123",
"externalRefID": "sub-order-001",
"action": "ACTIVATE",
"subscriberID": "user-12345"
}'
Unique External Reference

The externalRefID must be unique for each order. This is your reference for tracking the order in your system.

Response

Successful Response

{
"orderID": "ORDIN123456789",
"externalRefID": "sub-order-001",
"status": "COMPLETED",
"fulfillmentStatus": "FULFILLED",
"type": "DIRECT_CHECKOUT",
"lineItems": [
{
"variantID": "VAR-SUBS-123",
"productID": "PROD-SUBS-001",
"productName": "Premium Subscription Service",
"subscription": {
"subscriptionID": "SUBS-123456789",
"subscriberID": "SUBR-987654321",
"state": "ACTIVE",
"startTime": "2025-12-09T07:40:30.72Z",
"endTime": "2026-01-09T07:40:30.72Z",
"action": "ACTIVATE"
}
}
]
}
Order Currency Conversion

In the order response, the line item currency is AED, and the totalConvertedPrice (2448.44) is calculated by converting the totalPrice (100) using the fxRate (24.4844) to your selected wallet currency (INR). This ensures the order amount deducted from your wallet is in your selected currency.

Response Fields

FieldTypeDescription
orderIDStringSystem-generated unique order identifier
externalRefIDStringYour provided external reference
dpUserEmailStringEmail of the DP user
dpUserNameStringName of the DP user
dpIDStringYour delivery partner ID
statusStringOrder status
fulfillmentStatusStringFulfillment status
typeStringOrder type
lineItemsArrayArray of ordered items with details

Cancel Trial Subscription

Cancel an active trial subscription.

Endpoint

POST /v1/subscriptions/cancel

Headers

HeaderTypeDescriptionRequired
x-client-idStringYour clientID✅ Yes
x-client-secretStringYour clientSecret✅ Yes
Content-TypeStringMust be application/json✅ Yes

Request Body

FieldTypeDescriptionRequired
subscriberIDStringThe ID of the subscription to cancel (must be a trial request)✅ Yes
{
"subscriberID": "SUBR-123456789"
}

Response

Successful Response

{
"message": "Subscription cancelled successfully"
}

Error Responses

Subscription Not Found

{
"error": "subscription not found for subscriberID: SUBR-123456789",
"errCode": "RECORD_NOT_FOUND"
}

Not a Trial Subscription

{
"error": "subscription is not in trial state, cannot cancel",
"errCode": "UNPROCESSABLE_ENTITY"
}