Checkouts

On this page, we'll dive into the different checkout endpoints you can use to manage your checkouts programmatically.

The Checkout API Resource

Below you'll find all properties for the Vatly Checkout API resource.

Properties

NameTypeDescription
idstringUnique identifier for the checkout (starts with checkout_).
resourcestringThe resource type. Always checkout.
orderIdstring | nullUnique identifier for the order created from this checkout. Only available when the checkout has been paid successfully.
customerIdstring | nullThe customer associated with this checkout. Always present; null until a customer is associated. For an anonymous checkout this happens when the buyer completes payment.
testmodebooleanWhether this checkout is in test mode.
redirectUrlSuccessstringThe URL to which the checkout should redirect the user after the checkout has been paid successfully. May contain the literal {CHECKOUT_ID} placeholder, which Vatly substitutes with this checkout's ID at creation time (e.g. https://example.com/return?checkout_id={CHECKOUT_ID}).
redirectUrlCanceledstringThe URL to which the user should get redirected when the user cancels the checkout. Supports the same {CHECKOUT_ID} placeholder as redirectUrlSuccess.
metadataobject | nullArbitrary key-value metadata for your application. Up to 50 keys, with key names up to 40 characters and values up to 500 characters.
localestring | nullThe language the hosted checkout was asked to present in, as sent on creation. null means none was specified and the checkout picks a language from the shopper's browser. One of en, de, fr, nl, es, it, pt, pl, cs, ca, da, el, fi, hu, is, lt, lv, nb, sk, sl, sv, tr, or null.
statusstringThe status of the checkout. Can be created, paid, canceled, failed, or expired.
expiresAtstring | nullWhen this checkout will expire (ISO 8601 format).
createdAtstringThe moment the checkout was created, in ISO 8601 format.
linksobjectHATEOAS links to related resources. Contains checkoutUrl (the hosted checkout page URL), self, and order. order is always present and is null until the checkout completes.

List all checkouts

GET /v1/checkouts

This endpoint allows you to retrieve a paginated list of all your checkouts. By default, a maximum of ten checkouts are shown per page.

Optional attributes

NameTypeDescription
limitintegerThe number of checkouts to return (default: 10, max: 100).
startingAfterstringA cursor for use in pagination. Returns results after this checkout ID.
endingBeforestringA cursor for use in pagination. Returns results before this checkout ID.
curl -G https://api.vatly.com/v1/checkouts \
  -H "Authorization: Bearer live_your_api_key_here" \
  -d limit=10

Create a checkout

POST /v1/checkouts

This endpoint allows you to start a new hosted Vatly Checkout. Make sure you have at least one subscription plan or one-off product configured in your Vatly account.

Once paid, any subscription plan product assigned to the checkout will kick off a new subscription for that plan.

Required attributes

NameTypeDescription
productsarrayAn array of product objects to include in this checkout. Each product can have: id (required, starts with one_off_product_ or subscription_plan_), quantity (optional, default: 1), price (optional, EUR-only price override; see Custom pricing), trialDays (optional, see below), metadata (optional, same limits as the checkout's metadata). price, trialDays and metadata also accept null, which is treated as omitted.

trialDays is a whole number of at least 1 and only works on a subscription plan. 0 or below, or any value on a one-off product, returns 422. Omit it or send null for no trial.
redirectUrlSuccessstringThe URL to which the checkout should redirect the user after the checkout has been paid successfully. You may include the literal {CHECKOUT_ID} placeholder anywhere in the URL, and Vatly substitutes it with this checkout's ID, so your return page can read the checkout ID without a server-side token store.
redirectUrlCanceledstringThe URL to which the user should get redirected when the user cancels the checkout. Supports the same {CHECKOUT_ID} placeholder.

Optional attributes

NameTypeDescription
metadataobject | nullArbitrary key-value metadata for your application: an object with string values, up to 50 keys, key names up to 40 characters and values up to 500 characters. Anything else returns 422. null is treated as omitted.
customerIdstringThe ID for an existing customer to associate with this checkout. If provided, the customer's email will be pre-filled. Must match the testmode of the API token.
billingAddressobjectOptional editable prefill for the billing address fields on the hosted checkout. Accepts the standard address fields (fullName, companyName, taxId, streetAndNumber, streetAdditional, city, region, postalCode, country). When country is supplied it takes precedence over the shopper's IP address for determining their country. A supplied taxId is only a prefill; it is not registered until the buyer submits the checkout.
discountsarray | nullA discount on the whole checkout: at most one entry for now (a second returns 422). Each entry has a percentage or a fixed amount, not both, plus an optional description label shown on the checkout and the invoice. It reduces the first payment of each product only; renewals charge the full price. See Discounts. null is treated as omitted.
localestring | nullLanguage to present the hosted checkout in, including its validation and error messages. Send a bare language code (de), a BCP 47 tag (de-AT), or a POSIX / ISO 15897 locale (de_DE); all three fold to the language, so there are no region-specific variants. The language also carries through to the payment provider's own hosted page. Supported languages: en, de, fr, nl, es, it, pt, pl, cs, ca, da, el, fi, hu, is, lt, lv, nb, sk, sl, sv, tr. Norwegian is served as nb; no and nn fold to it. Anything else is a 422 naming the supported set. Omit it (or send null) to detect the language from the shopper's Accept-Language header, falling back to English. The response echoes back the folded language, not the string you sent.
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", "quantity": 1},
      {"id": "subscription_plan_Rk5pQrSvWm8NjLhYbUcP", "trialDays": 14}
    ],
    "redirectUrlSuccess": "https://example.com/return?checkout_id={CHECKOUT_ID}",
    "redirectUrlCanceled": "https://example.com/canceled",
    "locale": "de"
  }'

Custom pricing

Charge an amount that differs from the product's dashboard price by setting price on the item, a Money object whose value is a decimal string with exactly two decimals. Currently only EUR is accepted; any other currency returns a 422. When the customer pays in another currency, the amount is converted from this EUR price at checkout, and for a subscription the converted amount and currency are then fixed, so renewals charge the same. The id still references a product you created in the dashboard; products cannot be created on the fly via the API. Omit price to use the product's configured price.

For a subscription plan, a custom price is not a first-payment discount (use discounts for that); it becomes the subscription's recurring price and carries over to every renewal. This is how you give a cohort a permanent price (for example, a lower price for an early group of customers). If you'd prefer to track that cohort separately, create a dedicated subscription plan at the target price and check out against that instead; the recurring price is the same, but reporting stays cleaner.

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",
        "quantity": 2,
        "price": {"value": "49.99", "currency": "EUR"}
      }
    ],
    "redirectUrlSuccess": "https://example.com/success",
    "redirectUrlCanceled": "https://example.com/canceled"
  }'

Discounts

Take a discount off the checkout by sending discounts with one entry: a percentage (above 0 and below 100, at most three decimals) or a fixed amount (a Money object in EUR), not both. An optional description (up to 255 characters) labels the discount on the checkout and the invoice. Discounts work on every checkout; nothing needs to be enabled.

  • Whole checkout. The discount is spread over the discountable lines in proportion to each line's subtotal.
  • First payment only. It reduces the first payment of each product; subscription renewals are charged the full price. For a subscription on trial, the discount applies to its first payment after the trial, and stays on it if the plan or quantity changes during the trial.
  • Fixed amounts follow the products' tax basis. A fixed amount excludes taxes on tax-exclusive products and includes them on tax-inclusive ones: €10.00 off a €121.00 price including taxes charges €111.00. That also holds for a subscription on trial, whose first payment after the trial takes its share including taxes on tax-inclusive prices. It must be below the subtotal of the products it discounts on that same basis (counting a subscription on trial at its first payment). When the customer pays in another currency, it is converted at checkout.

Validation errors for a discount are keyed by its position, such as discounts.0.percentage (see Errors). The Discounts guide walks through trials, mixed checkouts and invoices.

The resulting order and its lines list the discount under discounts. There, a discount's amount always excludes taxes, like subtotal: the €10.00 above reads 8.26 at a 21% tax rate. See the order model.

curl https://api.vatly.com/v1/checkouts \
  -H "Authorization: Bearer live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "products": [
      {"id": "subscription_plan_Rk5pQrSvWm8NjLhYbUcP"}
    ],
    "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"}} instead.

VAT and reverse charge

As Merchant of Record, Vatly determines the applicable tax when the checkout is paid, based on the buyer's country and tax status. You don't calculate or configure rates yourself. For EU B2B, the buyer's VAT ID is validated against the EU's VIES registry as part of that determination: when a valid VAT ID is supplied and the buyer is in a different country from the supplier, the reverse charge applies (0% VAT) and the resulting order reflects it. Otherwise the buyer's country standard rate applies.

This describes live mode. In test mode VIES is not called and validity is simulated; see Tax IDs and reverse charge in test mode.
The full request and response schema (every accepted field and its validation rules) is published in the OpenAPI spec. Point your code generator or AI assistant at it when an example leaves a field ambiguous.

Payment methods in test mode

Some payment methods work in live mode but cannot be completed in test mode, because the payment provider cannot settle them there. A test-mode checkout still lists them, greyed out and labelled as unavailable, so you can see they exist without being able to select one:

MethodTest modeReason
paybybankNot selectableThe provider cannot settle Pay by Bank in test mode.

Every other method behaves identically in both modes. Test a checkout with any selectable method (creditcard and ideal cover the one-off and mandate flows), and the resulting orders, invoices and webhooks are the same ones live mode produces.


Retrieve a checkout

GET /v1/checkouts/:id

This endpoint allows you to retrieve a checkout by providing the checkout id. Refer to the list at the top of this page to see which properties are included with checkout objects.

curl https://api.vatly.com/v1/checkouts/checkout_QdEpFhdSrG4Y3DnfsdqsH \
  -H "Authorization: Bearer live_your_api_key_here"
Copyright © 2026