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

❗️

Warning

Frequently 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 ProductId and quantity of each cart item.
  • You have a supported customer identifier: LogonPurchaseId, CustomerReferenceId, or SubscriptionId.
  • 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:

IdentifierTypeWhen to use it
Cart.LogonPurchaseIdintID of a previous Cleverbridge purchase. Recommended for most existing customers.
Cart.CustomerReferenceIdstrYour customer ID, if it was supplied during an earlier purchase and stored by Cleverbridge.
Subscription.SubscriptionIdstrCleverbridge subscription ID for a billing event associated with a subscription that you manage.
❗️

Important

Include the existing SubscriptionId when processing a billing event for a client-managed subscription. Otherwise, Cleverbridge may create a new subscription.

Step 2: Build the cart

ParameterTypeRequiredExampleDescription
Cart.CartItems[].ProductIdintYes97771Cleverbridge product to purchase.
Cart.CartItems[].QuantityintYes1Number of units to purchase.
Cart.DefaultLanguageIdstrYes"en"Language used if customer interaction is required.
Cart.CartItems[].AdditionalNamestrNo"Premium support"Additional item name, if supported by the product configuration.
Cart.CartItems[].DynamicProductNamestrNo"Custom plan"Overrides the product name, if dynamic product data is enabled.
Cart.CartItems[].DynamicPriceobjectNoSupplies a dynamic price, if enabled for the product.
Cart.ExtraParametersobjectNoAdds custom x- parameters at cart level.
Cart.CartItems[].ExtraParametersobjectNoAdds 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

JSON valueModeBehavior
0Interactive (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.
1Non-interactiveCreates 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

JSON valueModeBehavior
1Enabled (default)Suspicious orders can be reviewed by the Cleverbridge anti-fraud team.
0DisabledFraud 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 statusResponse statusMeaningRecommended action
200PaidPurchase processed successfully.Store the purchase ID and fulfill the order.
200WaitingForOfflinePaymentPurchase created; payment is outstanding.Wait for the payment notification before fulfillment.
200PendingPayment was declined.Direct the customer to the returned URL.
200CustomerActionNeededCustomer or payment information is incomplete or invalid.Direct the customer to the returned URL.
400InvalidRequestRequest values are missing, invalid, or incompatible.Correct the request before retrying.
500InternalServerErrorAn 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 valueModeApplication
0DefaultInitial purchase and subsequent billing events.
1PurchaseOnlyInitial purchase only.
2SubscriptionOnlySubsequent billing events only.

This setting affects subsequent billing events only for new subscriptions. For an existing subscription, use POST /subscription/updatesubscriptionparameters.


Did this page help you?