Skip to main content
PREMIUM ADD-ON ✨This feature is available upon request only. Please contact us to get access to this premium feature.
Stripe integration onlyWhile Lago supports multiple payment providers, payment pre-authorization is currently only available with Stripe.

Introduction

By default, when creating a subscription, Lago follows this process:
  1. Creates and activates the subscription (unless scheduled for the future or it’s a downgrade);
  2. Generates the invoice asynchronously; and
  3. Processes the payment asynchronously.
A subscription can therefore become active even if the payment later fails. This behavior is intentional, but it does not suit every use case. Payment pre-authorization addresses this. It checks that a payment method is valid for a given amount before the subscription is created.
Important: If the pre-authorization fails, the entire process is aborted and no subscription is created.

How pre-authorization works

Pre-authorization creates a Payment Intent in Stripe to verify that the payment amount can be collected. When successful, the amount is temporarily held on the customer’s account but not captured. Lago releases the held funds immediately after a successful verification.

Supported payment methods

Pre-authorization relies on Stripe’s manual capture, so it only works with payment methods that support it. Cards and Link do; bank debits and transfers do not. When the payment method to pre-authorize is a SEPA Direct Debit, ACH Direct Debit, Bacs Direct Debit, Boleto or bank transfer, Lago rejects the request before calling Stripe. It returns a payment_method_not_supported_for_authorization validation error on payment_method_id, and no subscription is created. If Lago doesn’t know the payment method’s type, Stripe refuses the hold instead, and the request returns a provider_error. The exact list depends on the payment methods enabled on your Stripe account. Refer to the Manual capture column of Stripe’s payment method support matrix. Pre-authorization can fail if the card details are invalid, if the customer has insufficient funds, or if the payment method type does not support manual capture. If 3DS is required during pre-authorization, the card is considered valid and the subscription is created.

Limitations

Pre-authorization reduces payment failures, but it cannot guarantee that the invoice is paid, because:
  1. Conditions may change between pre-authorization and actual payment:
    • Customer’s account balance may decrease
    • Card may be blocked or expired
  2. A bank might approve the pre-authorization but still require 3D Secure authentication for the actual payment

Implementation guide

To implement pre-authorization, use the POST /api/v1/subscriptions endpoint with additional parameters. The standard subscription parameters remain unchanged. You must manually specify the amount to authorize, as the final amount (including taxes) is only calculated during invoice generation.

Request format

The authorization object sits next to subscription, not inside it:

Choosing the payment method to pre-authorize

Set payment_method.payment_method_id inside the subscription object to pre-authorize a specific stored payment method. The value is the Lago ID of one of the customer’s payment methods.
When you leave payment_method_id out, Lago pre-authorizes the customer’s default payment method. If the customer has none in Lago, Lago falls back to the payment method stored on the Stripe connection, then to the default payment method of the Stripe customer, then to their most recent card. If none of these exist, the request fails with a customer_has_no_payment_method validation error on payment_method_id and no subscription is created.

Success response

The response contains an authorization object describing the Stripe Payment Intent, alongside the created subscription.
A requires_capture status means the amount is held and about to be released. When 3D Secure is required, the status is requires_action and the subscription is still created.

Error response

When the payment method can’t be pre-authorized, or the customer has none, the request fails with a validation error instead: