# Google Pay

Add [Google Pay](https://developers.google.com/pay/api) to Android apps for [these supported countries](https://support.google.com/pay/answer/9023773#zippy=%2Cpay-online-or-in-apps).

Important
The following Google Pay payments receive liability shift in SCA impacted regions:

* Mastercard
* Visa (where device PAN/"CRYPTOGRAM_3DS" is used)


### Get started

1. Read through the [Google Pay Overview](https://developers.google.com/pay/api/android/overview).
2. Ask your Worldpay Implementation Manager to enable Google Pay.
3. Your Worldpay Implementation Manager supplies you with a Gateway Merchant ID which you need to supply in your integration with Google Pay API.
4. Follow the [Google Pay tutorial](https://developers.google.com/pay/api/android/guides/tutorial) and complete the [Google Pay test checklist](https://developers.google.com/pay/api/android/guides/test-and-deploy/integration-checklist) to ensure a successful integration.


### Cards and Android device tokens

Google Pay encrypted payloads support two card instrument types:

* **FPAN (Funding Primary Account Number):** A card stored in the user's Google Account. To accept these payloads, the `allowedAuthMethods` card parameter must include `PAN_ONLY`, as described in [Google Pay's documentation](https://developers.google.com/pay/api/android/reference/request-objects#CardParameters).
* **DPAN (Device Primary Account Number):** A tokenized card stored on an Android device (typically in Google Wallet). DPAN transactions include a device-generated EMV/3DS cryptogram for additional authentication. The required `allowedAuthMethods` for this instrument is `CRYPTOGRAM_3DS`, as described in [Google Pay's documentation](https://developers.google.com/pay/api/android/reference/request-objects#CardParameters).


| **Google Pay instrument** | **Authorizations (Card Payments and Payments API)** | **Payouts** |
|  --- | --- | --- |
| **FPAN** | ✅1 | ❌2 |
| **DPAN** | ✅ | ✅ |


Important notes
1 Payment requests with a Google Pay FPAN (`allowedAuthMethods` as "PAN_ONLY") must be 3DS authenticated in SCA-impacted regions.
2 Support for FPAN-based Google Pay in [Payouts](/products/card-payouts/payouts) is coming soon.

br
Best practice
[Set `assuranceDetails` to "true"](https://developers.google.com/pay/api/web/reference/request-objects?_gl=1*1kfeecm*_up*MQ..*_ga*MjAxNjcwNTcwNS4xNzY5MTczNDEy*_ga_SM8HXJ53K2*czE3NjkxNzM0MTEkbzEkZzAkdDE3NjkxNzM0MTEkajYwJGwwJGgw#CardParameters) in your request when integrating with the Google Pay API, to avoid attempting authentication on an SCA compliant token. A response containing `"cardHolderAuthenticated": true` indicates that authentication is not required and you can proceed directly to the authorization and reduce friction in your payment flow.

## Google Pay payment request

Here is an example of a Google Pay authorization request. For more information on taking a Google Pay payment, take a look at our [Payments API documentation](/products/card-payments/authorize-a-payment#authorize-a-payment).

`POST` your authorization request to the `customerInitiatedTransactions` action link received in your payments root response to authorize a payment.

### Authorization example request

`POST` `https://try.access.worldpay.com/cardPayments/customerInitiatedTransactions`

```json
{
    "transactionReference": "Memory265-13/08/1876",
    "merchant": {
        "entity": "default"
    },
    "instruction": {
        "requestAutoSettlement": {
            "enabled": false
        },
        "narrative": {
            "line1": "Mind Palace"
        },
        "value": {
            "currency": "GBP",
            "amount": 250
        },
        "paymentInstrument": {
            "type": "card/wallet+googlepay",
            "walletToken": "{\"protocolVersion\":\"ECv1\",\"signature\":\"MEQCIH6Q4OwQ0jAceFEkGF0JID6sJNXxOEi4r+mA7biRxqBQAiAondqoUpU/bdsrAOpZIsrHQS9nwiiNwOrr24RyPeHA0Q\\u003d\\u003d\",\"signedMessage\":\"{\\\"tag\\\":\\\"jpGz1F1Bcoi/fCNxI9n7Qrsw7i7KHrGtTf3NrRclt+U\\\\u003d\\\",\\\"ephemeralPublicKey\\\":\\\"BJatyFvFPPD21l8/uLP46Ta1hsKHndf8Z+tAgk+DEPQgYTkhHy19cF3h/bXs0tWTmZtnNm+vlVrKbRU9K8+7cZs\\\\u003d\\\",\\\"encryptedMessage\\\":\\\"mKOoXwi8OavZ\\\"}\"}"
        }
    },
    "channel": "ecom"
}
```

### Set up repeat payments

Your customer can use Google Pay to set up repeat payments (such as subscriptions). You must include the `customerAgreement` object in your [Customer Initiated Transactions](/products/card-payments/openapi/other/authorize) Google Pay request:

```
{
...
  "instruction": {
    ...
    "customerAgreement": {
      "type": "subscription",
      "storedCardUsage": "first"
    }
  }
}
```

We convert the Google Pay encrypted payload into a Worldpay Token, which will be returned to you in the response to the above request. You may use that token to request subsequent recurring [Merchant Initiated Transactions](/products/card-payments/openapi/other/recurring).

### Google Pay payment response

#### Successful payment

You receive:

* an HTTP code `201`
* an `"outcome": "authorized"`
* a `paymentInstrument`
* links to [cancel](/products/card-payments/manage-payments#cancel-an-authorization), [settle](/products/card-payments/manage-payments#settle-an-authorization), [partially settle](/products/card-payments/manage-payments#partially-settle-an-authorization) or [query payment events](/products/card-payments/query-a-payment)


#### Refused payment

You receive:

* an `"outcome": "refused"`
* a [refusal code](/products/reference/refusal-response)
* a `description` that gives additional context on the refusal
* a `paymentInstrument`


#### Example responses

Successful
```json
{
    "outcome": "authorized",
    "riskFactors": [{
            "risk": "notChecked",
            "detail": "postcode",
            "type": "avs"
        },
        {
            "risk": "notChecked",
            "detail": "address",
            "type": "avs"
        }
    ],
    "scheme": {
        "reference": "schemeReference"
    },
    "paymentInstrument": {
        "type": "card/network+masked",
        "cardBin": "444433",
        "lastFour": "1111",
        "tokenNumber": "444433******1111",
        "countryCode": "GB",
        "expiryDate": {
            "month": 2,
            "year": 2028
        },
        "cardBrand": "visa",
        "fundingType": "debit",
        "category": "consumer",
        "issuerName": "VALID_ISSUER",
        "paymentAccountReference": "somePAR"
    },
    "_links": {
        "cardPayments:cancel": {
            "href": "https://try.access.worldpay.com/payments/authorizations/cancellations/eyJrIjoiazUyOTVhMSIsImxpbmtWZXJzaW9uIjoiMy4wLjAifQ==.7uyuNo1ShOgM5rTwStg86LXzb0a2wdLW1lwX:DIQ2Ecrp4gw65VLnHmjsAVqzpa2NcwixaBb2p8R2x5NPXdRpybJ2ndKlbkNOc9gj+ruN20iaTdYqv2FNgB3ZAw3g+yyUMUlQDFD8DU++ZswXpUQe8YTBHmTP8zHQUXrSORn9IaI6kzJnMu2HWwEJOqKnWLvRCMy:fr4ptatJJrmRVON8WTjisJL:sd3TJ9uDcO:gD+q+Q01y++Mzop0k8y3bDcnNBpsG:8xf4uKGGYO3EcAWA=="
        },
        "cardPayments:settle": {
            "href": "https://try.access.worldpay.com/payments/settlements/full/eyJrIjoiazUyOTVhMSIsImxpbmtWZXJzaW9uIjoiMy4wLjAifQ==.7uyuNo1ShOgM5rTwStg86LXzb0a2wdLW1lwX:DIQ2Ecrp4gw65VLnHmjsAVqzpa2NcwixaBb2p8R2x5NPXdRpybJ2ndKlbkNOc9gj+ruN20iaTdYqv2FNgB3ZAw3g+yyUMUlQDFD8DU++ZswXpUQe8YTBHmTP8zHQUXrSORn9IaI6kzJnMu2HWwEJOqKnWLvRCMy:fr4ptatJJrmRVON8WTjisJL:sd3TJ9uDcO:gD+q+Q01y++Mzop0k8y3bDcnNBpsG:8xf4uKGGYO3EcAWA=="
        },
        "cardPayments:partialSettle": {
            "href": "https://try.access.worldpay.com/payments/settlements/partials/eyJrIjoiazUyOTVhMSIsImxpbmtWZXJzaW9uIjoiMy4wLjAifQ==.7uyuNo1ShOgM5rTwStg86LXzb0a2wdLW1lwX:DIQ2Ecrp4gw65VLnHmjsAVqzpa2NcwixaBb2p8R2x5NPXdRpybJ2ndKlbkNOc9gj+ruN20iaTdYqv2FNgB3ZAw3g+yyUMUlQDFD8DU++ZswXpUQe8YTBHmTP8zHQUXrSORn9IaI6kzJnMu2HWwEJOqKnWLvRCMy:fr4ptatJJrmRVON8WTjisJL:sd3TJ9uDcO:gD+q+Q01y++Mzop0k8y3bDcnNBpsG:8xf4uKGGYO3EcAWA=="
        },
        "cardPayments:events": {
            "href": "https://try.access.worldpay.com/payments/events/eyJrIjoiazUyOTVhMSIsImxpbmtWZXJzaW9uIjoiMy4wLjAifQ==.7uyuNo1ShOgM5rTwStg86LXzb0a2wdLW1lwX:DIQ2Ecrp4gw65VLnHmjsAVqzpa2NcwixaBb2p8R2x5NPXdRpybJ2ndKlbkNOc9gj+ruN20iaTdYqv2FNgB3ZAw3g+yyUMUlQDFD8DU++ZswXpUQe8YTBHmTP8zHQUXrSORn9IaI6kzJnMu2HWwEJOqKnWLvRCMy:fr4ptatJJrmRVON8WTjisJL:sd3TJ9uDcO:gD+q+Q01y++Mzop0k8y3bDcnNBpsG:8xf4uKGGYO3EcAWA=="
        },
        "tokens:token": {
            "href": "https://access.worldpay.com/tokens/linkData"
        },
        "curies": [{
            "name": "cardPayments",
            "href": "https://try.access.worldpay.com/rels/payments/{rel}",
            "templated": true
        }]
    }
}
```

Refused
```json
{
    "outcome": "refused",
    "description": "Do not honor",
    "refusalCode": "83",
    "refusalDescription": "Fraud/Security related reasons",
    "riskFactors": [{
            "risk": "notChecked",
            "detail": "postcode",
            "type": "avs"
        },
        {
            "risk": "notChecked",
            "detail": "address",
            "type": "avs"
        }
    ],
    "paymentInstrument": {
        "type": "card/network+masked",
        "cardBin": "444433",
        "lastFour": "1111",
        "tokenNumber": "444433******1111",
        "countryCode": "GB",
        "expiryDate": {
            "month": 2,
            "year": 2028
        },
        "cardBrand": "visa",
        "fundingType": "debit",
        "category": "consumer",
        "issuerName": "VALID_ISSUER",
        "paymentAccountReference": "somePAR"
    }
}
```

The `paymentInstrument` includes `brand` and `fundingType`. They can have the following values:

**`brand`**:

* `visa`
* `visaElectron`
* `mastercard`
* `maestro`
* `amex`


**`fundingType`**: 

* `debit`
* `credit`


**`paymentAccountReference`** (PAR):

The payment account reference is a unique identifier associated with a specific cardholder PAN. This 29 character identification number can be used in place of sensitive customer identification fields. It can be transmitted across the payments ecosystem to facilitate customer identification.

You can use the `payments:settle` action link to [settle the payment](/products/card-payments/manage-payments#settle-an-authorization) straight away. Alternatively, you can cache the response and use the link to settle the payment later.