HomeProduct DocsAPI ReferenceChangelog
RecurlyAPI GuidesRecurly.jsWebhooksAPI ReferenceSupportBook demo
Product Docs

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.

This guide shows you how to use Recurly's Purchase endpoint to create new subscriptions with the GCash wallet payment method through dLocal. It also covers how to use GCash for one-time ecommerce transactions.
Available on all Recurly plans

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_info field

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

Creating a purchase means generating a new customer account and its subscription or respective line items in a single call to Recurly's Purchase endpoint. This bundles everything a checkout needs — account, billing info, and subscription or line items — into one request instead of several.

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.

1

Generate a GCash wallet payment request

Use a supported client library along with Recurly.js to configure your checkout. GCash uses Recurly.js to display the customer authentication window during checkout.

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 type field set to gcash
  • If you're processing an ecommerce transaction instead, the store_billing_info field set to false

[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 type field set to gcash
  • The store_billing_info field set to false
{
  "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"
        }
    ]
}
2

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.

3

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.

4

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.


Did this page help you?