Discounts

Docs

Discounts

Coupons are ShipBill's own: you make a code once, and ShipBill checks it, prices the order after it, and counts its uses — the same on every payment provider you connect. The provider only sees the discounted price.

Make a coupon

In the dashboard, under Products → Coupons, or from your server. A coupon takes a percentage or a fixed amount in each currency it applies to, all products or chosen ones, and optional limits: uses in all, uses per customer, first purchases only, a minimum order, and dates. Coupons belong to a mode: a test coupon never applies to a live checkout.

Node
const coupon = await shipbill.coupons.create({
  code: "SPRING20",
  name: "Spring sale",
  kind: "percent",
  percent_bp: 2000,             // 20%
  max_redemptions: 500,
  ends_at: 1780272000,          // unix seconds
});

How buyers use a code

When you have a live coupon, the checkout shows a quiet Have a code? link under the order. The buyer types the code and sees the new total before paying. The browser sends the code, never an amount: the discount is worked out on ShipBill's server, and checked again when they pay, so a code that has just run out is taken off before any provider is asked to charge.

Apply a code for the buyer

  • Payment link: choose a coupon when you make the link, or add ?code=SPRING20 to its address. A code that no longer applies is simply left off.
  • Buy button: data-shipbill-coupon="SPRING20" on the button.
  • Your server: discounts: [{ coupon: "SPRING20" }] on a checkout session or a payment intent. A discount your server sets is fixed: the buyer can't remove it. A code that doesn't apply fails the request with coupon_not_applicable. Set allow_discount_codes: false to hide the code field on a session.
Node
const session = await shipbill.checkout.sessions.create({
  line_items: [{ product: "prod_…", quantity: 1 }],
  discounts: [{ coupon: "SPRING20" }],
  allow_discount_codes: false,
});

What your webhook sees

payment.succeeded, the session, the invoice, and the payment carry discount: { coupon, code, amount, currency } (or null), and each line item its discount_amount. amount is what the buyer was charged, so a feature you gate by price sees the price actually paid. A coupon that covers the whole order completes it at zero without a provider: the payment's method_type is free.

Subscriptions

A coupon's duration says how far it reaches into a subscription: the first payment, a number of billing periods, or every payment. Renewals keep the discount while the coupon is available. Once you archive it, it's used up, or its end date passes, every subscription carrying it renews at the full price from its next renewal, and the subscriber is emailed. Payments already made keep their discount, and an ended discount never comes back, even if the coupon becomes available again. Editing the coupon's terms changes nothing for subscriptions already using it.

To end one subscriber's discount early, use End discount on the subscription's page, or DELETE /v1/subscriptions/{id}/discount. The object's discount.periods_remaining says how many renewals are left, and discount.ended_at and ended_reason say when and why it ended early; subscription.updated tells your server. Switching to another subscription product starts the new subscription without it.

Creem and Whop can't remove a running subscription's discount, so a subscription bought with a coupon lasting past the first payment goes to another provider. A first-payment coupon still goes to Creem; Whop takes no discounted subscription.

Last checked against the product on 12 October 2026.

NextWebhooksReceive events on your server, check their signatures, and handle retries and repeats.