Skip to main content
POST
cURL
Redeems one of your reward codes for a customer, such as one typed in your app’s billing page. A grant code gives its credits and units at once: the redemption is active, with what it gave in grants. For a coupon code, on a current paid plan the coupon covers, Ledger puts it on the customer’s subscription and it discounts from their next invoice (appliesFrom: "next_invoice"). Otherwise it waits for their next attach of a plan it covers (next_attach). A subscription carries one Ledger coupon at a time: a second one is queued and starts when the first ends. Refusals, in the order Ledger checks: 404 promotion_code_not_found, 409 promotion_code_expired, 409 promotion_code_not_for_customer, 409 promotion_code_first_time_only (the customer has paid for a plan or pack), 409 promotion_code_already_redeemed, 409 promotion_code_exhausted. Send an Idempotency-Key header to retry safely: a retry returns the first redemption. Needs the Billing permission.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

customerId
string
required

Your ID for the customer.

Required string length: 1 - 255

Body

application/json
code
string
required

The code the customer typed, any case.

Required string length: 1 - 40

Response

Redeemed. A grant code's credits and units are the customer's at once (grants). On a current plan a coupon covers, Ledger puts it on the customer's subscription and it discounts from the next invoice; otherwise it waits for their next attach of a covered plan. A repeat with the same Idempotency-Key returns the first redemption.

referral
object | null
required

The referral, when the code was a referrer's: rewarded at once for a signup program, pending until the referee's first payment for first_payment. Null for a promotion code.

redemptionId
integer
rewardId
string
kind
enum<string>
Available options:
coupon,
grant
code
string | null
status
enum<string>

pending: waiting for a bill (the customer's next attach of a covered plan, or Ledger putting it on their current one). queued: their bill already has a Ledger discount; it starts when that one ends. active: on the bill, or a grant's credits and units granted. ended: used up, or the bill ended. void: never applied, such as an abandoned Checkout; its use was given back.

Available options:
pending,
queued,
active,
ended,
void
appliesFrom
enum<string> | null

While pending or queued: the customer's next invoice on their current plan, or their next attach of a plan the coupon covers.

Available options:
next_invoice,
next_attach,
null
subscriptionId
integer | null
discount
object | null

A coupon's terms. Null for a grant.

grants
object[] | null

What a grant gave the customer, each with when it expires. Null for a coupon.

endsAt
string | null
endedReason
enum<string> | null
Available options:
duration,
subscription_ended,
removed,
null
createdAt
string