The SwissPay API lets you create payments and manage customers from your own application or scripts.
Base URL
| Environment | URL |
|---|---|
| Live & test | https://app.swisspay.ai |
There is a single base URL. Test mode and live mode are selected by the API key you send, not by the host:
sk_test_...keys run in test mode — use the test cards; no money moves.sk_live_...keys run in live mode — real cards, real settlement.
See Authentication for how keys map to modes.
What's available
| Resource | Endpoints |
|---|---|
| Payments | Create, retrieve, list |
| Customers | Create, retrieve, list |
| Refunds | Create, retrieve, list |
| Webhooks | Receive payment.succeeded, payment.failed, refund.succeeded, refund.failed |
Read the docs in order
- Quickstart â your first payment in under five minutes.
- Authentication â how to issue and use API keys.
- Idempotency â safe retries.
- Errors â every error code we return and what to do.
- Test cards â test-mode card numbers for the common authorisation outcomes.
- Payments â the full endpoint reference.
- Customers â the full endpoint reference.
- Refunds â refund a payment in full or in part.
Machine-readable spec
We publish an OpenAPI 3.1 specification covering every endpoint here.
Conventions
- HTTPS only. TLS 1.2 or higher.
- JSON in and out.
Content-Type: application/jsonon every request body; responses are JSON. - UTC timestamps in ISO 8601 (
2026-05-20T13:00:00Z). - Amounts in minor units. A CHF 29.99 payment is
"amount": 2999, "currency": "CHF". - Stable IDs. Object IDs are prefixed (
pay_...,cus_...) and stable. - Pagination uses
?page=and?per_page=(max 100).
Conventions we really care about
These trip up most new integrations:
- Declined cards return HTTP 200. Look at
status: "failed"and thefailureobject â not just the HTTP code. payment_method.holder_nameis required on every card payment, not only when 3-D Secure is enabled.- Unknown IDs return 404 â and so do IDs belonging to a different merchant.
Idempotency-Keyis required onPOST /paymentsand strongly recommended onPOST /customers.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article