Testing in the Sandbox Environment
Gerbang Pay provides a simulation environment so you can test the system End-to-End — from creating a bill, simulating incoming payments, to receiving webhooks — without involving real money.
1. Activating Sandbox Mode
To use the Sandbox, you do not need to change the Gerbang Pay endpoint URL. Gerbang Pay uses a single base URL for everything: https://gerbang-pay-api.gai.co.id.
The way to enter Sandbox mode is simply by changing the API Key used.
- Open the Gerbang Pay Dashboard
- Navigate to Settings → API Keys
- Click Generate New API Key, and ensure you select the "Test" type.
- The key will start with the prefix
gp_test_... - Use this key in your client code's header:
Authorization: ApiKey gp_test_...
Automatically, Gerbang Pay will recognize that the key is a test key, and will route requests to the provider's Sandbox system (e.g., the URL https://sandbox-api.bmstaging.id/snap for Winpay).
2. Simulating Transactions (Simulator Dashboard)
After the API successfully returns a pending bill (Virtual Account, QRIS, etc.), you certainly want to simulate that the transaction has been "paid" as if by a customer.
You can do this by using the Sandbox Simulator feature in the Gerbang Pay Dashboard:
- Open the Dashboard, go to the Sandbox / Simulator menu.
- You will see a list of transactions you just created using the Test Key.
- Click the Simulate Payment button next to the transaction.
- The system will "force" the status to
paidby calling a mock endpoint internally.
Alternative: If the provider has a sandbox web page (e.g., the Winpay or Midtrans sandbox portal), you can also enter the Virtual Account number into that portal to simulate payment.
3. Verifying Success
There are two ways to see if the simulation was successful:
A. Verification via API (Polling): Call the GET /v1/payments/{payment_id} endpoint. The status field will change from pending to paid.
B. Verification via Webhook (Recommended): As soon as you click "Simulate Payment" in the dashboard, Gerbang Pay will detect the status change and immediately trigger a webhook to your local server URL (if configured).
💡 Local Webhook Tip: When developing applications on your local computer (localhost), your server cannot be reached by Gerbang Pay from the public internet. Use a tool like Ngrok or Cloudflare Tunnels to get a public URL (
https://xxx.ngrok.io), and set that URL as your Callback URL in the Gerbang Pay Dashboard.
Sandbox Test Data
The following data is free to use as long as you interact with the API using a Test Key:
- Phone Number:
081234567890(Or any valid 10-13 digit number) - Amount: Any (recommended >
1000000/ Rp 10,000) - Email: Any, ensure the
@format is correct.
All sandbox transactions will not appear in the daily Production financial reports, keeping your real business accounting secure.