Skip to main content
Cuprice prices the plan, hands the buyer to your checkout link, and steps out. Your checkout charges the buyer and sends them back.

Regular plans

  1. The buyer clicks a plan on your pricing page or embed, with monthly or annual billing selected.
  2. Cuprice builds a checkout payload for that plan from the live plan data.
  3. Cuprice sends the buyer to your checkout link with the query parameters below. With postMessage, it fires cuprice:checkout on your page instead.
  4. Your checkout creates the payment with your provider.
  5. When the payment is done, your checkout sends the buyer to success_url. If they leave, it sends them to cancel_url.

Custom plans

  1. The buyer opens the custom plan card, picks features and sets amounts for limit and usage-based features.
  2. Cuprice prices the selection on its server.
  3. The handoff works as for regular plans, with cuprice_custom_plan=true, cuprice_plan_id=0 and the chosen features in selected_features.
The custom plan card always sends monthly billing (interval=month).

Query parameters

Cuprice adds these to your checkout link: A regular monthly plan arrives like this (line breaks added):
The query string passes through the buyer’s browser, so anyone can change amount before it reaches you. Never charge the amount from the URL. Look the price up on your server: from your own price list by plan_id, or from the Checkout Payload endpoint by cuprice_plan_id and interval.
Feature names in selected_features are joined with commas, so a feature name that contains a comma cannot be split back reliably. Keep commas out of feature names, or use postMessage, whose payload carries the names as an array.

The checkout payload

The cuprice:checkout event and the Checkout Payload endpoint carry the same JSON. Trimmed example for an annual plan:
  • plan.amount is the price the buyer saw on the page for the chosen interval. In this example the monthly price is 19, so a year is 19 × 12 = 228, minus the 20% annual discount (45.6), which gives 182.4. Annual amounts can carry floating-point noise (a 49 plan comes out as 470.40000000000003), so round to your currency’s smallest unit before charging. The amount query parameter has the same value.
  • features lists what the plan includes, with each limit worked out. Feature Gating uses it to unlock features after payment.
  • For a custom plan, plan.isCustom is true, plan.id is 0, and customPlan holds selectedFeatures and featureUsageAmounts.
  • metadata holds string IDs you can copy straight into your payment provider’s metadata, so the payment can be matched back to the Cuprice plan later.