GCash Integration
E-WALLETIntegrate GCash, the most popular e-wallet in the Philippines, directly into your application. This guide covers the end-to-end redirect flow required to process GCash payments.
The E-Wallet Redirect Flow
Unlike credit cards, GCash payments require the customer to authenticate the transaction within their GCash app or web portal. Your integration must handle redirecting the user and listening for asynchronous webhooks to confirm the final status.
- No PCI-DSS certification required
- Real-time settlement to your merchant account
Step 1: Create a Payment Intent
Initiate the transaction from your backend using your Secret Key. Set the payment_method to gcash.
-H "Authorization: Bearer sk_live_your_secret_key" \
-H "Content-Type: application/json" \
-d '{
"amount": 150.00,
"currency": "PHP",
"payment_method": "gcash",
"description": "Order #99281",
"return_url": "https://yourstore.com/checkout/verify?order=99281"
}'
Step 2: Redirect the Customer
The API will return a REQUIRES_ACTION status along with a GCash checkout URL. You must redirect your customer's browser to this URL.
"id": "pi_gcash_123456789",
"amount": 150.00,
"status": "REQUIRES_ACTION",
"next_action": {
"type": "redirect",
"url": "https://gw.gcash.com/checkout/auth/abc123def456"
}
}
Step 3: Await Webhook (Fulfillment)
After the customer authorizes the payment on GCash, they will be sent back to your return_url. Do not fulfill the order based solely on this return. Always wait for the payment.success webhook sent to your server.
Testing in Sandbox
Use the following mock credentials when redirected to the GCash sandbox authorization page to simulate successful or failed payments.
| Mobile Number | MPIN | OTP | Expected Result |
|---|---|---|---|
| 0917 123 4567 | 1234 | 000000 | SUCCESS |
| 0918 999 9999 | 1234 | 000000 | INSUFFICIENT_BALANCE |