GCash Integration guide
Learn how to accept subscriptions and ecommerce payments with the GCash wallet through dLocal, using Recurly's Purchase endpoint and Recurly.js.
Prerequisites
- Familiarity with Recurly's API v3, webhooks, and basic REST concepts
- Completed the Quickstart guide
- Familiarity with Recurly.js
- A dLocal sandbox and/or production gateway account with GCash enabled
- If you're planning on implementing ecommerce-style (customer-in-session, one-time transactions) flows, contact [email protected] or your CSM to enable the associated feature flag that allows use of the
store_billing_infofield
Limitations
- GCash one-time payments don't store payment method data for one-time transactions — you must allow customers to select GCash as a payment method in your checkout flow every time, rather than offering a stored account option
Definition
Integration guide
With GCash, the initial payment request differs slightly depending on whether you're creating a subscription or an ecommerce transaction — response handling is the same either way. See below for the specific request for each flow.
Creating a subscription signup
Send a request to the create_purchase method on Recurly's API, including:
- Customer account data — code, name, billing info, phone number, and email address
- Tax ID — the customer's tax ID
- Subscriptions — with plan codes
- The
typefield set togcash - If you're processing an ecommerce transaction instead, the
store_billing_infofield set tofalse
[TODO: Dev/PO review — possible issue: this JSON includes // comments (the commented-out three_d_secure_action_result_token_id line and the note on tax_identifier). JSON doesn't support comments — this will throw a parse error if copied verbatim. Consider moving these notes to prose instead.]
{
"currency": "PHP",
"account": {
"code": "account-code",
"email":"[email protected]",
"billing_info": {
"first_name": "First",
"last_name": "Last",
"address": {
"street1": "14 Laurel Road, Florentino Subd.",
"city": "Brgy. San Antonio",
"region": "Metro Manila",
"postal_code": "1234",
"country": "PH"
},
"tax_identifier":"123456789012",
"store_billing_info": true,
"type":"gcash"
}
},
"gateway_code": "gateway-code",
"subscriptions": [
{
"plan_code": "plan-code"
}
]
}Creating an ecommerce transaction
Send a request to the create_purchase method on Recurly's API, including:
- Customer account data — code, name, billing info, phone number, and email address
- Line items with specific values or IDs if you're using the line item catalog
- The
typefield set togcash - The
store_billing_infofield set tofalse
{
"currency": "PHP",
"account": {
"code": "account-code",
"email":"[email protected]",
"billing_info": {
"first_name": "First",
"last_name": "Last",
//"three_d_secure_action_result_token_id": "BSFIYrYdEbdfcnI982gr9Q",
"address": {
"street1": "14 Laurel Road, Florentino Subd.",
"city": "Brgy. San Antonio",
"region": "Metro Manila",
"postal_code": "1234",
"country": "PH"
},
"tax_identifier":"123456789012",
"store_billing_info": false,
"type":"gcash"
}
},
"gateway_code": "gateway-code",
"line_items": [
{
"unit_amount": "10.00",
"quantity": 1,
"description": "Item Description",
"type": "charge",
"tax_code": "physical", // or digital
"product_code": "product-code"
}
]
}Process the response
Whether you're signing up for a subscription or creating an ecommerce transaction, response handling is the same. The initial response includes an action token in the three_d_secure_action_token_id param. Feed that through Recurly.js to render the customer authentication modal. Once the customer completes authentication, you'll receive an action result token from Recurly.js — provide it in three_d_secure_action_result_token_id on the follow-up request. Resubmit the original payload with the new value, and the payment will process.
Verify and finish
After a successful purchase, confirm the details through the Recurly Admin Dashboard or by calling Recurly's API to list your new account, subscription, or invoice. For GCash ecommerce transactions, there won't be a billing info ID associated with the transaction, invoice, or account if no subscription is on file.
Listen for webhooks
You should listen for several webhooks to ensure you enable access to features in your environment, and disable access if a customer cancels their subscription. See Recurly webhooks for more details.
Updated about 2 hours ago