# Session Establishment Request in aPay

{{url}}/ecom/jws/payments/apple\_pay/get\_session\_v1

#### Input parameters of the JWS payload part:

| Parameter         | Description                                                                                                                      | Data Format  | Required | Example                          |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------ | -------- | -------------------------------- |
| validationUrl     | The URL where Apple sends the request to validate the payment session                                                            | string(1000) | Yes      | apple-pay-gateway.apple.com      |
| merchantId        | Apple merchant identifier, provided by the bank                                                                                  | string(255)  | Yes      | YN\_O1aEEFqF6Jal4B5qHy7b7        |
| domain            | The domain name (URL) used for authorization                                                                                     | string(255)  | Yes      | checkout.develop.bankalliance.ua |
| merchantRequestId | A unique identifier generated by the merchant's system, used to check operation status in case of an unknown error or disconnect | string(50)   | Yes      | merchantRequestId\_cfc297a1e1e91 |

#### Output parameters of the JWS payload part:

| Parameter                 | Description                                                                                                                    | Data Format | Example                                     |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ----------- | ------------------------------------------- |
| applePaySessionData       | Apple Pay session data                                                                                                         | object      | -                                           |
| epochTimestamp            | Session start time (in milliseconds)                                                                                           | string      | 2024-09-30T15:06:05.274+03:00               |
| expiresAt                 | Session expiration time (in milliseconds)                                                                                      | string      | 2024-09-30T16:06:05.274+03:00               |
| merchantSessionIdentifier | Merchant session identifier                                                                                                    | string      | SSHB8FD6B91EB2B4C909990AE16F652A8BB\_BB8E.. |
| nonce                     | Unique security token                                                                                                          | string      | 0162edba                                    |
| merchantIdentifier        | Registered merchant identifier                                                                                                 | string      | C20AFFF8FC4092AB90F781FFA08E5C49..          |
| domainName                | Domain name where the session was initiated                                                                                    | string      | checkout.develop.bankalliance.ua            |
| displayName               | Merchant name to be displayed                                                                                                  | string      | merchant.aliiancebank.ua                    |
| signature                 | Signature used for session validity confirmation                                                                               | string      | 308006092a864886f70d010702a080308002010..   |
| merchantRequestId         | Unique identifier generated by the merchant's system, used to check operation status in case of an unknown error or disconnect | string      | merchantRequestId\_cfc297a1e1e91            |
| applePaySessionId         | Apple Pay session identifier                                                                                                   | string      | f40b099c-38f3-46f9-a989-52818018f557        |

#### Examples

<details>

<summary>JWS Payload - the request body before signing up</summary>

```json
{
    "merchantId": "YN_O1aEEFqF6Jal475qHy7b7",
    "validationUrl": "https://apple-pay-gateway.apple.com/paymentservices/startSession",
    "merchantRequestId": "merchantRequestId_cfc297a1e1e91",
    "domain": "checkout.develop.bankalliance.ua"
}
```

</details>

<details>

<summary>JWS Payload - the response body before signing up</summary>

```json
{
    "applePaySessionData": {
        "epochTimestamp": "2024-09-30T15:06:05.274+03:00",
        "expiresAt": "2024-09-30T16:06:05.274+03:00",
        "merchantSessionIdentifier": "SSHB8FD6B91EB2B4C52A8BB_BB8E62003687F8FCC159B2B83AAFC02DB625F1F1E3997CCC2FE2CFD11F636558",
        "nonce": "016edba",
        "merchantIdentifier": "C20AFFF8FC4092AB90F781FFA08E5C49434674F64EB2A187A7FE3094EB1C8EF5",
        "domainName": "checkout.develop.bankalliance.ua",
        "displayName": "merchant.aliiancebank.ua",
        "signature": "308006092a864886f70d010702a0803080020101310d300b0609608648016503040201308006092a864886f70d0107010000a080308203e330820388a003020102020816634c8b0e305717300a06082a8648ce3d040302307a312e302c06035504030c254170706c65204170706c69636174696f6e20496e746567726174696f6e204341202d20473331263024060355040b0c1d4170706c652043657274696669636174696f6e20417574686f7269747931133011060355040a0c0a4170706c6520496e632e310b3009060355040613025553301e170d3234303432393137343732375a170d3239303432383137343732365a305f3125302306035504030c1c6563632d736d702d62726f6b65722d7369676e5f5543342d50524f4431143012060355040b0c0b694f532053797374656d7331133011060355040a0c0a4170706c6520496e632e310b30090603550406130255533059301306072a8648ce3d020106082a8648ce3d03010703420004c21577edebd6c7b2218f68dd7090a1218dc7b0bd6f2c283d846095d94af4a5411b83420ed811f3407e83331f1c54c3f7eb3220d6bad5d4eff49289893e7c0f13a38202113082020d300c0603551d130101ff04023000301f0603551d2304183016801423f249c44f93e4ef27e6c4f6286c3fa2bbfd2e4b304506082b0601050507010104393037303506082b060105050730018629687474703a2f2f6f6373702e6170706c652e636f6d2f6f63737030342d6170706c65616963613330323082011d0603551d2004820114308201103082010c06092a864886f7636405013081fe3081c306082b060105050702023081b60c81b352656c69616e6365206f6e207468697320636572746966696361746520627920616e7920706172747920617373756d657320616363657074616e6365206f6620746865207468656e206170706c696361626c65207374616e64617264207465726d7320616e6420636f6e646974696f6e73206f66207573652c20636572746966696361746520706f6c69637920616e642063657274696669636174696f6e2070726163746963652073746174656d656e74732e303606082b06010505070201162a687474703a2f2f7777772e6170706c652e636f6d2f6365727469666963617465617574686f726974792f30340603551d1f042d302b3029a027a0258623687474703a2f2f63726c2e6170706c652e636f6d2f6170706c6561696361332e63726c301d0603551d0e041604149457db6fd57481868989762f7e578507e79b5824300e0603551d0f0101ff040403020780300f06092a864886f76364061d04020500300a06082a8648ce3d0403020349003046022100c6f023cb2614bb303888a162983e1a93f1056f50fa78cdb9ba4ca241cc14e25e022100be3cd0dfd16247f6494475380e9d44c228a10890a3a1dc724b8b4cb8889818bc308202ee30820275a0030201020208496d2fbf3a98da97300a06082a8648ce3d0403023067311b301906035504030c124170706c6520526f6f74204341202d20473331263024060355040b0c1d4170706c652043657274696669636174696f6e20417574686f7269747931133011060355040a0c0a4170706c6520496e632e310b3009060355040613025553301e170d3134303530363233343633305a170d3239303530363233343633305a307a312e302c06035504030c254170706c65204170706c69636174696f6e20496e746567726174696f6e204341202d20473331263024060355040b0c1d4170706c652043657274696669636174696f6e20417574686f7269747931133011060355040a0c0a4170706c6520496e632e310b30090603550406130255533059301306072a8648ce3d020106082a8648ce3d03010703420004f017118419d76485d51a5e25810776e880a2efde7bae4de08dfc4b93e13356d5665b35ae22d097760d224e7bba08fd7617ce88cb76bb6670bec8e82984ff5445a381f73081f4304606082b06010505070101043a3038303606082b06010505073001862a687474703a2f2f6f6373702e6170706c652e636f6d2f6f63737030342d6170706c65726f6f7463616733301d0603551d0e0416041423f249c44f93e4ef27e6c4f6286c3fa2bbfd2e4b300f0603551d130101ff040530030101ff301f0603551d23041830168014bbb0dea15833889aa48a99debebdebafdacb24ab30370603551d1f0430302e302ca02aa0288626687474703a2f2f63726c2e6170706c652e636f6d2f6170706c65726f6f74636167332e63726c300e0603551d0f0101ff0404030201063010060a2a864886f7636406020e04020500300a06082a8648ce3d040302036700306402303acf7283511699b186fb35c356ca62bff417edd90f754da28ebef19c815e42b789f898f79b599f98d5410d8f9de9c2fe0230322dd54421b0a305776c5df3383b9067fd177c2c216d964fc6726982126f54f87a7d1b99cb9b0989216106990f09921d00003182018730820183020101308186307a312e302c06035504030c254170706c65204170706c69636174696f6e20496e746567726174696f6e204341202d20473331263024060355040b0c1d4170706c652043657274696669636174696f6e20417574686f7269747931133011060355040a0c0a4170706c6520496e632e310b3009060355040613025553020816634c8b0e305717300b0609608648016503040201a08193301806092a864886f70d010903310b06092a864886f70d010701301c06092a864886f70d010905310f170d3234303933303132303630355a302806092a864886f70d010934311b3019300b0609608648016503040201a10a06082a8648ce3d040302302f06092a864886f70d010904312204204d17711f18e7059ad3384feba35ac718f0f948cdcce8c32126d4508ef685bf55300a06082a8648ce3d04030204463044022027a6f4b471800884326cb9c69705f3d05ba840086c7ef87b7b11014252e2acd30220539dca31d5847a8db531a210cc49f833a04ce7fd39fa64eb1d5d607384183078000000000000"
    },
    "merchantRequestId": "merchantRequestId_cfc297a1e1e91",
    "applePaySessionId": "f45b099c-38f3-46f9-a989-52818018f557"
}
```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.merchant.alb.ua/en/authorization-2.0/payment-methods-h2h/applepay-encrypted/session-establishment-request-in-apay.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
