Skip to main content
This template builds per-transaction pricing like Stripe’s with Lago: a percentage of each transaction amount plus a fixed fee per transaction. It suits fintechs and marketplaces that take a fee on the payment volume they process for customers. Legacy (v1): Clone Stripe pricing with subscriptions.

Pricing structure

Stripe charges per successful card payment. The rate and the fixed fee depend on the payment method. This template covers card payments.

How it maps to Lago

Get started

1

Set up Lago

Use https://api.eu.getlago.com for the EU cluster. API endpoints live under /api/v2 and require the product catalog to be enabled on your organization.
2

Create a billable metric

Sum transaction amounts, with a type dimension for the payment method.
Refer to the API reference and the billable metrics guide.
3

Create a metered product and its filters

Create one filter per payment type:
Create card_in_person the same way with "value": "in-person". Refer to the product filters guide.
4

Create a rate card per filter

Set billing_timing to advance so fees are charged as transactions arrive. The percentage rate takes rate (the percentage) and fixed_amount (the per-transaction fee).
Repeat for in-person payments:Spending minimums (min_amount_cents) are not available with advance billing. Refer to the API reference and the percentage model.
5

Create a plan and apply the rate cards

Apply card_online_usd and card_in_person_usd:
Refer to the API reference and the plans guide.
6

Create a customer

An existing external_id returns 422 instead of updating the customer. Refer to the API reference to create a customer.
7

Create a contract

Replace __PLAN_CODE__ with card_processing_plan.
The plan supplies the contract’s initial applied rate cards. A future started_at creates a pending contract that becomes active on that date. Only one pending or active contract can use a given external_id at a time. Refer to the API reference to create a contract.
The example dates are in the future. To test right away, set each rate’s effective_from to today and omit started_at, which defaults to now.
8

Ingest transactions via events

Send one event per transaction with its amount and type.
Refer to the API reference and the usage ingestion guide.
9

Monitor current usage

Track usage across the contract’s open billing periods.
The response returns amount_cents, taxes_amount_cents, total_amount_cents and a rate_cards array with usage per applied rate card. Pending contracts have no usage. Totals can span several invoices, so this is not a preview of one invoice. Filter with rate_card_code, product_code, product_filter_code or product_type. Refer to the API reference to get current usage.

Worked example

One online card payment of $200:

What changed from v1

  • The v1 template set invoiceable: false on the charge. v2 rate cards have display_on_invoice and regroup_paid_fees, which control how advance fees appear on invoices. They are not a one-to-one replacement, so this template keeps the defaults.
  • The v1 template estimated fees with POST /events/estimate_fees. The v2 API does not document an equivalent, so this template omits fee estimation.
  • Events target external_contract_id instead of external_subscription_id.

Percentage model

Calculate a fee from a measured monetary base.

Rate cards

Currency, billing timing and proration per product or filter.

Contracts

Apply a plan to a customer.

Create a product filter (API)

POST /api/v2/products/{product_code}/filters