Testing and going live
Test mode runs the whole flow on Solana devnet with no real funds. Exercise each path below, then work through the launch checklist before you switch to live keys.
Last updated:
A five minute smoke test
# 1. Confirm the key and mode
curl https://digitaltoken.ai/api/v1/me -H "Authorization: Bearer sk_test_..."
# 2. Confirm your endpoint receives and acknowledges a signed event
curl -X POST https://digitaltoken.ai/api/v1/webhooks/test -H "Authorization: Bearer sk_test_..."
# 3. Create a session, open checkout_url and pay with a devnet wallet
# 4. Look for events your server missed
curl "https://digitaltoken.ai/api/v1/webhooks/deliveries?status=failed" -H "Authorization: Bearer sk_test_..."Paths to test
Successful payment
Create a session, open checkout_url with a devnet wallet and pay. You should receive payment.succeeded and the session becomes paid.
Abandoned checkout
Create a session and leave it, or call the expire endpoint. You should receive payment.expired and the customer can no longer pay.
Duplicate request
Send the same create request twice with one Idempotency-Key. Both calls return the same session_id.
Endpoint down
Return a 500 from your webhook, check the delivery shows as pending with a next attempt, then fix it and call redeliver.
Bad signature
Change one character of the body and confirm your handler returns 400 and does not fulfil the order.
Refund
Refund a paid test order from the merchant dashboard and confirm you handle refund.succeeded.
Launch checklist
- Secret keys are only in server environment variables and never in client code, logs or git.
- Your webhook endpoint verifies signatures on the raw body and rejects events older than five minutes.
- Order fulfilment is idempotent, so a repeated webhook cannot ship an order twice.
- You fulfil from payment.succeeded, not from the browser redirect to success_url.
- You check livemode so test events never touch real orders.
- Session creation sends an Idempotency-Key based on your order id.
- Your success_url and cancel_url use https, and your domains are on the allowed list.
- You handle 429 and 5xx responses with a short retry, as the server SDK does.
- You have a job that lists recent sessions and fixes any order your webhook missed.
- You swapped in live keys and set the live webhook URL, which is separate from the test one.
Troubleshooting
- I get 401
- The key is missing, mistyped or revoked. Call /api/v1/me with the same key to check it. A test key cannot see live sessions and the reverse.
- I get 400 on create
- The error message names the field. Common causes are an amount below $0.50 and a success_url that is not https or not on your allowed domains.
- My webhook never arrives
- Run POST /api/v1/webhooks/test and read the result. The URL must be public https. List deliveries to see the last status and error from your server.
- The signature never matches
- Use the raw body, the secret for the same mode, and the exact header value. Paste a failing delivery into the signature tester to compare.