Regular plans
- The buyer clicks a plan on your pricing page or embed, with monthly or annual billing selected.
- Cuprice builds a checkout payload for that plan from the live plan data.
- Cuprice sends the buyer to your checkout link with the query parameters below. With postMessage, it fires
cuprice:checkouton your page instead. - Your checkout creates the payment with your provider.
- When the payment is done, your checkout sends the buyer to
success_url. If they leave, it sends them tocancel_url.
Custom plans
- The buyer opens the custom plan card, picks features and sets amounts for limit and usage-based features.
- Cuprice prices the selection on its server.
- The handoff works as for regular plans, with
cuprice_custom_plan=true,cuprice_plan_id=0and the chosen features inselected_features.
interval=month).
Query parameters
Cuprice adds these to your checkout link:
A regular monthly plan arrives like this (line breaks added):
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
Thecuprice:checkout event and the Checkout Payload endpoint carry the same JSON. Trimmed example for an annual plan:
plan.amountis 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 as470.40000000000003), so round to your currency’s smallest unit before charging. Theamountquery parameter has the same value.featureslists what the plan includes, with each limit worked out. Feature Gating uses it to unlock features after payment.- For a custom plan,
plan.isCustomistrue,plan.idis0, andcustomPlanholdsselectedFeaturesandfeatureUsageAmounts. metadataholds string IDs you can copy straight into your payment provider’s metadata, so the payment can be matched back to the Cuprice plan later.
