[УКР](https://hackmd.io/YXcqBiUoSOCibGzH-K420w) | ENG

:arrow_left: [Guide](https://hackmd.io/QA2NYRliRLGviJl5P4-ZCw)
# Google Pay API Direct Integration
**Google Pay**™ is a simple payment method that allows to pay by card quickly and securely without having to enter payment details for each payment. Card data is securely stored by **Google**. This payment method is available on all devices (phones or computers), regardless of operating system and web browser.
```
Google Play is a trademark of Google LLC.
```
Please note that XPAY provides Partners with the opportunity to enable payment on the site by **Google Pay** in two ways, using:
1. [**Payment Page (Checkout XPAY)**](https://hackmd.io/B7V3CnG2QUKI6Qr820GHkA) - doesn't need additional integrations, after signing the Contract, the payment method is automatically activated;
2. **Direct integration by Google Pay API** - your site must be HTTPS and support TLS 1.2.
If you chose the **"Direct integration by Google Pay API"** follow the next steps:
1. Read [Google Pay API Terms of Service](https://payments.developers.google.com/terms/sellertos?hl);
2. Read [Google Pay and Wallet APIs Acceptable Use Policy](https://payments.developers.google.com/terms/aup?hl=ru) and follow the rules;
3. Follow brand guidelines - [Brand guidelines](https://developers.google.com/pay/api/web/guides/brand-guidelines);
4. Make sure you have completed all the steps described in the [Integration checklist](https://developers.google.com/pay/api/web/guides/test-and-deploy/integration-checklist).
## Google Pay Activation Instructions for Direct Integration
1. After completing the previous 4 steps, use [Google Pay API](https://developers.google.com/pay/api/android/guides/setup) to get [PaymentData](https://developers.google.com/pay/api/web/reference/request-objects#PaymentMethod).
2. Specify the script parameters:
2.1 Available payment methods:
`var allowedPaymentMethods = ['CARD', 'TOKENIZED_CARD']`;
2.2 Tokenization type - PAYMENT_GATEWAY:
`tokenizationType: 'PAYMENT_GATEWAY`;
2.3 Gateway parameter:
`xpay`;
2.4. GatewayMerchantId parameter:
Your `merchantAccount` is provided by XPAY specialist.
3. Client's billing address is not required for **XPAY Google Pay API** requests.
If you have followed all the steps correctly, your integration will allow you to get a **Google Pay** button on the payment page of your website or application.

Pop-up window or form for choosing an additional card will appear after clicking the button on the device with **Google Pay**. After the Client chooses a card, you will receive a dataset from PaymentData.
### Example of dataset returned from Google Pay:
:::info
~~~
{
"apiVersion": 2,
"apiVersionMinor": 0,
"paymentMethodData": {
"type": "CARD",
"description": "Visa •••• 1234",
"info": {
"cardNetwork": "VISA",
"cardDetails": "1234"
},
"tokenizationData": {
"type": "PAYMENT_GATEWAY",
"token": "****PaymentMethodToken*****"
}
}
}
~~~
:::
Partner takes the token from **"tokenizationData"** structure and transmits it to the XPAY system by sending the following request (`GoogleToken` parameter):
:::info
[[10102/101023/101025] Card-Wallet](https://hackmd.io/MUZzd3mTRQeQfBsE-emVVQ)
:::

:arrow_left: [Guide](https://hackmd.io/QA2NYRliRLGviJl5P4-ZCw)
:arrow_left: [General API Integration Information](https://hackmd.io/ijxPm0xtTpycgTjuU_NHQQ)
<details>
<summary>XPAY Support</summary>
</br>
Phone: +38 093 891 92 00
Email: info@xpay.com.ua
Telegram: @xpaysupportbot
</details>