Process Cart
The Process Cart endpoint processes an order automatically. Cleverbridge uses the customer's most recent payment details to process the order.
If the order cannot be processed automatically, the API returns a unique URL that can be sent to the customer to complete the transaction on the Cleverbridge-hosted website.
Implement the Process Cart API endpoint
WarningFrequently calling the /processcart resource can cause a lot of server traffic. Before using this resource, contact Client Experience for more information.
Before you start
Make sure that:
- You can authenticate requests to the Cleverbridge REST API.
- You know the
ProductIdand quantity of each cart item. - You have a supported customer identifier:
LogonPurchaseId,CustomerReferenceId, orSubscriptionId. - Your application can handle the response status and any returned completion URL.
- You have configured notifications if your system must synchronize purchase or subscription events.
Payment information and PCI compliance
Do not send payment information in the request. Cleverbridge uses stored information when available. Otherwise, the response provides a Cleverbridge-hosted URL where the customer can enter it securely.
Step 1: Identify the customer
Provide one identifier so that Cleverbridge can locate the customer and their stored payment information:
| Identifier | Type | When to use it |
|---|---|---|
Cart.LogonPurchaseId | int | ID of a previous Cleverbridge purchase. Recommended for most existing customers. |
Cart.CustomerReferenceId | str | Your customer ID, if it was supplied during an earlier purchase and stored by Cleverbridge. |
Subscription.SubscriptionId | str | Cleverbridge subscription ID for a billing event associated with a subscription that you manage. |
ImportantInclude the existing
SubscriptionIdwhen processing a billing event for a client-managed subscription. Otherwise, Cleverbridge may create a new subscription.
Step 2: Build the cart
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
Cart.CartItems[].ProductId | int | Yes | 97771 | Cleverbridge product to purchase. |
Cart.CartItems[].Quantity | int | Yes | 1 | Number of units to purchase. |
Cart.DefaultLanguageId | str | Yes | "en" | Language used if customer interaction is required. |
Cart.CartItems[].AdditionalName | str | No | "Premium support" | Additional item name, if supported by the product configuration. |
Cart.CartItems[].DynamicProductName | str | No | "Custom plan" | Overrides the product name, if dynamic product data is enabled. |
Cart.CartItems[].DynamicPrice | object | No | — | Supplies a dynamic price, if enabled for the product. |
Cart.ExtraParameters | object | No | — | Adds custom x- parameters at cart level. |
Cart.CartItems[].ExtraParameters | object | No | — | Adds custom x- parameters to an item. |
See the API reference for the complete request schema and product-dependent fields.
Step 3: Choose the processing behavior
ProcessCartMode
ProcessCartMode| JSON value | Mode | Behavior |
|---|---|---|
0 | Interactive (default) | Returns a session URL if customer information is missing or invalid. The information is held temporarily and no purchase is created until checkout is completed. |
1 | Non-interactive | Creates the purchase and returns a completion URL. Use when the customer might not open an interactive session URL within its 72-hour validity period. |
If valid information is available but payment is declined, Cleverbridge creates the purchase and returns a URL where the customer can update their payment details or method.
FraudProtectionMode
FraudProtectionMode| JSON value | Mode | Behavior |
|---|---|---|
1 | Enabled (default) | Suspicious orders can be reviewed by the Cleverbridge anti-fraud team. |
0 | Disabled | Fraud review is disabled. Use only when preventing review-related delays is essential. |
Step 4: Submit the request
curl --request POST \
--url 'https://rest.cleverbridge.com/cart/processcart' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--data '{
"Cart": {
"CartItems": [
{
"ProductId": 97771,
"Quantity": 1
}
],
"DefaultLanguageId": "en",
"LogonPurchaseId": 115000000
},
"ProcessCartMode": 0,
"FraudProtectionMode": 1
}'For a client-managed subscription, include the subscription separately:
{
"Cart": {
"CartItems": [
{
"ProductId": 97771,
"Quantity": 1
}
],
"DefaultLanguageId": "en"
},
"ProcessCartMode": 0,
"FraudProtectionMode": 1,
"Subscription": {
"SubscriptionId": "S9073119"
}
}Step 5: Handle the response
Do not treat every HTTP 200 response as a completed payment. Evaluate the response status before fulfillment.
| HTTP status | Response status | Meaning | Recommended action |
|---|---|---|---|
200 | Paid | Purchase processed successfully. | Store the purchase ID and fulfill the order. |
200 | WaitingForOfflinePayment | Purchase created; payment is outstanding. | Wait for the payment notification before fulfillment. |
200 | Pending | Payment was declined. | Direct the customer to the returned URL. |
200 | CustomerActionNeeded | Customer or payment information is incomplete or invalid. | Direct the customer to the returned URL. |
400 | InvalidRequest | Request values are missing, invalid, or incompatible. | Correct the request before retrying. |
500 | InternalServerError | An internal error occurred. | Retry according to your error policy; contact Cleverbridge if it persists. |
Optionally: Add custom x-parameters
Use x-parameters to pass custom customer, campaign, partner, tracking, or licensing data. Keys must begin with x-; the submitted values are included in notifications.
{
"ExtraParameters": {
"ExtraParameter": [
{
"Key": "x-vendor-subscription-id",
"Value": "544920"
}
]
}
}Use ExtraParameterMode for subscription products:
| JSON value | Mode | Application |
|---|---|---|
0 | Default | Initial purchase and subsequent billing events. |
1 | PurchaseOnly | Initial purchase only. |
2 | SubscriptionOnly | Subsequent billing events only. |
This setting affects subsequent billing events only for new subscriptions. For an existing subscription, use POST /subscription/updatesubscriptionparameters.
Updated 2 days ago