Quickstart
This brief guide will show you how to accept your first payment using Gerbang Pay in under 5 minutes, using a BCA Virtual Account.
Step 1: Dashboard Setup
Before touching any code, ensure your basic configuration is ready.
- Open the Gerbang Pay Dashboard
- Go to Integration Setup and generate a Test API Key. (Save the key starting with
gp_test_...) - Enter your provider credentials (e.g., Winpay) in the Provider Setup menu. (You can use test credentials).
- Go to Routing Rules and set the Virtual Account (All Banks) payment method to be routed to Winpay.
- Optional: Set a Webhook URL in the Integration Setup menu if you already have an accessible server (e.g., via Ngrok).
Step 2: Connection Test (Get Active Methods)
Let's ensure your API Key and Routing Rules are working. Call the GET /v1/active-methods endpoint. This endpoint will return the list of methods you have configured.
curl -X GET https://gerbang-pay-api.gai.co.id/v1/active-methods \
-H "Authorization: ApiKey gp_test_xxxxxxxxxxxx"If successful, you will see a JSON indicating Winpay is active with the Virtual Account method in it. This means Gerbang Pay is ready to accept payment requests.
Step 3: Create Payment
We will create a billing transaction (charge) for Rp 100,000 (which is formatted in cents: 10000000).
curl -X POST https://gerbang-pay-api.gai.co.id/v1/payments/create \
-H "Authorization: ApiKey gp_test_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "X-Idempotency-Key: order-quickstart-001" \
-d '{
"amount": 10000000,
"currency": "IDR",
"method_type": "virtual_account",
"method_detail": {
"type": "virtual_account",
"bank": "BCA"
},
"customer_name": "Budi Quickstart",
"customer_phone": "081234567890",
"expiry_minutes": 60
}'Success response (200 OK): You will receive a reply containing a payment_code, transaction ID (id), and most importantly: the Virtual Account number that must be paid in the method_data.va_number field.
{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "pending",
"method_data": {
"type": "virtual_account",
"bank": "BCA",
"va_number": "88880123456"
}
}
}Step 4: Simulate Payment
Because we use a Test Key (gp_test_...), no real money is transferred. To change the transaction status to "Paid", we use the simulator.
- Return to the Gerbang Pay Dashboard.
- Open the Sandbox Simulator menu.
- You will see your
order-quickstart-001transaction there with apendingstatus. - Click the Simulate Payment button.
- The Gerbang Pay internal system will mark the transaction as paid, simulating that Budi Quickstart has just transferred money to his BCA VA.
Step 5: Check Status / Receive Webhook
If you previously registered a Webhook URL in Step 1, check your server logs. You should have received a POST webhook request from Gerbang Pay with the event payment.paid.
If you are not using webhooks, you can poll its status:
curl -X GET https://gerbang-pay-api.gai.co.id/v1/payments/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: ApiKey gp_test_xxxxxxxxxxxx"You will see the status has changed to paid and the paid_at field is populated with the time of payment.
Congratulations! You have successfully completed your first Gerbang Pay transaction.