Testing
Every profile has a test mode: its own keys, payments, customers, webhooks, and subscriptions, and no real money. Build and test everything there, then switch the keys.
Test mode
Switch the dashboard to Test at the top. Test keys start sk_test_ and pk_test_; they see only test data, and live keys never see it. Products are shared by both modes; payment links, checkouts, payments, customers, and endpoints belong to one.
Test payments
Connect the Test provider in test mode (Settings → Payment providers). It takes test payments only, so live mode doesn't offer it. It takes a card, a wallet, or a bank transfer, and paying with it opens its page, where you choose what happens. The card form is filled in with 4242 4242 4242 4242; the number is ignored and never sent anywhere.
| Pay successfully | The payment succeeds; you receive payment.succeeded. |
| Card declined · Insufficient funds · Authentication failed | The attempt fails with that reason; the buyer can try again. |
| Authentication challenge, then success | A screen like a bank's 3-D Secure check comes first, then the payment succeeds. |
| Processing, then success after 20 seconds · Processing, then failure | The buyer comes back to a payment that is still processing; the result follows by webhook. |
| I've transferred (bank transfer) | Processing, then the transfer "arrives" 20 seconds later. |
| Back to the store | The attempt is cancelled, and the buyer can pay another way. |
Pay with chooses the card, to try your fraud rules: the buyer's usual one (the same buyer always pays with the same card), a new one, or one another buyer used, issued in any country. What ShipBill will receive shows the event your endpoint will get.
After the sale
On a test payment's page, the Test provider panel makes the test provider do what a provider does after a sale. Each arrives the way it would from a real provider, within a few seconds.
- Simulate a refund, of all of it or an amount: recorded as a refund made at the provider.
- Simulate a dispute, then Dispute won or Dispute lost.
- Simulate an early fraud warning: your fraud rules for it apply.
- Simulate a payout: this and your other paid test payments, on the Payouts tab.
Every other provider connects in test mode with your own sandbox keys from that provider, and takes payments in its sandbox, so nothing real is charged. Cryptomus has no sandbox, so it connects in live mode only. Test-mode emails go only to the account's own address, never to the customers named in test data.
On your own computer
- Add
http://localhost:<port>to Allowed websites: the embedded checkout and buy buttons open there for test-mode checkouts. - A test checkout's
success_urlandcancel_urlmay behttp://localhosttoo. Live keys need https. - Webhooks can't reach your computer: use a tunnel or read
/v1/events(see Webhooks).
Moving subscriptions through time
On a test subscription's page in the dashboard, or from your server:
await shipbill.test.subscriptions.advance("sub_…", { to: "due_date" });next_reminder | Sends the next scheduled reminder now. |
due_date | Moves the period's end to now: the subscription becomes past due. |
past_grace | Ends the grace period: the subscription expires and the customer is told. |
Each sends the events a real one would. Live subscriptions can't be moved.
Going live
- Connect a real payment provider in live mode.
- Create live keys, and put the secret one on your server.
- Add a live webhook endpoint, and its signing secret.
- Allow your real website (https) in Allowed websites, which holds for both modes.