Skip to main content
Kelviq can show a discount-code field at checkout or apply a known code before the checkout page opens. Use the first option for general promotions and the second for targeted campaigns, partner offers, or customer-specific links.

Before you start

Create the code in Product Catalog → Discounts and check that it:
  • is active and has not expired;
  • has not reached its redemption limit;
  • applies to the selected product and plan; and
  • uses the same currency as the price when it is a fixed-amount discount.
Learn how to create and restrict a discount →

Let the customer enter a code

When creating a checkout session through the API, set discountsEnabled to true. This shows the discount-code field so the customer can enter an eligible code.
discountsEnabled defaults to true. Set it to false only when you want to hide discount-code entry for that session.

Pre-apply a code with the Checkout API

Pass the code as discountCode in the JSON request body. Kelviq validates it while creating the checkout session. If the code is inactive, expired, or not valid for the selected plan, the request fails instead of creating a session with the wrong price.
A successful request returns the hosted checkout URL:
Redirect the customer to checkoutUrl. Before completing payment, confirm that checkout shows the code, adjusted price, currency, and billing period you expect. For a static product checkout link, use the snake-case discount_code query parameter:
Use the product UUID shown in the Kelviq dashboard. URL-encode the code if it contains spaces or reserved characters.
The names are different by design: use discountCode in an API JSON body and discount_code in a static checkout URL.
See all static checkout URL parameters →

Test the integration

Test the complete flow in sandbox before using a production code:
  1. Create a sandbox discount and an eligible product price.
  2. Create the checkout session with the matching sandbox API key.
  3. Open the returned checkout URL.
  4. Confirm the original price, discount, tax, and final total.
  5. Complete payment with a sandbox payment method and check the resulting order.
Do not test a small live charge on your own card. Repeated self-payments can cause the card to be blocked. Use sandbox, or use a valid 100% discount when you must inspect the production checkout without collecting a real payment.

Troubleshooting

For the complete request and response schema, see Create a checkout session API reference.