Skip to main content

Apply a coupon to a customer

Route

POST
/api/v1/applied_coupons

Usage

LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"

curl --location --request POST "$LAGO_URL/api/v1/applied_coupons" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"applied_coupon": {
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"coupon_code": "code",
"amount_cents": 123,
"amount_currency": "EUR"
}
}'

Arguments

{
"applied_coupon": {
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"coupon_code": "code",
"amount_cents": 123,
"amount_currency": "EUR"
}
}
AttributesTypeDescription
external_customer_idString      RequiredCustomer unique identifier in your application
coupon_codeString      RequiredCode identifying the coupon.
It must match the code property of one of the active coupons.
amount_centsInteger      OptionalAmount to apply to the customer.
If defined, it overrides the amount_cents property of the coupon
amount_currencyString      OptionalCurrency of the amount to apply to the customer.
If defined, it overrides the amount_currency property of the coupon.
It must match the currency of the customer's plan.

Responses

The coupon was assigned to the customer.

Returns an applied coupon object.

The applied coupon object

This object represents a coupon assigned to a customer of your business.
For now, it lets you assign a one-off coupon to a customer. This coupon can have a termination date or run forever.

Schema

{
"applied_coupon": {
"lago_id": "b7ab2926-1de8-4428-9bcd-779314ac129b",
"lago_coupon_id": "b7ab2926-1de8-4428-9bcd-779314ac129b",
"coupon_code": "coupon-code",
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"lago_customer_id": "99a6094e-199b-4101-896a-54e927ce7bd7",
"amount_cents": 123,
"amount_currency": "EUR",
"expiration_date": "2022-04-29",
"created_at": "2022-04-29T08:59:51Z",
"terminated_at": "2022-04-29T08:59:51Z",
}
}
AttributesDescription
lago_id     String     Not nullUnique identifer of the applied coupon in Lago application.
lago_coupon_id     String     Not nullUnique identifer of the coupon in Lago application.
coupon_code     String     Not nullCode identifying the coupon.
external_customer_id     String     Not nullUnique identifer of the customer in your application.
lago_customer_id     String     Not nullUnique identifer of the customer in Lago application.
amount_cents     Integer     Not nullAmount in cents.
amount_currency     String     Not nullCurrency of the amount.
expiration_date     String    
ISO 8601 date
Date after which the coupon will stop to apply to customer's invoices.
created_at     String     Not null    
ISO 8601 datetime in UTC
Date of assignation of the coupon to the customer.
terminated_at     String    
ISO 8601 datetime in UTC
Date of total consumption of the coupon amount or date of manual deletion of the coupon from customer's coupons.