API reference

Docs

API reference

Every operation of ShipBill's API, and every object it returns. The same description, as OpenAPI 3.1, is at api.shipbill.io/v1/openapi.json.

Basics

Addresshttps://api.shipbill.io/v1
AuthenticationAuthorization: Bearer sk_live_…. The key decides the profile and the mode; a test key sees only test data. Browser operations take the publishable key.
RequestsJSON bodies, snake_case fields. A field the operation doesn't know is refused.
AmountsIntegers in the currency's smallest unit: 4900 is $49.00.
TimesUnix seconds.
ListsNewest first, limit (up to 100, 10 by default) per page; ask for the next page with starting_after set to the last ID. created_after catches up from a time.
Your IDsCheckouts, payments, invoices, and subscriptions can be listed by your reference.
RetriesIdempotency-Key on any POST. See Retries and idempotency, which also gives the rate limits.
Errors{ error: { type, code, message, param, request_id } }. See Errors.

Checkout sessions

Create a checkout session

POST /v1/checkout/sessions

From your products (line_items) or a custom amount and currency. Send the buyer to url, or open the embedded checkout with client_token; both are returned only here.

FieldTypeMeaning
line_itemsarray of objectWhat is bought: up to 20 of your products. One subscription at most, the first line, with only its own add-ons after it; its one-time add-ons are charged with the first payment only. Or send amount and currency instead.
line_items[].productrequiredstringA product's ID (prod_…): its stored title and price are used.
line_items[].quantityinteger1 to 99. A subscription renews at this quantity for its life.
amountintegerA custom amount in the currency's smallest unit, instead of line_items. Secret key only. A one-time payment, never offered to a merchant of record, which sells only products: use line_items for those.
currencystringWith amount: a three-letter currency code, such as USD.
descriptionstringWith amount: what the buyer is paying for, shown on the checkout and invoice.
referencestringYour own ID for the purchase or the buyer, such as an order number or user ID. Returned on every event.
metadatamap of stringsUp to 50 of your own key/value pairs, returned with the object and its events.
attributionobjectWhere the buyer came from, as your site remembers it. Shown in Analytics → Sources, before what the browser says.
attribution.page_urlstringThe page of yours the buyer was on, such as your pricing page. Its campaign tags are read when you send none.
attribution.referrerstringThe site that first sent the buyer to you, as your site recorded it.
attribution.utm_sourcestring
attribution.utm_mediumstring
attribution.utm_campaignstring
replace_subscriptionstringA plan change: this subscription (sub_…) is cancelled once the new one's first payment succeeds.
customerobjectThe buyer, when your server knows them, so they aren't asked again.
customer.emailrequiredstringFilled in on the checkout, and fixed: the buyer can't change it.
customer.namestring
customer.addressobject
customer.address.line1requiredstring
customer.address.line2string
customer.address.cityrequiredstring
customer.address.regionstring
customer.address.postal_codestring
customer.address.countryrequiredstring
customer.tax_numberstring
success_urlstringWhere the buyer returns after paying; ShipBill adds ?session_id=cs_….
cancel_urlstringWhere the buyer goes if they leave without paying.
discountsarray of objectA discount to apply, fixed: the buyer can't remove it. A code that doesn't apply fails the request with coupon_not_applicable.
discounts[].couponrequiredstringA coupon's code, such as SAVE20, or its ID (cpn_…).
allow_discount_codesbooleanWhether the checkout offers a field for a discount code. By default, when you have an active coupon.
offer_addonsbooleantrue: the checkout offers the first line's product's add-ons marked Offer at the checkout, as boxes the buyer may tick, beside line_items. Those already in line_items aren't offered again. Off by default.
expires_inintegerSeconds until the checkout expires: 1800 to 86400, 86400 by default.

Returns CheckoutSessionCreated.

List checkout sessions

GET /v1/checkout/sessions

FieldTypeMeaning
limitintegerHow many per page: 1 to 100, 10 by default.
starting_afterstringThe last ID of the previous page, for the next one.
created_afterintegerUnix seconds: only what was created after this, for catching up.
statusone of "open", "processing", "complete", "expired", "cancelled"Only those in this status.
referencestringOnly those with this reference of yours.
customer_emailstringOnly this customer's.

Returns a list: { object: "list", data, has_more }, with data an array of CheckoutSession.

Retrieve a checkout session

GET /v1/checkout/sessions/{id}

Returns CheckoutSession.

Expire a checkout session

POST /v1/checkout/sessions/{id}/expire

An open session closes at once. One being paid can't be expired.

Returns CheckoutSession.

Payment intents

Create a payment intent

POST /v1/payment-intents

For your own payment page: what is bought (line_items, or amount and currency) and the buyer. The invoice is issued now. Confirm it with the method the buyer chooses. An intent is never updated: when the cart, the email, or the country changes, cancel it and create another.

FieldTypeMeaning
line_itemsarray of objectWhat is bought: up to 20 of your products. One subscription at most, the first line, with only its own add-ons after it; its one-time add-ons are charged with the first payment only. Or send amount and currency instead.
line_items[].productrequiredstringA product's ID (prod_…): its stored title and price are used.
line_items[].quantityinteger1 to 99. A subscription renews at this quantity for its life.
amountintegerA custom amount in the currency's smallest unit, instead of line_items. Secret key only. A one-time payment, never offered to a merchant of record, which sells only products: use line_items for those.
currencystringWith amount: a three-letter currency code.
descriptionstringWith amount: what the buyer is paying for, on the invoice.
customerrequiredobjectThe buyer: their email gets the invoice and receipt.
customer.emailrequiredstring
customer.namestring
customer.addressobject
customer.address.line1requiredstring
customer.address.line2string
customer.address.cityrequiredstring
customer.address.regionstring
customer.address.postal_codestring
customer.address.countryrequiredstring
customer.tax_numberstring
customer.countrystringWhere the buyer is, for routing and tax, when no address is given.
return_urlrequiredstringWhere the provider sends the buyer after paying; ShipBill adds ?payment_intent=pi_….
discountsarray of objectA discount to apply, fixed: the buyer can't remove it. A code that doesn't apply fails the request with coupon_not_applicable.
discounts[].couponrequiredstringA coupon's code, such as SAVE20, or its ID (cpn_…).
referencestringYour own ID for the purchase or the buyer, such as an order number or user ID. Returned on every event.
metadatamap of stringsUp to 50 of your own key/value pairs, returned with the object and its events.
expires_inintegerSeconds until it expires unpaid: 1800 to 86400, 86400 by default.

Returns PaymentIntent.

Retrieve a payment intent

GET /v1/payment-intents/{id}

A payment still under way is checked with its provider when you read it.

Returns PaymentIntent.

Confirm a payment intent

POST /v1/payment-intents/{id}/confirm

Starts the payment with the provider ShipBill routes the method to, and answers with next_action: send the buyer to its url, or mount the provider's secure fields; ShipBill.mount(next_action, element) in shipbill.js does either. After a failure, confirm it again.

FieldTypeMeaning
payment_method_typerequiredone of "card", "wallet", "bank_transfer", "qris", "ewallet", "retail", "paylater", "bank", "crypto"One of the intent's payment_methods.

Returns PaymentIntent.

Cancel a payment intent

POST /v1/payment-intents/{id}/cancel

One nobody is paying: its order is cancelled and its invoice voided. Paid, or being paid, it can't be.

Returns PaymentIntent.

Payments

List payments

GET /v1/payments

FieldTypeMeaning
limitintegerHow many per page: 1 to 100, 10 by default.
starting_afterstringThe last ID of the previous page, for the next one.
created_afterintegerUnix seconds: only what was created after this, for catching up.
statusone of "requires_payment_method", "requires_action", "processing", "authorized", "underpaid", "succeeded", "failed", "cancelled"Only those in this status.
referencestringOnly those with this reference of yours.
customer_emailstringOnly this customer's.
productstringOnly payments that included this product (prod_…).

Returns a list: { object: "list", data, has_more }, with data an array of Payment.

Retrieve a payment

GET /v1/payments/{id}

Authoritative, whatever arrived by webhook.

Returns Payment.

Record a refund

POST /v1/payments/{id}/mark-refunded

Records a refund you made at your provider, in full or in part. ShipBill never sends money. Refunds the provider reports are recorded on their own; check a payment's refunds first so one isn't recorded twice.

FieldTypeMeaning
amountrequiredintegerIn the payment's currency's smallest unit; at most what hasn't been refunded yet.
noterequiredstringWhat was refunded and how, for your records.

Returns Refund.

Refunds

List refunds

GET /v1/refunds

FieldTypeMeaning
limitintegerHow many per page: 1 to 100, 10 by default.
starting_afterstringThe last ID of the previous page, for the next one.
created_afterintegerUnix seconds: only what was created after this, for catching up.
paymentstringOnly this payment's refunds (pay_…).

Returns a list: { object: "list", data, has_more }, with data an array of Refund.

Retrieve a refund

GET /v1/refunds/{id}

Returns Refund.

Invoices

Export invoices for your accountant

GET /v1/invoices/export

Every invoice and credit note issued from from to to (in your profile's timezone), as a ZIP of their PDFs with an index.csv, or the CSV alone. Made in the background: until the file is ready the answer is 409 invoice_export_pending with Retry-After, so call again. The same request within an hour gets the same file. A closed month's ZIP is the one kept when it was closed. A range with nothing issued in it answers 409 nothing_to_export.

FieldTypeMeaning
fromstringThe first day, in your profile's timezone: 2026-09-01.
tostringThe last day, included: 2026-09-30.
formatone of "zip", "csv"zip: every invoice's and credit note's PDF, with index.csv. csv: the index alone.

List invoices

GET /v1/invoices

FieldTypeMeaning
limitintegerHow many per page: 1 to 100, 10 by default.
starting_afterstringThe last ID of the previous page, for the next one.
created_afterintegerUnix seconds: only what was created after this, for catching up.
statusone of "open", "paid", "partially_paid", "void", "expired", "refunded"Only those in this status.
referencestringOnly those with this reference of yours.
customer_emailstringOnly this customer's.

Returns a list: { object: "list", data, has_more }, with data an array of Invoice.

Retrieve an invoice

GET /v1/invoices/{id}

Returns Invoice.

Download an invoice's PDF

GET /v1/invoices/{id}/pdf

Drawn when the invoice is paid or changes, and otherwise on the first request; the answer is 409 invoice_pdf_pending only while a paid or refunded invoice's draw is still running.

Returns the PDF's bytes.

Void an open invoice

POST /v1/invoices/{id}/void

It can no longer be paid, and its checkout closes. A paid or expired invoice can't be voided.

Returns Invoice.

Credit notes

List credit notes

GET /v1/credit-notes

Credit notes for refunds, newest first: one for each refund of an invoiced payment, with its own number and PDF, against the invoice it credits.

FieldTypeMeaning
limitintegerHow many per page: 1 to 100, 10 by default.
starting_afterstringThe last ID of the previous page, for the next one.
created_afterintegerUnix seconds: only what was created after this, for catching up.
invoicestringOnly this invoice's credit notes (inv_…).

Returns a list: { object: "list", data, has_more }, with data an array of CreditNote.

Retrieve a credit note

GET /v1/credit-notes/{id}

Returns CreditNote.

Customers

List customers

GET /v1/customers

FieldTypeMeaning
limitintegerHow many per page: 1 to 100, 10 by default.
starting_afterstringThe last ID of the previous page, for the next one.
created_afterintegerUnix seconds: only what was created after this, for catching up.
emailstringOnly the customer with this email.

Returns a list: { object: "list", data, has_more }, with data an array of Customer.

Retrieve a customer

GET /v1/customers/{id}

Returns Customer.

Erase a customer

DELETE /v1/customers/{id}

At the buyer's request: their email, name, address, and tax number become placeholders on the customer and on every copy ShipBill keeps (checkouts, sent mail, visits, risk notes, and your events), mail still waiting to them is dropped, and subscriptions ShipBill runs for them end without an email. Their payments, refunds, invoices, and credit notes stay as issued, as tax law requires you to keep them. Refused with customer_has_provider_subscriptions while a provider still charges them on its own: cancel it there first. Erasing again changes nothing; nobody can undo it. A provider that kept its own record of the buyer is erased there.

Returns Customer.

Open the customer's billing portal

POST /v1/customers/{id}/portal-session

For a Manage billing button on your site, from your server: the provider's portal for a subscription it renews automatically (change the card, cancel at the period end, its invoices), or ShipBill's own subscription page for one renewed by reminder. The provider's address is short-lived: redirect the customer to it at once.

FieldTypeMeaning
return_urlrequiredstringWhere the customer comes back to when done.

Returns PortalSession.

Subscriptions

List subscriptions

GET /v1/subscriptions

FieldTypeMeaning
limitintegerHow many per page: 1 to 100, 10 by default.
starting_afterstringThe last ID of the previous page, for the next one.
created_afterintegerUnix seconds: only what was created after this, for catching up.
statusone of "active", "past_due", "expired", "cancelled"Only those in this status.
productstringOnly this product's (prod_…).
customer_emailstringOnly this customer's.
referencestringOnly those with this reference of yours.

Returns a list: { object: "list", data, has_more }, with data an array of Subscription.

Add an existing subscriber

POST /v1/subscriptions

No payment is taken: active until paid_until, then reminded and renewed like any other. The customer is emailed that it is managed here now. subscription.created carries imported: true.

FieldTypeMeaning
customer_emailrequiredstringThe subscriber's email. They're told once that it's managed here now.
productrequiredstringAn active subscription product (prod_…).
paid_untilrequiredintegerUnix seconds: the end of the period they've already paid for, within one period from now.
referencestringYour own ID for the purchase or the buyer, such as an order number or user ID. Returned on every event.

Returns Subscription.

Retrieve a subscription

GET /v1/subscriptions/{id}

Authoritative for access: refuse access after access_until even if a webhook was missed.

Returns Subscription.

Cancel a subscription

POST /v1/subscriptions/{id}/cancel

Reminders stop; access lasts until the period ends. The customer is told.

Returns Subscription.

End a subscription's discount

DELETE /v1/subscriptions/{id}/discount

From its next renewal it's at the full price; payments already made keep their discount, and the coupon stays available to everyone else. The subscriber is told, and subscription.updated carries discount.ended_at with ended_reason: "ended_by_merchant". Refused with no_discount when it has none to end, and with discount_not_endable at Creem or Whop, which can't end one.

Returns Subscription.

Drop or add a recurring add-on

POST /v1/subscriptions/{id}/addons/{product}

product is one of the subscription's product's recurring add-ons (prod_…). renews: false stops it at the end of this period, renews: true adds it from the next renewal at its price now; either undoes the other while it's still ahead. Nothing is charged or refunded at the change, and the subscriber is told. items[].ends_at and starts_at show it, and subscription.updated is sent. Refused with addon_not_changeable when the subscription isn't running, is set to end, or the product isn't one of its recurring add-ons.

FieldTypeMeaning
renewsrequiredbooleantrue: it renews from the next renewal, added at its price now (or a drop undone). false: it stops at the end of this period (or an addition undone). Nothing is charged or refunded at the change.

Returns Subscription.

Open a checkout for the next period

POST /v1/subscriptions/{id}/renewal-session

For a Renew button on your site: renews an active or past-due subscription from its period end, or restarts an ended one from the payment date at the current price.

Returns RenewalSession.

Products

List products

GET /v1/products

FieldTypeMeaning
limitintegerHow many per page: 1 to 100, 10 by default.
starting_afterstringThe last ID of the previous page, for the next one.
created_afterintegerUnix seconds: only what was created after this, for catching up.
statusone of "active", "archived"Only those in this status.
categorystring

Returns a list: { object: "list", data, has_more }, with data an array of Product.

Create a product

POST /v1/products

Products are shared by test and live mode.

FieldTypeMeaning
titlerequiredstring
descriptionstring or null
price_amountrequiredintegerThe price in the currency's smallest unit: 4900 is $49.00.
currencystringA three-letter code; the profile's currency by default.
pricesarray of objectFixed prices in other currencies, such as [{ currency: "EUR", amount: 4500 }]: a buyer in that currency pays exactly that. One per currency, never the product's own. On an update, the whole list; omit it to leave them as they are.
prices[].currencyrequiredstring
prices[].amountrequiredinteger
categorystring or nullA category's ID (cat_…), or null.
providers"all" or array of string"all" connected providers (the default), or only these, such as ["oxapay"].
after_payment_messagestring or nullShown to the buyer after paying, and in their receipt.
after_payment_urlstring or nullA link offered to the buyer after paying, such as a download. A convenience, not access control.
metadatamap of stringsUp to 50 of your own key/value pairs, returned with the object and its events.
addonsarray of objectUp to 19 add-ons, other products in this product's currency, none with add-ons of its own. A payment link picks which it includes. A subscription's one-time add-ons are charged with its first payment only; its recurring add-ons, subscription products with its interval, renew with it. On an update, the whole list; omit it to leave them as they are.
addons[].productrequiredstringA product's ID (prod_…), in this product's currency: a one-time product, or, on a subscription, a subscription renewing as it does (a recurring add-on).
addons[].quantityintegerIts quantity by default: 1 to 99.
addons[].offeredbooleanOffer at the checkout: a box the buyer may tick, on a buy button that sends no selection of its own and on a session made with offer_addons.
buyer_quantityobject or nullLets the buyer choose how many, between min and max, on a payment link's or buy button's checkout. A subscription renews at the quantity chosen. null turns it off.
typeone of "one_time", "subscription"one_time (the default), or subscription: paid again every interval_count intervals. Fixed once created.
intervalone of "day", "week", "month", "year"A subscription's period.
interval_countintegerHow many intervals each period lasts; 1 by default.
renewal_remindersbooleanFalse for a fixed term: no reminders while it runs, and one notice when it ends.
renewal_modeone of "reminder", "automatic", "automatic_or_reminder"A subscription's renewal: reminder (the default), automatic (sold only by providers with their own subscription engine), or automatic_or_reminder.

Returns Product.

Retrieve a product

GET /v1/products/{id}

Returns Product.

Update a product

PATCH /v1/products/{id}

Changes apply to new checkouts; open ones keep their price. status archives or restores it.

FieldTypeMeaning
titlestring
descriptionstring or null
price_amountintegerThe price in the currency's smallest unit: 4900 is $49.00.
currencystringA three-letter code; the profile's currency by default.
pricesarray of objectFixed prices in other currencies, such as [{ currency: "EUR", amount: 4500 }]: a buyer in that currency pays exactly that. One per currency, never the product's own. On an update, the whole list; omit it to leave them as they are.
prices[].currencyrequiredstring
prices[].amountrequiredinteger
categorystring or nullA category's ID (cat_…), or null.
providers"all" or array of string"all" connected providers (the default), or only these, such as ["oxapay"].
after_payment_messagestring or nullShown to the buyer after paying, and in their receipt.
after_payment_urlstring or nullA link offered to the buyer after paying, such as a download. A convenience, not access control.
metadatamap of stringsUp to 50 of your own key/value pairs, returned with the object and its events.
addonsarray of objectUp to 19 add-ons, other products in this product's currency, none with add-ons of its own. A payment link picks which it includes. A subscription's one-time add-ons are charged with its first payment only; its recurring add-ons, subscription products with its interval, renew with it. On an update, the whole list; omit it to leave them as they are.
addons[].productrequiredstringA product's ID (prod_…), in this product's currency: a one-time product, or, on a subscription, a subscription renewing as it does (a recurring add-on).
addons[].quantityintegerIts quantity by default: 1 to 99.
addons[].offeredbooleanOffer at the checkout: a box the buyer may tick, on a buy button that sends no selection of its own and on a session made with offer_addons.
buyer_quantityobject or nullLets the buyer choose how many, between min and max, on a payment link's or buy button's checkout. A subscription renews at the quantity chosen. null turns it off.
intervalone of "day", "week", "month", "year"A subscription's period.
interval_countintegerHow many intervals each period lasts; 1 by default.
renewal_remindersbooleanFalse for a fixed term: no reminders while it runs, and one notice when it ends.
renewal_modeone of "reminder", "automatic", "automatic_or_reminder"A subscription's renewal: reminder (the default), automatic (sold only by providers with their own subscription engine), or automatic_or_reminder.
statusone of "active", "archived"archived stops it selling; active restores it.

Returns Product.

Delete a product

DELETE /v1/products/{id}

It stops selling and leaves your lists; past payments and invoices keep what was sold.

Returns { id, object, deleted: true }.

Product categories

List product categories

GET /v1/product-categories

FieldTypeMeaning
limitintegerHow many per page: 1 to 100, 10 by default.
starting_afterstringThe last ID of the previous page, for the next one.

Returns a list: { object: "list", data, has_more }, with data an array of ProductCategory.

Create a product category

POST /v1/product-categories

FieldTypeMeaning
namerequiredstring
descriptionstring or null

Returns ProductCategory.

Update a product category

PATCH /v1/product-categories/{id}

FieldTypeMeaning
namestring
descriptionstring or null

Returns ProductCategory.

Delete a product category

DELETE /v1/product-categories/{id}

Its products stay, without a category.

Returns { id, object, deleted: true }.

Coupons

List coupons

GET /v1/coupons

FieldTypeMeaning
limitintegerHow many per page: 1 to 100, 10 by default.
starting_afterstringThe last ID of the previous page, for the next one.
created_afterintegerUnix seconds: only what was created after this, for catching up.
archivedone of "true", "false"Archived coupons instead of the live ones.

Returns a list: { object: "list", data, has_more }, with data an array of Coupon.

Create a coupon

POST /v1/coupons

A discount code for the key's mode. Buyers type it on the checkout; a payment link, a buy button, or a checkout session can preset it. ShipBill prices and counts it the same on every provider.

FieldTypeMeaning
coderequiredstringWhat buyers type, 3 to 32 letters, digits, or hyphens; matched without case. It can't change.
namerequiredstringYour name for it, shown on invoices; buyers type the code.
kindrequiredone of "percent", "fixed"
percent_bpinteger or nullPercent off in basis points: 1550 is 15.5%.
amountsarray of objectA fixed coupon's amount off in each currency it applies to; never converted.
amounts[].currencyrequiredstring
amounts[].amountrequiredinteger
minimum_subtotalsarray of objectThe smallest order, before the discount, per currency.
minimum_subtotals[].currencyrequiredstring
minimum_subtotals[].amountrequiredinteger
durationone of "once", "repeating", "forever"For subscriptions: the first payment, duration_periods payments, or every payment.
duration_periodsinteger or null
applies_toone of "all", "products"
productsarray of stringWith applies_to products: the products (prod_…).
max_redemptionsinteger or null
max_per_customerinteger or null
first_purchase_onlyboolean
starts_atinteger or nullUnix seconds: it can't be used before.
ends_atinteger or nullUnix seconds: it can't be used after.

Returns Coupon.

Retrieve a coupon

GET /v1/coupons/{id}

Returns Coupon.

Update a coupon

PATCH /v1/coupons/{id}

Everything but the code may change. Subscriptions already using it keep their current discount.

FieldTypeMeaning
namestringYour name for it, shown on invoices; buyers type the code.
kindone of "percent", "fixed"
percent_bpinteger or nullPercent off in basis points: 1550 is 15.5%.
amountsarray of objectA fixed coupon's amount off in each currency it applies to; never converted.
amounts[].currencyrequiredstring
amounts[].amountrequiredinteger
minimum_subtotalsarray of objectThe smallest order, before the discount, per currency.
minimum_subtotals[].currencyrequiredstring
minimum_subtotals[].amountrequiredinteger
durationone of "once", "repeating", "forever"For subscriptions: the first payment, duration_periods payments, or every payment.
duration_periodsinteger or null
applies_toone of "all", "products"
productsarray of stringWith applies_to products: the products (prod_…).
max_redemptionsinteger or null
max_per_customerinteger or null
first_purchase_onlyboolean
starts_atinteger or nullUnix seconds: it can't be used before.
ends_atinteger or nullUnix seconds: it can't be used after.

Returns Coupon.

Archive a coupon

POST /v1/coupons/{id}/archive

Nothing new may use it; subscriptions already carrying it keep it.

Returns Coupon.

List a coupon's uses

GET /v1/coupons/{id}/redemptions

Who used it, on which order: reserved while a checkout is open, redeemed once paid. Newest first.

FieldTypeMeaning
limitintegerHow many per page: 1 to 100, 10 by default.
starting_afterstringThe last ID of the previous page, for the next one.
created_afterintegerUnix seconds: only what was created after this, for catching up.

Returns a list: { object: "list", data, has_more }, with data an array of CouponRedemption.

Webhook endpoints

List webhook endpoints

GET /v1/webhook-endpoints

Returns a list: { object: "list", data, has_more }, with data an array of WebhookEndpoint.

Create a webhook endpoint

POST /v1/webhook-endpoints

Up to ten per mode, each with its own events and signing secret. The secret is in this answer only. The owner is emailed when an address is set.

FieldTypeMeaning
urlrequiredstringA public https address on port 443.
descriptionstring or nullYour own name for it.
enabled_eventsarray of "*" or one of "checkout.created", "checkout.expired", "payment.created", "payment.processing", "payment.requires_action", "payment.authorized", "payment.succeeded", "payment.failed", "payment.cancelled", "payment.refunded", "payment.disputed", "payment.risk_cleared", "invoice.created", "invoice.paid", "invoice.expired", "subscription.created", "subscription.renewal_upcoming", "subscription.renewed", "subscription.reactivated", "subscription.past_due", "subscription.expired", "subscription.cancelled", "subscription.updated", "payout.created", "payout.completed", "payout.failed"The event types to send, or ["*"] for all (the default).

Returns WebhookEndpoint.

Update a webhook endpoint

PATCH /v1/webhook-endpoints/{id}

status: "enabled" also restarts an endpoint disabled after three days of failures.

FieldTypeMeaning
urlstringA public https address on port 443.
descriptionstring or nullYour own name for it.
enabled_eventsarray of "*" or one of "checkout.created", "checkout.expired", "payment.created", "payment.processing", "payment.requires_action", "payment.authorized", "payment.succeeded", "payment.failed", "payment.cancelled", "payment.refunded", "payment.disputed", "payment.risk_cleared", "invoice.created", "invoice.paid", "invoice.expired", "subscription.created", "subscription.renewal_upcoming", "subscription.renewed", "subscription.reactivated", "subscription.past_due", "subscription.expired", "subscription.cancelled", "subscription.updated", "payout.created", "payout.completed", "payout.failed"The event types to send, or ["*"] for all (the default).
statusone of "enabled", "disabled"enabled also restarts an endpoint disabled after three days of failures.

Returns WebhookEndpoint.

Delete a webhook endpoint

DELETE /v1/webhook-endpoints/{id}

Nothing more is sent to it. Its past deliveries stay in the dashboard's log.

Returns { id, object, deleted: true }.

Events

List events

GET /v1/events

Every event exactly as webhooks deliver it, for the last 30 days: older ones are deleted. Read from created_after to catch up after downtime; skip the IDs you have already handled.

FieldTypeMeaning
limitintegerHow many per page: 1 to 100, 10 by default.
starting_afterstringThe last ID of the previous page, for the next one.
created_afterintegerUnix seconds: only what was created after this, for catching up.
typestring

Returns a list: { object: "list", data, has_more }, with data an array of Event.

Retrieve an event

GET /v1/events/{id}

Returns Event.

Test helpers

Move a test subscription through time

POST /v1/test/subscriptions/{id}/advance

Test-mode keys only: the next reminder now, the due date now, or past the grace period.

FieldTypeMeaning
torequiredone of "next_reminder", "due_date", "past_grace"next_reminder sends it now; due_date makes it past due; past_grace expires it.

Returns Subscription.

In the browser

What shipbill.js calls from your pages, with the publishable key. Only from your allowed websites; a secret key is refused here.

Open a buy button's checkout

POST /v1/embed/checkout/sessions · publishable key, from an allowed website

From the browser, with the publishable key, on one of the profile's allowed websites (the request's Origin). An active product at its stored price; never an amount. Open the result with shipbill.js.

FieldTypeMeaning
productrequiredstringAn active product's ID (prod_…), at its stored price.
quantityinteger1 by default. A subscription renews at this quantity.
addonsarray of objectYour page's own choice of the product's add-ons, each at its quantity; the checkout then offers none. Omitted: it offers the add-ons the product offers at the checkout.
addons[].productrequiredstringOne of the product's add-ons (prod_…).
addons[].quantityinteger1 to 99.
customer_emailstringFills in the buyer's email; they can still change it.
referencestringYour ID for the buyer, from the page. A buyer can edit it; set it from your server when it must be certain.
couponstringA discount code to apply when it opens; the buyer can remove it.
pagestringThe page the button is on, to come back to.
referrerstringThe site that sent the buyer to this page, its origin and path; empty when there was none.

Returns EmbedSession.

Preview prices for a pricing page

GET /v1/embed/prices · publishable key, from an allowed website

What the checkout would show this visitor, as display strings. A preview: the amount charged is fixed when the checkout opens.

FieldTypeMeaning
productsstringUp to 20 product IDs (prod_…), separated by commas.

Returns a list: { object: "list", data, has_more }, with data an array of PricePreview.

Before framing a checkout

What shipbill.js asks before it shows a checkout opened by its client_token over your page, so a website that isn't allowed is told at once. No key: the client_token names the checkout.

Check a page may open a checkout

GET /v1/embed-frames/{token} · no key: the checkout's client_token

Asked by shipbill.js before it opens a checkout with its client_token, from the page that will show it (the request's Origin). No key: the token names the checkout. 204 when the page is one of the profile's allowed websites for the checkout's mode; otherwise origin_not_allowed, and the message says why. You don't call this yourself.

Returns nothing, with status 204.

Objects

CheckoutSession

FieldTypeMeaning
idID (cs_…)
object"checkout.session"
livemodeboolean
statusone of "open", "processing", "complete", "expired", "cancelled"
payment_statusone of "paid", "underpaid", "unpaid"
amountintegerIn the currency's smallest unit, such as cents.
amount_taxintegerThe merchant's own tax for the buyer's country: added to amount where prices don't include it, inside it where they do; 0 without tax. A merchant of record's method adds its own instead.
currencystring
line_itemsarray of LineItem
discountobject or null
referencestring or null
metadatamap of strings
customerID (cus_…) or null
customer_emailstring or null
paymentID (pay_…) or null
payment_linkID (plink_…) or null
success_urlstring or null
cancel_urlstring or null
expires_atinteger
completed_atinteger or null
createdinteger

CheckoutSessionCreated

FieldTypeMeaning
idID (cs_…)
object"checkout.session"
livemodeboolean
statusone of "open", "processing", "complete", "expired", "cancelled"
payment_statusone of "paid", "underpaid", "unpaid"
amountintegerIn the currency's smallest unit, such as cents.
amount_taxintegerThe merchant's own tax for the buyer's country: added to amount where prices don't include it, inside it where they do; 0 without tax. A merchant of record's method adds its own instead.
currencystring
line_itemsarray of LineItem
discountobject or null
referencestring or null
metadatamap of strings
customerID (cus_…) or null
customer_emailstring or null
paymentID (pay_…) or null
payment_linkID (plink_…) or null
success_urlstring or null
cancel_urlstring or null
expires_atinteger
completed_atinteger or null
createdinteger
client_tokenstringOpens this checkout in the embedded modal (shipbill.js).
urlstringThe hosted checkout page to send the buyer to.

LineItem

FieldTypeMeaning
productID (prod_…) or nullNull for a custom amount.
typeone of "one_time", "subscription"
titlestring
quantityinteger
unit_amountintegerIn the currency's smallest unit, such as cents.
amountintegerThe line's price, before any discount.
discount_amountintegerA coupon's share of the line; 0 without one.

PaymentIntent

FieldTypeMeaning
idID (pi_…)
object"payment_intent"
livemodeboolean
statusone of "requires_payment_method", "requires_action", "processing", "succeeded", "expired", "cancelled"requires_payment_method: confirm it with a method (again, after a failure); requires_action: send the buyer to next_action; processing: the provider is confirming it; succeeded: paid.
amountintegerThe price after any discount, before tax added at checkout.
amount_taxintegerThe merchant's own tax for the buyer: added to amount, or inside it.
currencystring
line_itemsarray of LineItem
discountobject or null
payment_methodsarray of objectThe methods it can be confirmed with, while it needs one.
payment_methods[].typestring
payment_methods[].labelstringThe method's name for the buyer, as the dashboard shows it: "Card", "Bank transfer", "QRIS".
payment_methods[].amountintegerWhat this method charges, the tax included where it's added.
payment_methods[].currencystring
payment_methods[].merchant_of_recordstring or nullA merchant of record sells it: it adds its own tax on its page.
next_actionobject or object or nullWhere the buyer pays: the provider's page, or its secure fields to mount (shipbill.js: ShipBill.mount(next_action, element)). A client_component comes only in the confirm response.
last_payment_errorobject or nullWhy the last attempt failed, in words for the buyer.
customerID (cus_…)
customer_emailstring
paymentID (pay_…) or null
invoiceID (inv_…) or null
return_urlstring
referencestring or null
metadatamap of strings
expires_atinteger
createdinteger

Payment

FieldTypeMeaning
idID (pay_…)
object"payment"
livemodeboolean
statusone of "requires_payment_method", "requires_action", "processing", "authorized", "underpaid", "succeeded", "failed", "cancelled"
amountintegerIn the currency's smallest unit, such as cents.
currencystring
base_amountintegerThe amount in the profile's base currency.
base_currencystring
price_sourceone of "fixed", "converted"fixed: the product's fixed price in the charged currency, charged exactly, with base_amount converted at that day's rate for reports; converted: the merchant's price, converted or not.
amount_refundedintegerIn the currency's smallest unit, such as cents.
manualbooleanRecorded by the merchant (Mark as paid), not taken through a provider.
originone of "checkout", "external"external: a payment taken at the provider without ShipBill, such as on the merchant's own site, recorded only to give it an invoice. No webhook event is sent for it, and it has no product, so never grant access on it.
method_typestring or null
providerstring or null
failure_codestring or null
orderID (ord_…)
referencestring or nullThe merchant's own ID, given when the checkout was created.
metadatamap of strings
line_itemsarray of LineItem
discountobject or null
checkout_sessionID (cs_…) or null
payment_intentID (pi_…) or nullThe payment intent it was made through, for a custom checkout.
customerID (cus_…) or null
invoiceID (inv_…) or null
createdinteger
succeeded_atinteger or null
accessone of "lifetime", "period"
access_untilinteger or null
subscriptionID (sub_…) or null
risk_statusone of "clear", "flagged", "cleared_by_merchant", "refunded_for_risk"flagged: your fraud rules hold delivery until you clear it (then payment.risk_cleared). refunded_for_risk: refunded after being flagged.
risk_notesarray of objectFraud signals on the payment or its checkout. A signal is not proof: ShipBill never refuses a buyer or refunds because of one.
risk_notes[].signalone of "disposable_email", "elevated_risk", "early_fraud_warning", "card_country_mismatch", "velocity", "duplicate_payment", "repeat_offender", "subscription_domino"
risk_notes[].evidencemap of stringsWhat was seen: a domain, a country, a count. Never a card number or an email address.
risk_notes[].createdinteger
refundobjectpayment.refunded: the refund this event records.
refund.idID (re_…)
refund.amountintegerIn the currency's smallest unit, such as cents.
refund.currencystring
refund.sourceone of "provider", "manual"
disputeobjectpayment.disputed: the dispute this event records.
dispute.amountintegerIn the currency's smallest unit, such as cents.
dispute.currencystring
dispute.reasonstring or null
declinedtruepayment.failed: the merchant declined an underpayment.
reversedtruepayment.cancelled: the merchant reversed a manual payment.

Refund

FieldTypeMeaning
idID (re_…)
object"refund"
livemodeboolean
paymentID (pay_…)
amountintegerIn the currency's smallest unit, such as cents.
currencystring
statusone of "pending", "succeeded", "failed"A refund counts once it has succeeded; one recorded by hand has.
sourceone of "provider", "manual"Reported by the provider, or recorded by you.
notestring or nullWhat you wrote when recording it by hand.
createdinteger
completed_atinteger or null

Invoice

FieldTypeMeaning
idID (inv_…)
object"invoice"
livemodeboolean
numberstring
statusone of "open", "paid", "partially_paid", "void", "expired", "refunded"
currencystring
amount_dueintegerIn the currency's smallest unit, such as cents.
amount_taxintegerThe merchant's own tax in amount_due: added to the lines, or inside them where prices include it; 0 without tax.
amount_paidintegerIn the currency's smallest unit, such as cents.
amount_refundedintegerReturned to the buyer since; refunded once it is all of it.
customerID (cus_…) or null
customer_emailstring
customer_namestring or null
linesarray of object
lines[].productID (prod_…) or null
lines[].titlestring
lines[].quantityinteger
lines[].unit_amountintegerIn the currency's smallest unit, such as cents.
lines[].amountintegerIn the currency's smallest unit, such as cents.
lines[].discount_amountintegerA coupon's share of the line; 0 without one.
discountobject or null
orderID (ord_…)
referencestring or null
paymentID (pay_…) or null
hosted_urlstringThe buyer's page for this invoice, with its PDF.
revisioninteger1 as issued. Each correction the buyer makes to their own details (name, company, address, tax number, reference) adds one; the number and amounts never change.
issued_atinteger
paid_atinteger or null
createdinteger

CreditNote

FieldTypeMeaning
idID (cn_…)
object"credit_note"
livemodeboolean
numberstringIts own sequence: CN-2026-00012.
invoiceID (inv_…)
invoice_numberstring
refundID (re_…)The refund it records; one credit note per refund.
paymentID (pay_…)
customerID (cus_…) or null
customer_emailstring
currencystringThe invoice's currency.
amountintegerWhat is credited, as a positive amount in the invoice's currency.
linesarray of object
lines[].titlestring
lines[].quantityinteger
lines[].unit_amountintegerIn the currency's smallest unit, such as cents.
lines[].amountintegerIn the currency's smallest unit, such as cents.
refund_amountintegerWhat went back to the buyer, in the currency they paid in.
refund_currencystring
notestring or nullYour note on the refund. Never shown to the buyer or printed.
hosted_urlstringThe invoice's page, which lists its credit notes with their PDFs.
issued_atinteger
createdinteger

Customer

FieldTypeMeaning
idID (cus_…)
object"customer"
livemodeboolean
erasedbooleanErased at the buyer's request (DELETE /v1/customers/{id}): their email, name, address, and tax number are placeholders here and on every copy ShipBill keeps. Their payments and invoices stay as issued.
emailstring
namestring or null
countrystring or null
addressobject or null
tax_numberstring or null
tax_number_countrystring or null
tax_number_statusone of "verified", "unverified", "pending", "invalid" or nullverified: confirmed by the country's register (VIES, HMRC, the ABR); unverified: right format, no register to ask; pending: the register was down, asked again shortly; invalid: the register has no record of it.
external_refstring or nullYour own ID for this customer: the reference of the first checkout your server created for them. Unique in a mode.
createdinteger

PortalSession

FieldTypeMeaning
object"portal_session"
urlstring
providerstringThe provider whose portal it is (polar), or "shipbill" for ShipBill's own subscription page.
subscriptionID (sub_…)
expires_atinteger or nullWhen the address stops working; null for ShipBill's own page.

Subscription

FieldTypeMeaning
idID (sub_…)
object"subscription"
livemodeboolean
statusone of "active", "past_due", "expired", "cancelled"
productID (prod_…)
referencestring or null
metadatamap of strings
customerID (cus_…)
customer_emailstring
amountintegerThe price locked when it started, before any discount: its items' total each period. Released if it lapses.
currencystring
itemsarray of objectWhat renews each period: the product first, then any recurring add-ons. One-time add-ons were charged with the first payment only, so they aren't here.
items[].productID (prod_…)
items[].quantityinteger
items[].unit_amountintegerLocked when it started.
items[].amountintegerunit_amount × quantity, each period, before any discount.
items[].starts_atinteger or nullA recurring add-on added to it: the start of the first period it renews in. Null: from the start.
items[].ends_atinteger or nullA recurring add-on dropped from it: the end of the last period it renews in. Null: it goes on renewing.
discountobject or nullThe coupon it was bought with, which discounts its renewals for its periods while the coupon is available: archived, used up, or past its end date, it stops from the next renewal, and never comes back.
intervalone of "day", "week", "month", "year"
interval_countinteger
renewal_remindersboolean
current_period_startinteger
current_period_endinteger
access"period"
access_untilintegerThe end of the paid period: refuse access after it, even if a webhook is missed.
grace_untilinteger or nullPast due: when it expires if still unpaid.
cancel_at_period_endboolean
cancelled_atinteger or null
cancelled_byone of "customer", "merchant", "replaced", "product_deleted" or null
replaced_byID (sub_…) or null
importedbooleanAdded by the merchant, not bought through ShipBill.
renewal_modeone of "reminder", "automatic"reminder: the customer pays each period through a link. automatic: provider charges each period itself; the customer manages it in the provider's portal.
providerstring or nullAutomatic renewal: the provider whose subscription charges it (polar).
pausedbooleanThe merchant's account is locked: nothing is sent and nothing expires.
manage_urlstringThe customer's own page: renew, see receipts, cancel, or Manage billing at the provider.
paymentID (pay_…) or nullThe latest payment for it.
invoiceobject or nullThe latest invoice paid for it.
createdinteger

RenewalSession

FieldTypeMeaning
object"checkout.renewal_session"
subscriptionID (sub_…)
client_tokenstring
urlstring
expires_atinteger

Product

FieldTypeMeaning
idID (prod_…)
object"product"
titlestring
descriptionstring or null
price_amountintegerIn the currency's smallest unit, such as cents.
currencystring
pricesarray of objectFixed prices in other currencies: charged exactly, in place of a converted price.
prices[].currencystring
prices[].amountintegerIn the currency's smallest unit, such as cents.
typeone of "one_time", "subscription"
intervalone of "day", "week", "month", "year" or nullSubscriptions only.
interval_countinteger or null
renewal_remindersboolean or nullSubscriptions only: off for a fixed term.
renewal_modeone of "reminder", "automatic", "automatic_or_reminder" or nullSubscriptions only: reminder (the customer pays each period through a link), automatic (a provider with its own subscription engine charges each period; only such providers sell it), or automatic_or_reminder (automatic where the chosen provider supports it).
imagestring or null
categoryID (cat_…) or null
providers"all" or array of string"all" connected providers, or only these, by provider ("oxapay").
after_payment_messagestring or null
after_payment_urlstring or null
statusone of "active", "archived"
metadatamap of strings
addonsarray of objectOther products sold with it, each with its quantity by default: one-time, or on a subscription, recurring.
addons[].productID (prod_…)
addons[].quantityinteger
addons[].offeredbooleanOffered at the checkout: a box the buyer may tick, on a buy button and with offer_addons.
buyer_quantityobject or nullThe range a buyer may choose from on a link's or buy button's checkout; null: off.
createdinteger
updatedinteger

ProductCategory

FieldTypeMeaning
idID (cat_…)
object"product_category"
namestring
descriptionstring or null
createdinteger

Coupon

FieldTypeMeaning
idID (cpn_…)
object"coupon"
livemodeboolean
codestring
namestring
kindone of "percent", "fixed"
percent_bpinteger or null
amountsarray of object
amounts[].currencystring
amounts[].amountintegerIn the currency's smallest unit, such as cents.
minimum_subtotalsarray of object
minimum_subtotals[].currencystring
minimum_subtotals[].amountintegerIn the currency's smallest unit, such as cents.
durationone of "once", "repeating", "forever"
duration_periodsinteger or null
applies_toone of "all", "products"
productsarray of ID (prod_…)
max_redemptionsinteger or null
max_per_customerinteger or null
first_purchase_onlyboolean
starts_atinteger or null
ends_atinteger or null
redemptions_countintegerKept uses: a full refund gives one back.
archived_atinteger or null
createdinteger

CouponRedemption

FieldTypeMeaning
idID (cpnr_…)
object"coupon_redemption"
couponID (cpn_…)
statusone of "reserved", "redeemed", "released"
orderID (ord_…)
customerID (cus_…) or null
customer_emailstring or null
amountintegerIn the currency's smallest unit, such as cents.
currencystring
redeemed_atinteger or null
createdinteger

PaymentLinkCreated

FieldTypeMeaning
idID (plink_…)
object"payment_link"
livemodeboolean
urlstring
labelstring or null
statusone of "active", "disabled", "paused""paused": stopped after a spike of declined cards.
productID (prod_…)
quantityinteger or nullThe product's quantity, fixed; null: 1, or the buyer's choice where the product allows it.
itemsarray of objectThe product's add-ons it sells, at their quantities, set when it was made.
items[].productID (prod_…)
items[].quantityinteger
items[].offeredbooleanOffered, a box the buyer may tick; otherwise Included, in every sale.
amountinteger or nullWhat it sells, at current prices: the product at its quantity, and the add-ons it includes.
currencystring or null
expires_atinteger or null
max_paymentsinteger or null
payments_countinteger
availablebooleanWhether a buyer opening it now could pay.
couponID (cpn_…) or nullA coupon applied when the link opens; the buyer can remove it.
metadatamap of strings
createdinteger
warningsarray of objectEmpty when buyers can pay. Otherwise why they can't yet, and how to fix it.
warnings[].codeone of "checkout_unavailable", "items_unavailable""checkout_unavailable": no enabled payment provider can take its payments yet. "items_unavailable": its products share no provider that can take them together.
warnings[].messagestring

Payout

FieldTypeMeaning
idID (po_…)
object"payout"
livemodeboolean
statusone of "pending", "in_transit", "paid", "failed", "cancelled"pending: not sent yet; in_transit: on its way; paid: arrived; failed: refused by your bank; cancelled: one you recorded, undone.
providerstring
provider_referencestring or nullThe provider's ID for it; null for one you recorded.
manualbooleanRecorded by you, for a provider ShipBill can't read payouts from.
amountintegerThe whole payout, your sales outside ShipBill included; negative when it took money from your bank.
currencystring
shipbill_amountinteger or nullThe part from sales through ShipBill, in the payout's currency; null until its lines are read.
feeintegerWhat the provider charged for sending it.
arrival_datestring or nullWhen it's expected at your bank, where the provider says.
paid_atinteger or null
createdinteger

WebhookEndpoint

FieldTypeMeaning
idID (whep_…)
object"webhook_endpoint"
livemodeboolean
urlstring
descriptionstring or null
enabled_eventsarray of string"*" for every event, or the types chosen.
statusone of "enabled", "disabled", "auto_disabled"
createdinteger
secretstring

Event

FieldTypeMeaning
idID (evt_…)
object"event"
typestringpayment.succeeded, invoice.paid, checkout.expired, …
createdinteger
livemodeboolean
api_versionstring
dataobject
data.objectPayment or CheckoutSession or Invoice or Subscription or WebhookTestObjectThe object as it was when the event happened, complete enough to act on alone.

WebhookPayload

FieldTypeMeaning
idID (evt_…)
typestringpayment.succeeded, invoice.paid, checkout.expired, …
createdinteger
livemodeboolean
api_versionstring
dataobject
data.objectPayment or CheckoutSession or Invoice or Subscription or WebhookTestObjectThe object as it was when the event happened, complete enough to act on alone.

WebhookTestObject

FieldTypeMeaning
object"webhook_test"
endpointID (whep_…)
messagestring

EmbedSession

FieldTypeMeaning
object"checkout.embed_session"
client_tokenstring
urlstringThe hosted page, for when a modal can't be opened.
expires_atinteger

PricePreview

FieldTypeMeaning
productstring
availablebooleanFalse for a product that isn't active, or isn't this profile's.
displaystring or nullThe localised price, such as "€45.12".
currencystring or null
basestring or nullThe merchant's own price, such as "$49.00".
sourceone of "fixed", "converted" or nullfixed: the merchant's fixed price in this currency, shown and charged exactly (no "about"); converted: worked out from their price, or their price itself.
intervalone of "day", "week", "month", "year" or nullFor a subscription, the unit of its period; null for a one-time price.
interval_countinteger or nullFor a subscription, how many intervals each period lasts; null for a one-time price.

Error

FieldTypeMeaning
errorobject
error.typeone of "invalid_request_error", "authentication_error", "permission_error", "rate_limit_error", "idempotency_error", "api_error"
error.codestring
error.messagestring
error.paramstring or nullThe field at fault, such as "line_items.0.product".
error.request_idstring

Last checked against the product on 12 October 2026.

NextEventsEvery event ShipBill sends, when it's sent, and the object it carries.