# Google Pay and Apple Pay 0 level payments # Google Pay ## Introduction As part of the integration, it is possible to initiate Google Pay payments via imoje within a widget on the shop summary page, without having to go to the imoje gateway page. ## Configuration data To implement the Google Pay widget on your website, follow the instructions in the **[Google Pay API](https://developers.google.com/pay/api/web/guides/tutorial)** documentation. In **[`tokenisationSpecification`](https://developers.google.com/pay/api/web/guides/tutorial#tokenization)**, use `imoje` as the `gateway` value and your imoje shop ID as the `gatewayMerchantId` value. >NOTE! To obtain `merchantName` and `merchantId` for the **[`paymentDataRequest.merchantInfo`](https://developers.google.com/pay/api/web/guides/tutorial#paymentdatarequest)** object in the production environment, you must first obtain ** [production access](https://developers.google.com/pay/api/android/guides/test-and-deploy/request-prod-access)** within your **[Google Pay Business Console](https://pay.google.com/business/console)**. ## Creating a Google Pay transaction in imoje After successfully initialising the Google Pay widget, you will receive a `PaymentMethodData` object in return, which will contain, among other things, a `tokenisationData` object. To create a Google Pay transaction in imoje, you will need the value from the `token` parameter in the `tokenisationData` object, which you must pass in the appropriate parameters. ### Example of a Google Pay API response ```json { "type": "CARD", "description": "Visa••••1234", "info": { "cardNetwork": "VISA", "cardDetails": "1234" }, "tokenizationData": { "type": "PAYMENT_GATEWAY", "token": "examplePaymentMethodToken" } } ``` ### Making a request to imoje To create a request that generates a [transaction](https://bump.sh/pgw/doc/imoje-api-en/group/endpoint-transaction), you must add a [`wallet`](https://bump.sh/pgw/doc/imoje-api-en/operation/operation-post-parameter-transaction#operation-post-parameter-transaction-body-application-json-wallet) and [`additionalData`](https://bump.sh/pgw/doc/imoje-api-en/operation/operation-post-parameter-transaction#operation-post-parameter-transaction-body-application-json-additionalData). ### Example of the BODY of a request to imoje ```json { "type": "sale", "serviceId": "yourServiceId", "amount": 1000, "currency": "PLN", "orderId": "yourOrderId", "customer": { "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com" }, "successReturnUrl": "https://yourshopname.com/success", "failureReturnUrl": "https://yourshopname.com/failure", "paymentMethod": "wallet", "paymentMethodCode": "gpay", "wallet": { "signature": "signature", "protocolVersion": "protocolVersion", "signedMessage": "signedMessage" }, "additionalData": { "browser": { "ip": "127.0.0.1", "language": "pl-PL", "jsEnabled": true, "timezoneOffset": 100, "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36", "accept": "application/json, text/javascript, */*; q=0.01", "javaEnabled": false, "screenColorDepth": 24, "screenHeight": 1080, "screenWidth": 2560 } } } ``` ### Response to request The response to the request has a standard form and contains useful information about the transaction. Depending on the Payer's card issuer, 3DSecure authorisation may be required for the transaction. In this case, if the `action` object is returned with the `url` parameter, the Payer should be redirected to the provided address to enable 3DSecure authorisation. After successful authorisation, the Payer will be automatically redirected to the page specified in the `successReturnUrl` parameter. If the `action` object is not returned or does not contain the `url` parameter, redirect the Payer to the page with `successReturnUrl` or another page of your choice for the order placement process. # Apple Pay ## Introduction Integration allows you to initialise imoje transactions as part of Apple Pay payments using the Apple Pay API directly on your shop's website or in your mobile application. ## Getting started Before integrating Apple Pay payments on your website or mobile application, you will need an **[Apple Development Account](https://developer.apple.com/)**. You will also need to apply to join the **[Apple Developer Programme](https://developer.apple.com/programs/)**. Then follow the guidelines in the **[Apple Pay documentation](https://developer.apple.com/help/account/)**. ## Configuration In order for payments to work properly, you need to configure your settings correctly. General guidelines for configuring Apple Pay can be found **[here](https://developer.apple.com/help/account/capabilities/configure-apple-pay). Guidelines for configuring Apple Pay on your website can be found **[here](https://developer.apple.com/help/account/capabilities/configure-apple-pay-on-the-web)**. ## Payment Processing Certificate One of the configuration steps is to create a **[Payment Processing Certificate](https://developer.apple.com/help/account/capabilities/configure-apple-pay#create-a-payment-processing-certificate)**. To do this, you will need the appropriate CSR file, which you can obtain by contacting us at kontakt.tech@imoje.pl. Then, send the generated certificate (**apple_pay.cer** file) to us at kontakt.tech@imoje.pl. ## Integration ### Integration in a mobile application To integrate Apple Pay payments into your mobile application, follow the guidelines in the **[Apple Pay](https://developer.apple.com/documentation/passkit/apple-pay)** documentation. ### Integration on a website To integrate Apple Pay payments on your website, follow the guidelines in the **[Apple Pay on the Web](https://developer.apple.com/documentation/applepayontheweb)** documentation. Please note that for **[Apple Pay on the Web](https://developer.apple.com/help/account/capabilities/configure-apple-pay-on-the-web)** payments, you must also ** [register and validate your website](https://developer.apple.com/help/account/capabilities/configure-apple-pay-on-the-web#register-a-merchant-domain)**, as well as create a ** [Merchant identity certificate](https://developer.apple.com/help/account/capabilities/configure-apple-pay-on-the-web#create-a-merchant-identity-certificate)**. ## Creating an Apple Pay transaction in imoje In order to create an Apple Pay transaction in imoje that will charge the card used by the Payer within Apple Pay, you must send a request creating a [transaction](https://bump.sh/pgw/doc/imoje-api-en/group/endpoint-transaction). In the BODY of the request, it is necessary to include the [`additionalData`](https://bump.sh/pgw/doc/imoje-api-en/operation/operation-post-parameter-transaction#operation-post-parameter-transaction-body-application-json-additionaldata) object and the [wallet](https://bump.sh/pgw/doc/imoje-api-en/operation/operation-post-parameter-transaction#operation-post-parameter-transaction-body-application-json-wallet) object and, within it, the [`paymentData`](https://bump.sh/pgw/doc/imoje-api-en/operation/operation-post-parameter-transaction#operation-post-parameter-transaction-body-application-json-wallet-paymentdata). The `paymentData` object should contain the values received in the **Apple Pay Token**. ### Example of Apple Pay Token content ```json { "version": "EC_v1", "data": "DjI8Ez7nPhVo742aGEzABz/TfxCPt9LSdf2/h+0xIgVJbi3fQqd4lv3ogoTI3SQ7vZrDAWI8g2lbd5sflXBHc0z+wSeybsCcqZB3n1edRFXU7+6DYmdhFFWWCejwUc6XZWmsSaVNEQf+Kc0SeYrj8Eskdapj8bYX/QXxXSPqS4IKSjB+f3O0gUXSq7LK/jA9dl+BbWW0l3gXERU6n5rcYndO5rnjiwNUpnm7EMIMfNU+IPbsubpL82kbL2MdMJB1grel03J4JKld6G0pFSmjR2mF/xBY/yKkADRhoQkVlDRicuKVMpdRXXbIQjw/yRkLv/u8iy1wXI5YmEBB+W4QpPYsuxys94gMPaK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BysFpZ8=", "transactionId": "aa0b77fbb4f64cd3e5deef65177938b2d836e0d7d93d58000d8d54cfca19ae13" } } ``` ### Example of a BODY request to imoje ```json { "type": "sale", "serviceId": "yourServiceId", "amount": 1000, "currency": "PLN", "orderId": "yourOrderId", "customer": { "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com" }, "successReturnUrl": "https://yourshopname.com/success", "failureReturnUrl": "https://yourshopname.com/failure", "paymentMethod": "wallet", "paymentMethodCode": "applepay", "wallet": { "paymentData": { "version": "version", "data": "data", "signature": "signature", "header": { "ephemeralPublicKey": "ephemeralPublicKey", "publicKeyHash": "publicKeyHash", "transactionId": "transactionId" } } }, "additionalData": { "browser": { "ip": "127.0.0.1", "language": "pl-PL", "jsEnabled": true, "timezoneOffset": 100, "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36", "accept": "application/json, text/javascript, */*; q=0.01", "javaEnabled": false, "screenColorDepth": 24, "screenHeight": 1080, "screenWidth": 2560 } } } ``` ### Response to request The response to the request has a standard form and contains information about the transaction. Depending on the Payer's card issuer, 3DSecure authorisation may be required for the transaction. In this case, if the `action` object is returned with the `url` parameter, the Payer should be redirected to the address provided in order to enable 3DSecure authorisation. After successful authorisation, the Payer will be automatically redirected to the page specified in the `successReturnUrl` parameter. If the `action` object is not returned or does not contain the `url` parameter, the Payer should be redirected to the page with `successReturnUrl` or another page of your choice for the order placement process.