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

:arrow_left: [Guide](https://hackmd.io/QA2NYRliRLGviJl5P4-ZCw)
# [auth] Google/Apple Pay
*What is Checkout, payment types and integration methods, see the ["Checkout"](https://hackmd.io/B7V3CnG2QUKI6Qr820GHkA) section.*
## Payment by "Google/Apple Pay"
:::info
Set some settings in the Operator system to display the "Google/Apple Pay" button on the Checkout page and get Checkout link [[10005]](https://hackmd.io/qSkRHz6gRKmxNrWRwwrjqg) with built-in "Google/Apple Pay" button.
:::
When paying via Checkout by Google/Apple Pay, the payment type `"PayType":"20"` must be transmitted in the request [[10005]](https://hackmd.io/qSkRHz6gRKmxNrWRwwrjqg).
In response, the Operator sends an **"auth"** request to authorize a transaction, that contains the card data required for the payment by Google/Apple Pay.
## Specifics of Request Formation
* The request is only executed paying via Checkout by any integration method (see the section "[Checkout Integration Methods](https://hackmd.io/B7V3CnG2QUKI6Qr820GHkA#Checkout-Integration-Methods)").
* The request is executed to the URL (parameter `CallBackURL` of the `Data` structure), transmitted in the request [[10005]](https://hackmd.io/qSkRHz6gRKmxNrWRwwrjqg).
* The request is sent three times every 20 seconds until the Partner receives a response. If there is no response, a notification will be sent every 10 minutes until a response is received.
* The request is sent by the "GET" method and in the form of a string.
* The sum is transmitted in kopecks (1 UAH corresponds to "100").
* The phone is transmitted in international format without the “+” character.
* The separator between parameters is the “&” character.
## The "auth" Request
The following parameters are sent in the request:
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
| `command` | Yes | String | Request type.|`auth` |
| `txn_id` | Yes | String | Unique transaction identifier in the Operator system. | `321455` |
| `uuid` | Yes | String | Unique identifier linking "auth" and "[pay](https://hackmd.io/r0If47QcT-qyFuNvGEN2Wg)" requests. | `f3cd72b6-e1ea-406f-9b44-a9b93b401b7f` |
| `account` | Yes | String | Unique client identifier in the Partner's system: phone or email. | `380638754213` |
| `sum` | Yes | Integer| Payment sum in kopecks. |1UAH=>`100`|
| `pay_type` | Yes | String | Type of payment method. See the table "[Payment Types](https://hackmd.io/16yLv895Qo-FWTvrWWQwbg#Payment-Types)"). | `1` |
| `locale` | Yes | String | Locale (language) of the payment page (the same locale from the request [[10005]](https://hackmd.io/qSkRHz6gRKmxNrWRwwrjqg)). | `uk` |
| `tavv` | No | String | "Google/Apple Pay" authorization token. |`AYKLBHIACh7p/J0eSaLHMAACAAA=` |
| `pan` | Yes | String | PAN card (bank card number). | `8888888888888888` |
| `exp` | No | String | Card expiration date in YYMM format. | `2312` |
| `gateway` | Yes | String | "Google/Apple Pay" tokenization gateway. |`gpay` or `applepay` |
## Response to the "auth" Request
To the "auth" request, the Partner sends response as a JSON structure, formed from the following parameters:
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
| `txn_id` | Yes | String | Unique transaction identifier transmitted in the "pay/error" request. | `321455` |
| `result` | Yes | String | Operation status. See the table “[Operation Status](https://hackmd.io/16yLv895Qo-FWTvrWWQwbg#Operation-Status)”. | `10` |
| `message` | No | String | Text message with the result description. | `Ok` |
| `txn_date` |Yes|String| Date and time of operation in the Partner system. The format is: YYYYMMDDHHMMSS.| `20190301180233` |
:::success
<details>
<summary>Example of response structure</summary>
<br>
~~~md
{
"txn_id": "321456",
"result": "10",
"message": "Done",
"txn_date": "20190301180833"
}
~~~
</details>
:::
## Reference Materials
General parameters of the XPAY system are given in the ["Reference Materials"](https://hackmd.io/16yLv895Qo-FWTvrWWQwbg) section: operation types, payment types, response codes, operation status, reasons of operation rejection, etc.

:arrow_left: [Guide](https://hackmd.io/QA2NYRliRLGviJl5P4-ZCw)
:arrow_left: [Checkout](https://hackmd.io/B7V3CnG2QUKI6Qr820GHkA)
:arrow_left: [[10005] Get Checkout Link](https://hackmd.io/qSkRHz6gRKmxNrWRwwrjqg)
<details>
<summary>XPAY Support</summary>
</br>
Phone: +38 093 891 92 00
Email: info@xpay.com.ua
Telegram: @xpaysupportbot
</details>