Activate Google Pay (API)

Learn about setting up Google Pay via the Payabli API

Applies to:Developers

Payabli has simplified the process of getting ready to accept Google Pay. You don’t need to create your own Google developer account, encryption keys, certificates, or merchant identifiers.

This guide walks through how to enable Google Pay for your organization via the API.

Enabling Google Pay via the API has several steps.

  1. Add the domain.
  2. Cascade the domain.
  3. Activate the Google Pay service for your org.

The following sections go over each step in detail.

Add payment method domains

Payment method domains are the web domains where you can accept Google Pay payments. Payabli needs to know which payment domains should accept Google Pay payments to mitigate risk and make sure that transactions are coming from known websites. Managing your payment method domains involves configuring them in Payabli.

To add a domain via the API, make a POST request to the /PaymentMethodDomain endpoint.

The domain must be public. It can’t be localhost, hidden by a VPN, or protected by a password.

POST
/api/PaymentMethodDomain
1curl -X POST https://api-sandbox.payabli.com/api/PaymentMethodDomain \
2 -H "requestToken: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "applePay": {
6 "isEnabled": true
7 },
8 "googlePay": {
9 "isEnabled": true
10 },
11 "domainName": "checkout.example.com",
12 "entityId": 109,
13 "entityType": "paypoint"
14}'

Payment method domain examples

The following example walks through the general structure of payment method domains.

Pretend that you own the domain example.com, and you want to accept Google Pay on a number of different pages on your various subdomains. You must set up payment method domains for each of your target domains and subdomains.

Page URLPayment Method Domain
https://www.example.com/monthlydueswww.example.com
https://subdomain1.example.com/paymentssubdomain1.example.com
https://subdomain2.example.com/donations/paysubdomain2.example.com
https://subdomain3.example.com/ordersubdomain3.example.com

Cascade domains

You have the option to cascade domains. When you cascade a domain, all of the organization’s children, including suborganizations and paypoints, inherit the domain. This reduces future operational overhead by automatically adding verified domains to all new suborganizations and paypoints. Payabli strongly recommends cascading domains.

Cascade a domain via the API by sending a POST request to /PaymentMethodDomain/{domainId}/cascade.

POST
/api/PaymentMethodDomain/:domainId/cascade
1curl -X POST https://api-sandbox.payabli.com/api/PaymentMethodDomain/pmd_b8237fa45c964d8a9ef27160cd42b8c5/cascade \
2 -H "requestToken: <apiKey>"

You can run a GET request to /PaymentMethodDomain/{domainId} to check the cascade status.

The cascades.jobStatus field indicates whether the cascade process is complete, failed, or in progress.

1 // response truncated
2 "cascades": [
3 {
4 "jobId": "550139",
5 "jobStatus": "completed",
6 "jobErrorMessage": null,
7 "createdAt": "2024-09-05T14:13:54.698Z",
8 "updatedAt": "2024-09-05T14:13:54.698Z"
9 }
10 ],

Payabli recommends a 10 second polling interval when checking domain cascade status.

Activate Google Pay

To activate Google Pay for an organization, make a POST request to the /Wallet/googlepay/configure-organization.

In the body, send isEnabled as true to activate the Google Pay for the organization. Send cascade as true to activate Google Pay for the organization’s children (including suborganizations and paypoints).

POST
/api/Wallet/googlepay/configure-organization
1curl -X POST https://api-sandbox.payabli.com/api/Wallet/googlepay/configure-organization \
2 -H "requestToken: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "cascade": true,
6 "isEnabled": true,
7 "orgId": 901
8}'

After you’ve sent the activation request, Payabli will enable the service and cascade the settings, if applicable. This can take a few minutes, depending on how your entities are structured.

To check whether Google Pay is activated, send a GET request to /api/Organization/settings/{orgId}. Check the response for forWallets, when Google Pay is active, you’ll see the following in the response:

1 "forWallets": [
2 {
3 "key": "IsGooglePayEnabled",
4 "value": "true",
5 "readOnly": true
6 }
7 ]