JSON over HTTPS, one bearer key per environment, an idempotency key on every POST and one error shape. The full reference arrives at docs.merchsdk.com before launch, generated from our OpenAPI spec. Here's what to expect.
Three calls to a sandbox sale.
Get a sandbox key
Keys look like msk_sandbox_ plus 40 characters. We show each key once.
Create a merchant and connect a gateway
POST /v1/merchants, then open a merchant settings session and connect a gateway sandbox account.
Collect a test card and charge it
Mount the card form, save the result as a payment method, then call /v1/transactions/sale.
curl https://api.sandbox.merchsdk.com/v1/transactions/sale \ -H "Authorization: Bearer msk_sandbox_4hQ…" \ -H "Idempotency-Key: order-1042-attempt-1" \ -H "Content-Type: application/json" \ -d '{ "merchant_id": "mer_7Rk2pQ", "customer_id": "cus_V3n8Lc", "payment_method_id": "pm_Q9fT2a", "amount": 12500, "currency": "USD", "order_id": "INV-1042" }'{ "id": "txn_9Hc4Qm2Lx", "status": "approved", "amount": 12500, "currency": "USD", "merchant_id": "mer_7Rk2pQ", "connection_id": "con_nM1x02", "payment_method": { "brand": "visa", "last4": "4242" }, "attempts": [ { "id": "att_1bW7eR", "connection_id": "con_aN3t01", "gateway": "authorize_net", "result": "error", "decline_code": "processor_unavailable", "gateway_message": "An error occurred during processing." }, { "id": "att_2kP4sN", "connection_id": "con_nM1x02", "gateway": "nmi", "result": "approved", "gateway_transaction_id": "10482211937" } ]}HTTP/1.1 409 Conflict{ "error": { "type": "idempotency_error", "code": "idempotency_key_reused", "message": "This Idempotency-Key was used with a different request body.", "param": null }}Learn them once. They don't change per gateway.
- Authentication
- Authorization: Bearer msk_sandbox_…. Keys are scoped to your ISV and reach only your merchants. Rotating keeps the old key working for 24 hours unless you revoke it.
- Idempotency
- Every POST takes an Idempotency-Key. Same key and body returns the stored response; a different body, or a request still running, returns 409. Keys last 12 hours.
- Money
- Integer minor units with a currency code, never floats. 12500 with USD is $125.00. USD only for now.
- Results
- approved, declined, pending or error, a normalized decline_code, the gateway's raw code and message, and the list of attempts.
- Errors
- One shape: { "error": { "type", "code", "message", "param" } }. Calls a gateway can't do return not_supported_on_gateway; add-ons you haven't turned on return not_enabled.
- Scope
- Each request names one merchant with merchant_id in the path or body. Saved payment methods can only be charged for the merchant that owns them.
Prefixed IDs
Every object ID starts with its type, so a stray ID in a log tells you what it is.
- mer_
- Merchant
- con_
- Gateway connection
- cus_
- Customer
- pm_
- Payment method
- txn_
- Transaction
- att_
- Attempt
- sub_
- Subscription
- plan_
- Plan
- pp_
- Payment plan
- sp_
- Scheduled payment
- pq_
- Pricing quote
- evt_
- Event
Events you can trust and replay.
Signed. HMAC-SHA256 over the timestamp and body, with your endpoint's secret. Reject old timestamps to stop replays.
Retried and replayable. Failed deliveries retry with backoff. Every event stays in GET /v1/events for replay.
19 event types across transactions, subscriptions, payment plans, scheduled payments, payment methods, 3DS, chargeback alerts and connections. See the list.
POST /webhooks/merchsdk HTTP/1.1MerchSDK-Signature: t=1796339940,v1=5f2b0c…e91a{ "id": "evt_6Tq1Zr", "type": "transaction.succeeded", "created": 1796339940, "data": { "id": "txn_9Hc4Qm2Lx", "status": "approved", "merchant_id": "mer_7Rk2pQ", "amount": 12500 }}Sandbox first, then live.
| What | Host | Available |
|---|---|---|
| Sandbox API | api.sandbox.merchsdk.com | First |
| Sandbox components | js.sandbox.merchsdk.com | First |
| Live API | api.merchsdk.com | At launch |
| API reference | docs.merchsdk.com | At launch |
| Status page | status.merchsdk.com | At launch |
Sandbox uses gateway sandbox accounts and published test cards and bank accounts only. Base URL: https://api.sandbox.merchsdk.com/v1
Server SDKs
Generated from the OpenAPI spec, so they match the API exactly. PHP, JavaScript and Python first, then other major languages.
- PHPmerchsdk
- JavaScriptmerchsdk
- Pythonmerchsdk
Plus a client SDK that mounts the components in your pages.
Want a sandbox key when it opens?
Tell us what you're building and which gateways your merchants use. We'll bring you in as sandbox access opens.