Discounts
A discount takes a percentage or a fixed amount off a checkout. You add it when you create the checkout through the API, and Vatly applies it to the payment, the taxes, the order, the invoice and the receipt. Nothing needs to be enabled first.
A discount reduces the first payment of each product in the checkout. Subscription renewals after that are charged the full price.
Apply a discount to a checkout
Send discounts with one entry when you create a checkout. An entry has either a percentage or a fixed amount, never both, and an optional description:
percentage: above 0 and below 100, with at most three decimals, such as20or12.5.amount: a fixed amount in EUR, such as{"value": "10.00", "currency": "EUR"}. See The tax basis for whether it includes taxes.description: up to 255 characters. Your customer sees it on the checkout, the receipt and the invoice, as "Discount Black Friday". Without one, the line reads "Discount".
curl https://api.vatly.com/v1/checkouts \
-H "Authorization: Bearer live_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"products": [
{"id": "one_off_product_Vr8kQdFhSrG4Y3DnfsdqH"}
],
"discounts": [
{"description": "Black Friday", "percentage": 20}
],
"redirectUrlSuccess": "https://example.com/success",
"redirectUrlCanceled": "https://example.com/canceled"
}'
$checkout = $vatly->checkouts->create([
'products' => [
['id' => 'one_off_product_Vr8kQdFhSrG4Y3DnfsdqH'],
],
'discounts' => [
['description' => 'Black Friday', 'percentage' => 20],
],
'redirectUrlSuccess' => 'https://example.com/success',
'redirectUrlCanceled' => 'https://example.com/canceled',
]);
const checkout = await vatly.checkouts.create({
products: [{ id: "one_off_product_Vr8kQdFhSrG4Y3DnfsdqH" }],
discounts: [{ description: "Black Friday", percentage: 20 }],
redirectUrlSuccess: "https://example.com/success",
redirectUrlCanceled: "https://example.com/canceled",
});
For a fixed amount, send {"description": "Welcome", "amount": {"value": "10.00", "currency": "EUR"}} as the entry instead.
A checkout takes one discount for now. It applies to the whole checkout: Vatly spreads it over the products in proportion to their prices, so with €100 and €50 in the cart, €15 off takes €10 and €5. When your customer pays in another currency, a fixed amount is converted at checkout.
The tax basis
A fixed amount is on the same basis as your products' prices. All products in a checkout share one taxBehavior (see one-off products and subscription plans), so there is one basis per checkout:
- Tax-exclusive prices: the amount excludes taxes. €10.00 off a €100.00 product leaves €90.00, and tax is charged on the €90.00: €108.90 at a 21% rate.
- Tax-inclusive prices: the amount includes taxes, like the price. €10.00 off a €121.00 product charges €111.00, and the €111.00 includes €19.26 tax at a 21% rate.
A percentage takes the same share off either way: 10% off €121.00 including taxes charges €108.90.
In both cases tax is charged on what your customer actually pays, so the discount also lowers the tax. Vatly works out the taxes for the buyer's country as usual; you never calculate them yourself.
Subscriptions and trials
On a subscription plan, the discount reduces the first payment. Every renewal after it is charged the plan's full price.
When the plan starts with a trial, the plan itself is not charged today (a small payment-method authorization charge may still apply), so its discount moves to the first payment after the trial:
- It works the same on tax-exclusive and tax-inclusive plans. On a tax-inclusive plan, a fixed amount includes taxes at that payment too.
- A percentage applies to whatever that payment is. 20% off stays 20% off when the plan changes during the trial.
- A fixed amount stays the same, up to the payment. If you move the customer to a cheaper plan during the trial and the discount is more than the new price, that first payment is free.
- Plan, price and quantity changes during the trial keep the discount, whether you change the subscription immediately or at the end of the trial. An immediate change that ends the trial charges the first payment right away, and the discount comes off that payment.
- A subscription canceled during its trial never uses the discount.
The hosted checkout shows it below the total, as "Discount Black Friday on your first payment", because none of that part is charged today.
Mixed checkouts
A checkout can combine products charged today with a subscription on trial. The discount then reduces the first payment of every product, today's and the trial's:
- A percentage comes off every product's first payment. 10% off a €100 product today and a €30 plan on trial takes €10 today and €3 off the plan's first payment after the trial.
- A fixed amount is split over the same first payments, in proportion to their prices, so it lands where a percentage of the same size would. €40 off €100 today plus a €30 plan on trial takes €30.77 today and €9.23 off the plan's first payment.
On tax-inclusive prices the split uses the prices including taxes: €130.00 off a €121.00 product today and a €30.25 plan on trial takes €104.00 today and €26.00 off the plan's first payment.
Want the whole discount on one product instead? Create a checkout with only that product.
Orders, invoices and receipts
The paid order lists the discount under discounts, and each order line lists its share under its own discounts. An entry has an id shared by the order's entry and every line's share, the description, the discountType (percentage or fixed_amount), the percentage when there is one, and the amount.
- Amounts exclude taxes, like a line's
subtotal, also on tax-inclusive prices. The €10.00 off a €121.00 product above reads8.26at a 21% tax rate. A line'ssubtotal,taxesandtotalare already net of its discounts, andbasePricestays the full unit price. - The invoice prints each product at its full price, with the discount on its own line below it, with the tax it takes off: "Product €100.00 + €21.00 tax", then "Discount Black Friday −€8.26 − €1.74 tax", so the customer pays €111.00.
- The receipt email lists the discount with the items.
- A first payment after a trial is billed on a renewal order, which carries the discount in the same way. Several subscription charges for the same customer may share one order, and a free or below-minimum charge may be deferred to a later order. The
order.*webhooks carry the discount like any other order's.
Refunds take the discount into account: a full refund returns what the customer paid, not the full price.
Errors and limits
Vatly rejects a discount it cannot apply with 422 and a validation error keyed by its position, such as discounts.0.percentage (see Errors). It returns 422 when:
- you send more than one entry (one discount per checkout for now);
- an entry has both a
percentageand anamount, or neither; - the
percentageis 0 or less, 100 or more, or has more than three decimals; - the
amountis zero or less, or not inEUR; - the
amountis not below the checkout's subtotal on the products' tax basis, counting a subscription on trial at its first payment after the trial; - no product in the checkout has a price.
The discount never makes today's payment free: a percentage stays below 100, and when part of a fixed amount comes off today, at least the smallest currency unit (€0.01) stays payable.
Learn more
- Checkouts API: Discounts
- Orders API: Discount properties
- PHP SDK: Checkouts and Orders
- JavaScript SDK: Checkouts and Orders
- OpenAPI spec
Migrate from Lemon Squeezy
Lemon Squeezy shuts down on 31 March 2027. Vatly is the European Merchant of Record for AI, software and digital products: EU-based, EU data, built on Mollie. Here's how to move.
Build your own integration
Understand what adopting Vatly involves: responsibilities, checkout and fulfillment, choosing an integration path, and preparing your developer or AI agent.