LogoDOCS

GCash Integration

E-WALLET

Integrate 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.

POST /v1/payment-intents
curl -X POST https://api.paynplus.com/v1/payment-intents \
  -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 NumberMPINOTPExpected Result
0917 123 45671234000000SUCCESS
0918 999 99991234000000INSUFFICIENT_BALANCE