Skip to content
Developers

Getting started

This takes you from nothing to a paid test payment in the sandbox. You need a terminal with curl.

  1. Sign up for a business account at dashboard.spleetz.com.
  2. Switch on Test mode in the dashboard’s header. An amber “Test data” band shows while it is on. Everything you now see and make is in the sandbox, at https://api-sandbox.spleetz.com, and moves test money only.
  3. Set up the business’s payment account in Test mode, as the dashboard asks. Spleetz can’t open a payment for a business without one, in the sandbox or live.

In the dashboard, go to Settings > API keys and create a secret key. In Test mode it starts sk_test_.

Copy it when it is shown. Spleetz keeps only a hash of it, so it can’t show it again. If you lose it, roll it from the same page and use the new one.

Tick Can refund if this key should be able to issue refunds. A key without it can take payments and read them, but not refund them.

Prefix Kind Where it goes
sk_test_, sk_live_ Secret key Your server only. Takes payments, reads them, refunds them.
pk_test_, pk_live_ Publishable key A web page. Identifies the business in a browser; it can’t call the endpoints in this reference.
tk_test_, tk_live_ Till token A till or point-of-sale device, issued when it is paired.

This documentation is about secret keys and connected apps. Keep a secret key on your server: the API refuses one sent from a browser (any request with an Origin header), and tells the business that the key may be exposed.

Set it in your shell for the steps below:

Terminal window
export SPLEETZ_KEY=sk_test_...
Terminal window
curl https://api-sandbox.spleetz.com/transactions \
-H "Authorization: ApiKey $SPLEETZ_KEY" \
-H "Content-Type: application/json" \
-d '{
"amountMinor": 2500,
"currency": "GBP",
"reference": "order-1042",
"itemName": "Order 1042",
"returnUrl": "https://example.com/orders/1042/thanks",
"metadata": { "orderId": "1042" }
}'

Use a currency the business takes. Leave currency out to charge in the business’s home currency.

The response is the payment session. The fields you need now:

{
"transactionId": "...",
"reference": "order-1042",
"amountMinor": 2500,
"currency": "GBP",
"status": "Pending",
"isComplete": false,
"isSuccessful": false,
"expiresAt": "2026-11-24T13:30:00Z",
"payUrl": "https://pay-sandbox.spleetz.com/..."
}

Keep transactionId. Every later call and every webhook about this payment carries it.

Open payUrl in a browser. This is the Spleetz pay page: the customer pays there by card, or splits the bill with the people they are with. Pay with a test card from Sandbox and testing.

Once it is paid, the page sends the browser to your returnUrl with transactionId and status=paid added to it.

Never treat arriving at returnUrl as proof of payment: anyone can open that address. Ask the API instead:

Terminal window
curl https://api-sandbox.spleetz.com/transactions/$TRANSACTION_ID \
-H "Authorization: ApiKey $SPLEETZ_KEY"

A paid payment has "status": "Completed" and a paidAt time.

In production you would rather be told than ask. Add a webhook endpoint under Settings > Webhooks and listen for payment.succeeded. See Webhooks.

  1. Switch Test mode off. Set up the live payment account if you haven’t.
  2. Create a live secret key (sk_live_) under Settings > API keys.
  3. Point your server at https://api.spleetz.com.
  4. Add your live webhook endpoints. Live endpoints must use https.
  • Payments: everything you can send when creating a payment.
  • Authentication: rolling keys, and connected apps.