{"info":{"_postman_id":"8b7d7a01-9257-4d22-b9df-68cd0e15ed8f","name":"Mobile payments (Google Pay)","description":"<html><head></head><body><h2 id=\"google™-pay\">Google™ Pay</h2>\n<h4 id=\"prerequisite\">Prerequisite:</h4>\n<p>The merchant must be successfully onboarded to MPPGv4/v3 and have access to the <code>ProcessGooglePay</code> operation.</p>\n<h4 id=\"purpose-of-the-document\">Purpose of the document:</h4>\n<p>The purpose of this document is to guide merchants and developers in integrating Google Pay functionality through Magensa Payment Protection Gateway (MPPG v4/3).</p>\n<h2 id=\"table-of-contents\">Table of Contents</h2>\n<ul>\n<li><p>1 Google Pay In-App Payments</p>\n<ul>\n<li><p>1.1 Introduction</p>\n</li>\n<li><p>1.2 How It Works</p>\n</li>\n<li><p>1.3 Set Up</p>\n</li>\n<li><p>1.4 Register a Business Profile</p>\n</li>\n<li><p>1.5 Development Steps</p>\n</li>\n<li><p>1.6 Sharing Token Through Email</p>\n</li>\n</ul>\n</li>\n<li><p>Appendix</p>\n</li>\n</ul>\n<h2 id=\"1-google-pay-in-app-payments\">1 Google Pay In-App Payments</h2>\n<h3 id=\"11-introduction\">1.1 Introduction</h3>\n<p>Magensa Web Services provides a wide variety of payment options, including InApp payments, subscriptions, rewards, and loyalty programs.</p>\n<p>Google Pay (stylized as G Pay; formerly Android Pay) is a digital wallet platform and online payment system developed by Google to power InApp, online, and in-person contactless purchases on mobile devices, enabling users to make payments with Android phones, tablets, or watches. In addition to this, the service also supports passes such as coupons, boarding passes, campus ID cards, car keys, event tickets, movie tickets, public transportation tickets, store cards, and loyalty cards.</p>\n<h3 id=\"12-how-it-works\">1.2 How It Works</h3>\n<p>When a user taps the Google Pay payment button, they see a payment sheet that displays the payment methods saved to their Google Account, as well as optional fields such as a shipping address field. Users can quickly select a payment method, add an optional shipping address, or add new information.</p>\n<p>The payment flow is as follows:</p>\n<ol>\n<li><p>The user taps the Google Pay payment button and sees a payment sheet with a list of supported payment methods.</p>\n</li>\n<li><p>The user selects a payment method and Google Pay securely returns a payment token for that method to your app.</p>\n</li>\n<li><p>Your app submits the payment token, along with details about the purchase, to its backend.</p>\n</li>\n<li><p>To execute the payment, the backend processes the purchase and sends the payment token to the payment service provider.</p>\n</li>\n</ol>\n<h3 id=\"13-set-up\">1.3 Set Up</h3>\n<p>Follow the steps below to set up Google Pay.</p>\n<h3 id=\"14-register-a-business-profile\">1.4 Register a Business Profile</h3>\n<p>When merchants set up a payments profile, Google assigns it a unique numeric code called a Merchant ID. You cannot change this number. If you ever contact Google support, we'll ask you to give your Merchant ID.</p>\n<p>To find your Merchant ID follow these steps:</p>\n<ol>\n<li><p>Sign in to your payments profile.</p>\n</li>\n<li><p>At the top, click Settings.</p>\n</li>\n<li><p>Find 'Public merchant profile', then find your merchant ID.</p>\n</li>\n</ol>\n<img src=\"https://content.pstmn.io/3c585e47-a0de-487d-b54f-95daf84896fd/MS40LnBuZw==\">\n\n<h3 id=\"15-development-steps\">1.5 Development Steps</h3>\n<ul>\n<li><p>Step 1: Define your Google Pay API version.</p>\n</li>\n<li><p>Step 2: Request a payment token for your payment provider.</p>\n</li>\n<li><p>Step 3: Define supported payment card networks.</p>\n</li>\n<li><p>Step 4: Describe your allowed payment methods.</p>\n</li>\n<li><p>Step 5: Create a PaymentsClient instance.</p>\n</li>\n<li><p>Step 6: Determine readiness to pay with the Google Pay API.</p>\n</li>\n<li><p>Step 7: Create a PaymentDataRequest object.</p>\n</li>\n<li><p>Step 8: Register event handler for user gesture.</p>\n</li>\n<li><p>Step 9: Handle the response object.</p>\n</li>\n</ul>\n<p>Creating Payment Data Request</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-javascript\">fun getPaymentDataRequest(price: String): JSONObject ? {\n    try {\n        return JSONObject(baseRequest.toString())._apply_ {\n            put(\"allowedPaymentMethods\", JSONArray().put(cardPaymentMethod())) put(\"transactionInfo\", getTransactionInfo(price)) put(\"merchantInfo\", merchantInfo)\n            val shippingAddressParameters = JSONObject()._apply_ {\n                put(\"phoneNumberRequired\", false) put(\"allowedCountryCodes\", JSONArray(Constants.SHIPPING_SUPPORTED_COUNTRIES))\n            }\n            put(\"shippingAddressRequired\", true) put(\"shippingAddressParameters\", shippingAddressParameters)\n        }\n    } catch (e: JSONException) {\n        return null\n    }\n}\nprivate fun cardPaymentMethod(): JSONObject {\n    val cardPaymentMethod = baseCardPaymentMethod() cardPaymentMethod.put(\"tokenizationSpecification\", directTokenizationSpecification())\n    return cardPaymentMethod\n}\n\n</code></pre>\n<p>Handling Google payment token response:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-javascript\">private fun handlePaymentSuccess(paymentData: PaymentData) {\n        val paymentInformation = paymentData.toJson() ? : return\n        try {\n            // Token will be null if PaymentDataRequest was not constructed using fromJson(String).\n            val paymentMethodData = JSONObject(paymentInformation).getJSONObject(\"paymentMethodData\")\n            // If the gateway is set to \"example\", no payment information is returned - instead, the\n            // token will only consist of \"examplePaymentMethodToken\".\n            val tokenData = JSONObject(paymentMethodData\n                .getJSONObject(\"tokenizationData\")\n                .getString(\"token\"))\n            val signedObject = JSONObject(tokenData.getString(\"signedMessage\"))\n        }\n\n</code></pre>\n<h3 id=\"16-sharing-token-through-email\">1.6 Sharing Token Through Email</h3>\n<p>From Android app sharing gpay token through email.</p>\n<img src=\"https://content.pstmn.io/6d90e42d-a5ef-4bb9-ba57-ec2ac3058567/MS42LnBuZw==\">\n\n<h3 id=\"appendix\">Appendix</h3>\n<ul>\n<li>This model is designed to be implemented with a single merchant account; for other use cases, please contact MagTek.</li>\n</ul>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"33729815","collectionId":"8b7d7a01-9257-4d22-b9df-68cd0e15ed8f","publishedId":"2sAYdkJVEw","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2025-03-05T16:24:03.000Z"},"item":[]}