Developer docs
Your customers pay through the payment providers you connect, into your own accounts, and ShipBill tells your server what was paid. Put it on your site in whichever of these ways suits you, from no code at all to your own payment form.
Choose how to integrate
| Option | Effort | How it works |
|---|---|---|
| Payment link | None | Create a link for a product in the dashboard and share it anywhere. |
| Buy button | A snippet | A button on your page opens the checkout over it, for one product. No server needed. |
| Hosted checkout | One API call | Your server creates a checkout; you send the buyer to its page. |
| Embedded checkout | An API call and a script | Your server creates a checkout; your page opens it in a window over itself. |
| Custom checkout | Full build | Your own payment page on ShipBill's API; the buyer pays on the provider's page. |
When it matters who is paying — a signed-in user upgrading their account — create the checkout on your server (hosted or embedded), so you set who it's for. The buy button and payment links suit selling to anyone. All of them end in the same webhook, payment.succeeded.
Five ideas every integration shares
Products carry the price
You create products in the dashboard or the API. A checkout names a product by its ID (prod_…), and ShipBill looks up its title and price itself, so nothing in a browser can change what is charged. A server can also charge a custom amount, with a secret key.
Two kinds of key
A secret key (sk_live_…) stays on your server and can do everything. A publishable key (pk_live_…) is safe in a web page: it can only open a checkout for one of your active products at its stored price, and only from the websites you allow. Both are in the dashboard under Payments → Website integration → API keys.
Test mode and live mode
Every profile has a test mode with its own keys (sk_test_…, pk_test_…), data, and webhook endpoints, and no real money. A test key never sees live data, and a live key never sees test data. See Testing.
Your reference
Give each checkout your own ID in reference — an order number, or your user's ID. It comes back on every event about that purchase, renewals included, so you never have to map ShipBill's IDs to yours.
Webhooks are the proof
ShipBill calls your server with signed events when something happens. Your server checks the signature and acts. See Webhooks.
Your first call
First connect the Test provider in Settings → Payment providers: a checkout needs a provider to take its payment, and this one takes test payments without an account. Then, with a test secret key from the dashboard:
curl https://api.shipbill.io/v1/checkout/sessions \
-H "Authorization: Bearer $SHIPBILL_SECRET_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order_1001-checkout" \
-d '{
"line_items": [{ "product": "prod_…", "quantity": 1 }],
"reference": "order_1001",
"success_url": "https://example.com/thanks"
}'The answer is the checkout session, with its url to send the buyer to and the client_token for the embedded checkout. Every request and answer is in the API reference.