{"_id":"5bbf93937ef195000329c63d","project":"57336fd5a6a9c40e00e13a0b","version":{"_id":"5bbf93937ef195000329c63e","project":"57336fd5a6a9c40e00e13a0b","__v":0,"forked_from":"5b8ec56484303f0003a1145f","createdAt":"2018-04-23T14:36:48.535Z","releaseDate":"2018-04-23T14:36:48.535Z","categories":["5bbf93937ef195000329c5f9","5bbf93937ef195000329c5fa","5bbf93937ef195000329c5fb","5bbf93937ef195000329c5fc","5bbf93937ef195000329c5fd","5bbf93937ef195000329c5fe","5bbf93937ef195000329c5ff","5bbf93937ef195000329c600"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"3.27.1 Release","version_clean":"8976.0.0-Basics","version":"8976-Basics"},"category":{"_id":"5bbf93937ef195000329c600","version":"5bbf93937ef195000329c63e","project":"57336fd5a6a9c40e00e13a0b","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-11-03T20:45:01.593Z","from_sync":false,"order":7,"slug":"topics","title":"Guides"},"user":"5b155c2c3fbcd30003e76908","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-09-05T16:19:44.720Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":9,"body":"[Google Pay™](https://developers.google.com/pay/api/) is a simple, secure payment experience allowing shoppers to make [first time](https://developers.bluesnap.com/v8976-JSON/docs/auth-capture) and [recurring purchases](https://developers.bluesnap.com/v8976-JSON/docs/create-subscription) with major credit cards (e.g. Mastercard, Visa, American Express, Discover, etc.) saved to their Google Account, including ones from Google Play, YouTube, Chrome, or an Android device.\n\nIn addition, as a BlueSnap merchant there's no need for BlueSnap to set up your activation with Google Pay, simply sign up for a Google Pay developer account and start using it!\n\nThis guide covers the following topics:\n\n1. [Supported markets](#section-supported-markets)\n2. [Benefits](#section-benefits)\n3. [Implementing Google Pay in your website](#section-implementing-google-pay-in-your-website)\n4. [Implementing Google Pay in your Android app](#section-implementing-google-pay-in-your-android-app)\n5. [Testing in Sandbox](#section-testing-in-sandbox)\n6. [Processing Transactions](#section-processing-transactions)\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Important!\",\n  \"body\": \"Before you get begin development and to learn about Google Pay prerequisites, review those details [here for web interface](https://developers.google.com/pay/api/web/guides/setup) and [here for Android app interface](https://developers.google.com/pay/api/android/guides/setup).\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Supported markets\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Important!\",\n  \"body\": \"By integrating Google Pay, you agree to Google’s terms & conditions. Access [this site](https://payments.developers.google.com/terms/sellertos) for details.\"\n}\n[/block]\n###Supported merchant countries\nMerchants domiciled in the following regions will be able to accept Google Pay: \n* Australia\n* Europe\n* United States (US)\n\n###Issuers supporting Google Pay\nShoppers whose issuing banks are located on [this list](https://pay.google.com/about/banks/) will be eligible to purchase with Google Pay; however, shoppers using *tokenized *cards (cards stored on their Android device) can only use them in a subset of countries and on compatible Android devices.\n\n<br />\n[block:api-header]\n{\n  \"title\": \"Benefits\"\n}\n[/block]\n* **A better way to pay**: Google Pay is a faster, more secure way to pay on sites and in apps using the payment methods saved to a Google Account.\n\n* **Availability**: Google Pay is accepted in millions of places around the world. It's available on Android, iOS, and desktop, and you can use it on multiple browsers, including Chrome, Firefox, and Safari.\n\n* **Increased conversions**: Google Pay delivers frictionless checkout by eliminating the need to type billing and shipping details. Increase conversions by giving shoppers a better way to pay.\n\n* **Increased security**: Google Pay protects your payment info with multiple layers of security, including card network tokenization.\n\n<br />\n<a class=\"btn btn-primary\" href=\"#\" role=\"button\">Back to Top</a>\n[block:api-header]\n{\n  \"title\": \"Implementing Google Pay in your website\"\n}\n[/block]\nWhen shoppers use Google Pay in your website, they simply select an item(s) to purchase, select Google Pay as their payment method, and complete the transaction.\n\n*The shopper experience with Google Pay on the web* \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/987816f-flow_03.PNG\",\n        \"flow_03.PNG\",\n        862,\n        316,\n        \"#cbceca\"\n      ],\n      \"sizing\": \"smart\",\n      \"border\": false\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note:\",\n  \"body\": \"Refer to the [Google Pay brand guidelines](https://developers.google.com/pay/api/web/guides/brand-guidelines) and their [integration checklist](https://developers.google.com/pay/api/web/guides/test-and-deploy/integration-checklist) when referencing their brand within your website.\"\n}\n[/block]\n##Implementation overview\n\nFollow the [implementation instructions](https://developers.google.com/pay/api/web/guides/setup) within the [Tutorial](https://developers.google.com/pay/api/web/guides/tutorial) section, which include creating a Google account and obtaining production access.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Important!\",\n  \"body\": \"Within [Google’s tutorial](https://developers.google.com/pay/api/web/guides/tutorial#tokenization), under “Choose a payment tokenization method,” you must specify **BlueSnap **as your payment gateway and supply your **BlueSnap merchant ID**, as shown in the following example:\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"const tokenizationSpecification = {\\n  type: 'PAYMENT_GATEWAY',\\n  parameters: {\\n    'gateway': 'bluesnap',\\n    'gatewayMerchantId': '<yourBlueSnapMerchantId>'\\n  }\\n};\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note:\",\n  \"body\": \"Your `gatewayMerchantId` is specific for BlueSnap Sandbox and Production. Be sure to use the *correct *merchant ID to avoid processing errors.\"\n}\n[/block]\n###Step 1: Add the Google Pay payment button to your site\nFollow the instructions [here](https://developers.google.com/pay/api/web/guides/tutorial#add-button) to add a Google Pay payment button, which looks like the following:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/7e11261-Google_Pay_button.png\",\n        \"Google_Pay_button.png\",\n        278,\n        71,\n        \"#040404\"\n      ],\n      \"sizing\": \"smart\"\n    }\n  ]\n}\n[/block]\n###Step 2: Create a Google Pay wallet token\nYou must package the response you received from Google Pay as a base-64 encrypted string by performing the following task.\n\nIn your onActivityResult method, the result from the Google-Pay popup displays similar to the following:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"const paymentsClient = getGooglePaymentsClient();\\n  paymentsClient.loadPaymentData(paymentDataRequest)\\n      .then(function(paymentData) {\\n        // handle the response\\n        processPayment(paymentData);\\n      })\\n      .catch(function(err) {\\n        // show error in developer console for debugging\\n        console.error(err);\\n      });\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nYour `processPayment` function will be called, *if *your shopper successfully completed the Google Pay flow. Within it, make sure you encrypt the Google Pay payment data into a payment token, which you will use in the BlueSnap API calls. It should look similar to the following:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"function processPayment(paymentData) {\\n\\n  var paymentToken = b64EncodeUnicode(JSON.stringify(paymentData));\\n  \\n  // :::at:::todo pass paymentToken to your gateway to process payment\\n}\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note:\",\n  \"body\": \"This `paymentToken` should be sent to the BlueSnap API, which is detailed in the [Processing Transactions](#section-processing-transactions) section.\"\n}\n[/block]\n<br />\n<a class=\"btn btn-primary\" href=\"#\" role=\"button\">Back to Top</a>\n[block:api-header]\n{\n  \"title\": \"Implementing Google Pay in your Android app\"\n}\n[/block]\nImplement Google Pay in your Android app using BlueSnap's [Android SDK](doc:android-sdk) to allow shoppers to purchase physical items (such as groceries and clothing) or services (such as gym memberships and hotel reservations).\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note:\",\n  \"body\": \"Your Android app must be approved by Google before it’s available in the Google Play store.\"\n}\n[/block]\nIf you use BlueSnap’s Android SDK for your checkout, you don’t need to do any coding – just register with Google and enable this payment method in the BlueSnap Console!\n\nIf you prefer not to use BlueSnap's Android SDK, you can implement Google Pay in your Android app by following [Google's instructions](https://developers.google.com/pay/api/android/guides/setup).\n\n*The shopper experience with Google Pay in Android apps*\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/673a6f5-Shopper_experience_with_GP_on_Android_app.png\",\n        \"Shopper_experience_with_GP_on_Android_app.png\",\n        786,\n        466,\n        \"#43464b\"\n      ],\n      \"sizing\": \"smart\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note:\",\n  \"body\": \"Refer to the [Google Pay brand guidelines](https://developers.google.com/pay/api/android/guides/brand-guidelines) and their [integration checklist](https://developers.google.com/pay/api/android/guides/test-and-deploy/integration-checklist) when referencing their brand within your Android app.\"\n}\n[/block]\n##Implementation overview\n\nIf you decide to implement Google Pay in your Android app on your own (*without* using BlueSnap's Android SDK), follow the [implementation instructions](https://developers.google.com/pay/api/android/guides/setup) within the [Tutorial](https://developers.google.com/pay/api/android/guides/tutorial) section, which include creating a Google account and obtaining production access.\n\n###Step 1: Add the Google Pay payment button\nFollow the instructions [here](https://developers.google.com/pay/api/android/guides/setup) to add a Google Pay payment button to your app, then supply your BlueSnap merchant ID as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"private static JSONObject getTokenizationSpecification() {\\n  JSONObject tokenizationSpecification = new JSONObject();\\n  tokenizationSpecification.put(\\\"type\\\", \\\"PAYMENT_GATEWAY\\\");\\n  tokenizationSpecification.put(\\n      \\\"parameters\\\",\\n      new JSONObject()\\n          .put(\\\"gateway\\\", \\\"bluesnap\\\")\\n          .put(\\\"gatewayMerchantId\\\", \\\"yourBlueSnapMerchantId\\\"));\\n\\n  return tokenizationSpecification;\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note:\",\n  \"body\": \"Your `gatewayMerchantId` is specific for BlueSnap Sandbox and Production. Be sure to use the *correct *merchant ID to avoid processing errors.\"\n}\n[/block]\n###Step 2: Create a Google Pay wallet token\nYou must package the response you received from Google Pay as a base-64 encrypted string by performing the following task.\n\nIn your `onActivityResult` method where you get the result from the Google-Pay popup, which displays similar to the following:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"switch (requestCode) {\\n    case GOOGLE_PAY_PAYMENT_DATA_REQUEST_CODE: {\\n        switch (resultCode) {\\n            case Activity.RESULT_OK:\\n                PaymentData paymentData = PaymentData.getFromIntent(data);\\n                handleGooglePaySuccess(paymentData);\\n                break;\\n            case Activity.RESULT_CANCELED:\\n                // Nothing to here normally - the user simply cancelled without selecting a\\n                // payment method.\\n                break;\\n            case AutoResolveHelper.RESULT_ERROR:\\n                Status status = AutoResolveHelper.getStatusFromIntent(data);\\n                handleGooglePayError(status.getStatusCode());\\n                break;\\n        }\\n…\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nYour `handleGooglePaySuccess` function will be called, *if *your shopper successfully completed the Google Pay flow. Within it, make sure you encrypt the Google Pay payment data into a payment token, which you will use in BlueSnap API calls. It should look similar to the following:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"String paymentToken = createBlsTokenFromGooglePayPaymentData(paymentData);\\n/**\\n\\t     * Creates a base64 encoded token with the PaymentData\\n\\t     */\\n\\t    public String createBlsTokenFromGooglePayPaymentData(PaymentData paymentData) throws Exception {\\n\\t\\n\\t        final CardInfo cardInfo = paymentData.getCardInfo();\\n\\t\\n\\t        JSONObject result = new JSONObject();\\n\\t\\n\\t        // paymentMethodData\\n\\t        JSONObject paymentMethodData = new JSONObject();\\t\\n\\n\\t        // paymentMethodData -> description: A payment method and method identifier suitable for communication to a shopper in a confirmation screen or purchase receipt.\\n\\t        final String description = cardInfo.getCardDescription();\\n\\t        if (description != null) {\\n\\t            paymentMethodData.put(\\\"description\\\", description);\\n\\t        }\\n\\t\\n\\t        // paymentMethodData -> tokenizationData\\n\\t        final PaymentMethodToken paymentMethodToken = paymentData.getPaymentMethodToken();\\n\\t        JSONObject tokenizationData = new JSONObject();\\n\\t        tokenizationData.put(\\\"type\\\", paymentMethodToken.getPaymentMethodTokenizationType());\\n\\t        tokenizationData.put(\\\"token\\\", paymentMethodToken.getToken());\\n\\t        paymentMethodData.put(\\\"tokenizationData\\\", tokenizationData);\\n\\t\\n\\t        // paymentMethodData -> info\\n\\t        JSONObject info = new JSONObject();\\n\\t        paymentMethodData.put(\\\"info\\\", info);\\n\\t\\n\\t        // paymentMethodData -> info -> cardNetwork\\n\\t        final String cardNetwork = cardInfo.getCardNetwork();\\n\\t        if (cardNetwork != null) {\\n\\t            info.put(\\\"cardNetwork\\\", cardNetwork);\\n\\t        }\\n\\t\\n\\t        // paymentMethodData -> info -> cardDetails\\n\\t        final String cardDetails = cardInfo.getCardDetails();\\n\\t        if (cardDetails != null) {\\n\\t            info.put(\\\"cardDetails\\\", cardDetails);\\n\\t        }\\n\\t\\n\\t        // paymentMethodData -> info -> cardClass (1-3 or 0, should somehow translate to DEBIT/CREDIT)\\n\\t        final int cardClassCode = cardInfo.getCardClass();\\n\\t        String cardClass = null;\\n\\t        if (cardClassCode == WalletConstants.CARD_CLASS_CREDIT) {\\n\\t            cardClass = \\\"CREDIT\\\";\\n\\t        } else if (cardClassCode == WalletConstants.CARD_CLASS_DEBIT) {\\n\\t            cardClass = \\\"DEBIT\\\";\\n\\t        } else if (cardClassCode == WalletConstants.CARD_CLASS_PREPAID) {\\n\\t            cardClass = \\\"PREPAID\\\";\\n\\t        }\\n\\t        if (cardClass != null) {\\n\\t            info.put(\\\"cardClass\\\", cardClass);\\n\\t        }\\n\\t        // paymentMethodData -> info -> billingAddress\\n\\t        final JSONObject billingAddressJson = getUserAddressAsJson(cardInfo.getBillingAddress());\\n\\t        if (billingAddressJson != null) {\\n\\t            info.put(\\\"billingAddress\\\", billingAddressJson);\\n\\t        }\\n\\t\\n\\t        result.put(\\\"paymentMethodData\\\", paymentMethodData);\\n\\t\\n\\t        // email\\n\\t        final String email = paymentData.getEmail();\\n\\t        if (email != null) {\\n\\t            result.put(\\\"email\\\", email);\\n\\t        }\\n\\t\\n\\t        // googleTransactionId - not sure this is the right place in the json for it\\n\\t        final String googleTransactionId = paymentData.getGoogleTransactionId();\\n\\t        if (googleTransactionId != null) {\\n\\t            result.put(\\\"googleTransactionId\\\", googleTransactionId);\\n\\t        }\\n\\t        // shippingAddress\\n\\t        final JSONObject shippingAddressJson = getUserAddressAsJson(paymentData.getShippingAddress());\\n\\t        if (shippingAddressJson != null) {\\n\\t            result.put(\\\"shippingAddress\\\", shippingAddressJson);\\n\\t        }\\n\\t\\n\\t        String tokenForBls = result.toString();\\n\\t        String encodedToken = Base64.encodeToString(tokenForBls.getBytes(), Base64.NO_WRAP | Base64.URL_SAFE);\\n\\t\\n\\t        return encodedToken;\\n\\t    }\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note:\",\n  \"body\": \"This `paymentToken` should be sent to the BlueSnap API, which is detailed in the [Processing Transactions](#section-processing-transactions) section.\"\n}\n[/block]\n<br />\n<a class=\"btn btn-primary\" href=\"#\" role=\"button\">Back to Top</a>\n[block:api-header]\n{\n  \"title\": \"Testing in Sandbox\"\n}\n[/block]\nGoogle Pay does not provide test cards; however, you can use a “live” card within Google’s [test environment](https://developers.google.com/pay/api/web/guides/test-and-deploy/integration-checklist). In a test environment, Google Pay returns a dummy token, which can't be charged.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Notes:\",\n  \"body\": \"* Sandbox supports Google Pay tokens produced by either setting (TEST or PRODUCTION), but BlueSnap's **Production **environment only supports PRODUCTION Google tokens.\\n* While the Google Pay API is available in many markets, *tokenized *cards are only available in a subset of countries and on compatible Android devices. Reference Google’s [integration guide](https://developers.google.com/pay/api/web/guides/test-and-deploy/integration-checklist) before testing tokenized cards.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Processing Transactions\"\n}\n[/block]\nThis section covers how to send the payment token data to BlueSnap to process the transaction using the Payment API or the Extended Payment API.\n<br />\n[block:html]\n{\n  \"html\": \"<ul class=\\\"nav nav-tabs\\\">\\n  <li class=\\\"active\\\"><a data-toggle=\\\"tab\\\" href=\\\"#papiMenu\\\">Payment API</a></li>\\n  <li><a data-toggle=\\\"tab\\\" href=\\\"#extended\\\">Extended Payment API</a></li>\\n</ul>\\n\\n<div class=\\\"tab-content\\\">\\n  <div id=\\\"papiMenu\\\" class=\\\"tab-pane fade in active\\\">\"\n}\n[/block]\n##Processing transactions with the Payment API\n\nYou can *validate *if the Google Pay payment method is activated by viewing this setting in the BlueSnap Merchant Console.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note:\",\n  \"body\": \"Google Pay is *activated *by default.\"\n}\n[/block]\n###Step 1: Validate that the Google Pay payment method is activated \nIn the Merchant Console, access the **Methods of payment settings** box and check if the **Google Pay** option is set to **Show**:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/54f4007-GP_methods_of_payment_settings.png\",\n        \"GP_methods_of_payment_settings.png\",\n        698,\n        237,\n        \"#f6f6f6\"\n      ],\n      \"sizing\": \"smart\"\n    }\n  ]\n}\n[/block]\n###Step 2: Process transactions with the Payment API\nThe payment token data will be sent in the Encoded Payment Token property in the request.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note:\",\n  \"body\": \"The Google Pay token might result in a regular Credit Card or a Tokenized Card (when the card is inserted in the Google Pay app and shoppers use their mobile to do the purchase). The API requests are the same in either case, but the responses might vary.\"\n}\n[/block]\n**Scenario 1: Shopper is new** \nFor sales involving new shoppers, you must include the Encoded Payment Token property (e.g. `encodedPaymentToken` for JSON) in an Auth Only, Auth Capture, or Create Subscription request.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/transactions \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Accept: application/json' \\\\ \\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"cardTransactionType\\\": \\\"AUTH_CAPTURE\\\",\\n    \\\"recurringTransaction\\\": \\\"ECOMMERCE\\\",\\n    \\\"softDescriptor\\\": \\\"DescTest\\\",\\n    \\\"amount\\\": 11.00,\\n    \\\"currency\\\": \\\"USD\\\",\\n    \\\"wallet\\\": {\\n      \\\"walletType\\\": \\\"GOOGLE_PAY\\\",\\n      \\\"encodedPaymentToken\\\": \\\"ImRhdGEiOiJuY1AvRitIUy8zeG5bXhCMFd\\\"\\n    }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Auth Capture request with Google Pay wallet - JSON\"\n    },\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/transactions \\\\\\n-H 'Content-Type: application/xml' \\\\\\n-H 'Accept: application/xml' \\\\ \\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n<card-transaction xmlns=\\\"http://ws.plimus.com\\\">\\n  <card-transaction-type>AUTH_CAPTURE</card-transaction-type>\\n  <recurring-transaction>ECOMMERCE</recurring-transaction>\\n  <soft-descriptor>DescTest</soft-descriptor>\\n  <amount>11.00</amount>\\n  <currency>USD</currency>\\n  <wallet>\\n    <wallet-type>GOOGLE_PAY</wallet-type>\\n    <encoded-payment-token>ImRhdGEiOiJuY1AvRitIUy8zeG5bXhCMFd</encoded-payment-token>\\n  </wallet>\\n</card-transaction>\",\n      \"language\": \"xml\",\n      \"name\": \"Auth Capture request with Google Pay wallet - XML\"\n    }\n  ]\n}\n[/block]\n**Scenario 2: Shopper is returning** \nFor sales involving returning shoppers, you must include the shopper's Vaulted Shopper ID and Encoded Payment Token property in an Auth Only, Auth Capture, or Create Subscription request.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/transactions \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Accept: application/json' \\\\ \\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n   \\\"cardTransactionType\\\": \\\"AUTH_CAPTURE\\\",\\n    \\\"recurringTransaction\\\": \\\"ECOMMERCE\\\",\\n    \\\"softDescriptor\\\": \\\"DescTest\\\",\\n    \\\"amount\\\": 11.00,\\n    \\\"currency\\\": \\\"USD\\\",\\n    \\\"vaultedShopperId\\\": 1234,\\n    \\\"wallet\\\": {\\n      \\\"walletType\\\": \\\"GOOGLE_PAY\\\",\\n      \\\"encodedPaymentToken\\\": \\\"ImRhdGEiOiJuY1AvRitIUy8zeG5bXhCMFd\\\"\\n    }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Auth Capture request with vaulted shopper and Google Pay wallet - JSON\"\n    },\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/transactions \\\\\\n-H 'Content-Type: application/xml' \\\\\\n-H 'Accept: application/xml' \\\\ \\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n<card-transaction xmlns=\\\"http://ws.plimus.com\\\">\\n  <card-transaction-type>AUTH_CAPTURE</card-transaction-type>\\n  <recurring-transaction>ECOMMERCE</recurring-transaction>\\n  <soft-descriptor>DescTest</soft-descriptor>\\n  <amount>11.00</amount>\\n  <currency>USD</currency>\\n  <vaulted-shopper-id>1234</vaulted-shopper-id>\\n  <wallet>\\n    <wallet-type>GOOGLE_PAY</wallet-type>\\n    <encoded-payment-token>ImRhdGEiOiJuY1AvRitIUy8zeG5bXhCMFd</encoded-payment-token>\\n  </wallet>\\n</card-transaction>\",\n      \"language\": \"xml\",\n      \"name\": \"Auth Capture request with vaulted shopper and Google Pay wallet - XML\"\n    }\n  ]\n}\n[/block]\n##For more information:\n[block:html]\n{\n  \"html\": \"<div>\\n  <div class='line'>\"\n}\n[/block]\n####Auth Capture\n[→ JSON](/v8976-JSON/docs/auth-capture)&nbsp;&nbsp;&nbsp;&nbsp;[→ XML](/v8976-XML/docs/auth-capture)\n[block:html]\n{\n  \"html\": \"</div>\\n<div class='line'>\"\n}\n[/block]\n####Auth Only\n[→ JSON](/v8976-JSON/docs/auth-only)&nbsp;&nbsp;&nbsp;&nbsp;[→ XML](/v8976-XML/docs/auth-only)\n[block:html]\n{\n  \"html\": \"</div>\\n<div class='line'>\"\n}\n[/block]\n####Create Subscription \n[→ JSON](/v8976-JSON/docs/create-subscription)&nbsp;&nbsp;&nbsp;&nbsp;[→ XML](/v8976-XML/docs/create-subscription)\n[block:html]\n{\n  \"html\": \"</div>\\n</div>\"\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<style>\\n  .line {\\n    float: left; \\n    width: 25%; \\n  }\\n</style>\\n<div id='clear'>\"\n}\n[/block]\n<br />\n[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Working with subscriptions?\",\n  \"body\": \"Check out BlueSnap's Subscription guide: [→ JSON](/v8976-JSON/docs/subscription-management)&nbsp;&nbsp;&nbsp;[→ XML](/v8976-XML/docs/subscription-management)\"\n}\n[/block]\n<a class=\"btn btn-primary\" href=\"#\" role=\"button\">Back to Top</a>\n[block:html]\n{\n  \"html\": \"</div>\\n<style>\\n#clear {\\n  clear: both; \\n}\\n</style>\"\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \" </div>\\n <div id=\\\"extended\\\" class=\\\"tab-pane fade\\\">\"\n}\n[/block]\n<span></span>\n##Processing transactions with the Extended Payment API\nThe payment token data will be sent in the `encoded-payment-token` property in the request. \n\n###Scenario 1: Shopper is new\nFor sales involving new shoppers, include `encoded-payment-token` in the [Create Order and New Shopper](/v8976-Extended/docs/create-shopper-and-order) or [Create Shopping Context](/v8976-Extended/docs/create-shopping-context) request. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/batch/order-placement \\\\\\n-H 'Content-Type: application/xml' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n<batch-order xmlns=\\\"http://ws.plimus.com\\\">\\n  <order>\\n    <ordering-shopper>\\n      <web-info>\\n        <ip>62.219.121.253</ip>\\n        <remote-host>www.merchant.com</remote-host>\\n        <user-agent>Mozilla/5.0 (Linux; X11)</user-agent>\\n      </web-info>\\n      <wallet>\\n        <wallet-type>GOOGLE_PAY</wallet-type>\\n        <encoded-payment-token>ImRhdGEiOiJuY1AvRitIUy8zeG5bXhCMFd</encoded-payment-token>            \\n      </wallet>\\n    </ordering-shopper>\\n    <cart>\\n      <cart-item>\\n        <sku>\\n          <sku-id>2186654</sku-id>\\n        </sku>\\n        <quantity>1</quantity>\\n      </cart-item>\\n    </cart>\\n    <expected-total-price>\\n      <amount>260.00</amount>\\n      <currency>USD</currency>\\n    </expected-total-price>\\n  </order>\\n</batch-order>\",\n      \"language\": \"xml\",\n      \"name\": null\n    }\n  ]\n}\n[/block]\n###Scenario 2: Shopper is returning \nFor sales involving returning shoppers, include `encoded-payment-token` and `shopper-id` in the [Create Order with Existing Shopper](https://developers.bluesnap.com/v8976-Extended/docs/create-order) or [Create Shopping Context](https://developers.bluesnap.com/v8976-Extended/docs/create-shopping-context) request. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/orders \\\\\\n-H 'Content-Type: application/xml' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n<order xmlns=\\\"http://ws.plimus.com\\\">\\n  <ordering-shopper>\\n    <shopper-id>19575996</shopper-id>\\n    <web-info>\\n      <ip>62.219.121.253</ip>\\n      <remote-host>www.merchant.com</remote-host>\\n      <user-agent>Mozilla/5.0 (Linux; X11)</user-agent>\\n    </web-info>\\n      <wallet>\\n        <wallet-type>GOOGLE_PAY</wallet-type>\\n        <encoded-payment-token>ImRhdGEiOiJuY1AvRitIUy8zeG5bXhCMFd</encoded-payment-token>            \\n      </wallet>\\n  </ordering-shopper>\\n  <cart>\\n    <cart-item>\\n      <sku>\\n        <sku-id>2152762</sku-id>\\n      </sku>\\n      <quantity>1</quantity>\\n    </cart-item>\\n  </cart>\\n  <expected-total-price>\\n    <amount>15.00</amount>\\n    <currency>USD</currency>\\n  </expected-total-price>\\n</order>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Working with subscriptions?\",\n  \"body\": \"Check out our [Subscriptions Guide](/v8976-Extended/docs/subscriptions-guide).\"\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"\\t</div>\\n</div>\"\n}\n[/block]","excerpt":"Learn how to accept Google Pay in your website or Android app.\nIf you still have questions after reading this guide, check out our answers to [common questions](https://support.bluesnap.com/docs/merchant-faqs#section-mobile-wallets).","slug":"google-pay","type":"basic","title":"Google Pay"}

Google Pay

Learn how to accept Google Pay in your website or Android app. If you still have questions after reading this guide, check out our answers to [common questions](https://support.bluesnap.com/docs/merchant-faqs#section-mobile-wallets).

Google Pay™ is a simple, secure payment experience allowing shoppers to make first time and recurring purchases with major credit cards (e.g. Mastercard, Visa, American Express, Discover, etc.) saved to their Google Account, including ones from Google Play, YouTube, Chrome, or an Android device.

In addition, as a BlueSnap merchant there's no need for BlueSnap to set up your activation with Google Pay, simply sign up for a Google Pay developer account and start using it!

This guide covers the following topics:

  1. Supported markets
  2. Benefits
  3. Implementing Google Pay in your website
  4. Implementing Google Pay in your Android app
  5. Testing in Sandbox
  6. Processing Transactions

Important!

Before you get begin development and to learn about Google Pay prerequisites, review those details here for web interface and here for Android app interface.

Supported markets

Important!

By integrating Google Pay, you agree to Google’s terms & conditions. Access this site for details.

Supported merchant countries

Merchants domiciled in the following regions will be able to accept Google Pay:

  • Australia
  • Europe
  • United States (US)

Issuers supporting Google Pay

Shoppers whose issuing banks are located on this list will be eligible to purchase with Google Pay; however, shoppers using tokenized cards (cards stored on their Android device) can only use them in a subset of countries and on compatible Android devices.


Benefits

  • A better way to pay: Google Pay is a faster, more secure way to pay on sites and in apps using the payment methods saved to a Google Account.

  • Availability: Google Pay is accepted in millions of places around the world. It's available on Android, iOS, and desktop, and you can use it on multiple browsers, including Chrome, Firefox, and Safari.

  • Increased conversions: Google Pay delivers frictionless checkout by eliminating the need to type billing and shipping details. Increase conversions by giving shoppers a better way to pay.

  • Increased security: Google Pay protects your payment info with multiple layers of security, including card network tokenization.



Back to Top

Implementing Google Pay in your website

When shoppers use Google Pay in your website, they simply select an item(s) to purchase, select Google Pay as their payment method, and complete the transaction.

The shopper experience with Google Pay on the web

Note:

Refer to the Google Pay brand guidelines and their integration checklist when referencing their brand within your website.

Implementation overview

Follow the implementation instructions within the Tutorial section, which include creating a Google account and obtaining production access.

Important!

Within Google’s tutorial, under “Choose a payment tokenization method,” you must specify BlueSnap as your payment gateway and supply your BlueSnap merchant ID, as shown in the following example:

const tokenizationSpecification = {
  type: 'PAYMENT_GATEWAY',
  parameters: {
    'gateway': 'bluesnap',
    'gatewayMerchantId': '<yourBlueSnapMerchantId>'
  }
};

Note:

Your gatewayMerchantId is specific for BlueSnap Sandbox and Production. Be sure to use the correct merchant ID to avoid processing errors.

Step 1: Add the Google Pay payment button to your site

Follow the instructions here to add a Google Pay payment button, which looks like the following:

Step 2: Create a Google Pay wallet token

You must package the response you received from Google Pay as a base-64 encrypted string by performing the following task.

In your onActivityResult method, the result from the Google-Pay popup displays similar to the following:

const paymentsClient = getGooglePaymentsClient();
  paymentsClient.loadPaymentData(paymentDataRequest)
      .then(function(paymentData) {
        // handle the response
        processPayment(paymentData);
      })
      .catch(function(err) {
        // show error in developer console for debugging
        console.error(err);
      });

Your processPayment function will be called, if your shopper successfully completed the Google Pay flow. Within it, make sure you encrypt the Google Pay payment data into a payment token, which you will use in the BlueSnap API calls. It should look similar to the following:

function processPayment(paymentData) {

  var paymentToken = b64EncodeUnicode(JSON.stringify(paymentData));
  
  // @todo pass paymentToken to your gateway to process payment
}

Note:

This paymentToken should be sent to the BlueSnap API, which is detailed in the Processing Transactions section.

Implementing Google Pay in your Android app

Implement Google Pay in your Android app using BlueSnap's Android SDK to allow shoppers to purchase physical items (such as groceries and clothing) or services (such as gym memberships and hotel reservations).

Note:

Your Android app must be approved by Google before it’s available in the Google Play store.

If you use BlueSnap’s Android SDK for your checkout, you don’t need to do any coding – just register with Google and enable this payment method in the BlueSnap Console!

If you prefer not to use BlueSnap's Android SDK, you can implement Google Pay in your Android app by following Google's instructions.

The shopper experience with Google Pay in Android apps

Note:

Refer to the Google Pay brand guidelines and their integration checklist when referencing their brand within your Android app.

Implementation overview

If you decide to implement Google Pay in your Android app on your own (without using BlueSnap's Android SDK), follow the implementation instructions within the Tutorial section, which include creating a Google account and obtaining production access.

Step 1: Add the Google Pay payment button

Follow the instructions here to add a Google Pay payment button to your app, then supply your BlueSnap merchant ID as follows:

private static JSONObject getTokenizationSpecification() {
  JSONObject tokenizationSpecification = new JSONObject();
  tokenizationSpecification.put("type", "PAYMENT_GATEWAY");
  tokenizationSpecification.put(
      "parameters",
      new JSONObject()
          .put("gateway", "bluesnap")
          .put("gatewayMerchantId", "yourBlueSnapMerchantId"));

  return tokenizationSpecification;
}

Note:

Your gatewayMerchantId is specific for BlueSnap Sandbox and Production. Be sure to use the correct merchant ID to avoid processing errors.

Step 2: Create a Google Pay wallet token

You must package the response you received from Google Pay as a base-64 encrypted string by performing the following task.

In your onActivityResult method where you get the result from the Google-Pay popup, which displays similar to the following:

switch (requestCode) {
    case GOOGLE_PAY_PAYMENT_DATA_REQUEST_CODE: {
        switch (resultCode) {
            case Activity.RESULT_OK:
                PaymentData paymentData = PaymentData.getFromIntent(data);
                handleGooglePaySuccess(paymentData);
                break;
            case Activity.RESULT_CANCELED:
                // Nothing to here normally - the user simply cancelled without selecting a
                // payment method.
                break;
            case AutoResolveHelper.RESULT_ERROR:
                Status status = AutoResolveHelper.getStatusFromIntent(data);
                handleGooglePayError(status.getStatusCode());
                break;
        }

Your handleGooglePaySuccess function will be called, if your shopper successfully completed the Google Pay flow. Within it, make sure you encrypt the Google Pay payment data into a payment token, which you will use in BlueSnap API calls. It should look similar to the following:

String paymentToken = createBlsTokenFromGooglePayPaymentData(paymentData);
/**
	     * Creates a base64 encoded token with the PaymentData
	     */
	    public String createBlsTokenFromGooglePayPaymentData(PaymentData paymentData) throws Exception {
	
	        final CardInfo cardInfo = paymentData.getCardInfo();
	
	        JSONObject result = new JSONObject();
	
	        // paymentMethodData
	        JSONObject paymentMethodData = new JSONObject();	

	        // paymentMethodData -> description: A payment method and method identifier suitable for communication to a shopper in a confirmation screen or purchase receipt.
	        final String description = cardInfo.getCardDescription();
	        if (description != null) {
	            paymentMethodData.put("description", description);
	        }
	
	        // paymentMethodData -> tokenizationData
	        final PaymentMethodToken paymentMethodToken = paymentData.getPaymentMethodToken();
	        JSONObject tokenizationData = new JSONObject();
	        tokenizationData.put("type", paymentMethodToken.getPaymentMethodTokenizationType());
	        tokenizationData.put("token", paymentMethodToken.getToken());
	        paymentMethodData.put("tokenizationData", tokenizationData);
	
	        // paymentMethodData -> info
	        JSONObject info = new JSONObject();
	        paymentMethodData.put("info", info);
	
	        // paymentMethodData -> info -> cardNetwork
	        final String cardNetwork = cardInfo.getCardNetwork();
	        if (cardNetwork != null) {
	            info.put("cardNetwork", cardNetwork);
	        }
	
	        // paymentMethodData -> info -> cardDetails
	        final String cardDetails = cardInfo.getCardDetails();
	        if (cardDetails != null) {
	            info.put("cardDetails", cardDetails);
	        }
	
	        // paymentMethodData -> info -> cardClass (1-3 or 0, should somehow translate to DEBIT/CREDIT)
	        final int cardClassCode = cardInfo.getCardClass();
	        String cardClass = null;
	        if (cardClassCode == WalletConstants.CARD_CLASS_CREDIT) {
	            cardClass = "CREDIT";
	        } else if (cardClassCode == WalletConstants.CARD_CLASS_DEBIT) {
	            cardClass = "DEBIT";
	        } else if (cardClassCode == WalletConstants.CARD_CLASS_PREPAID) {
	            cardClass = "PREPAID";
	        }
	        if (cardClass != null) {
	            info.put("cardClass", cardClass);
	        }
	        // paymentMethodData -> info -> billingAddress
	        final JSONObject billingAddressJson = getUserAddressAsJson(cardInfo.getBillingAddress());
	        if (billingAddressJson != null) {
	            info.put("billingAddress", billingAddressJson);
	        }
	
	        result.put("paymentMethodData", paymentMethodData);
	
	        // email
	        final String email = paymentData.getEmail();
	        if (email != null) {
	            result.put("email", email);
	        }
	
	        // googleTransactionId - not sure this is the right place in the json for it
	        final String googleTransactionId = paymentData.getGoogleTransactionId();
	        if (googleTransactionId != null) {
	            result.put("googleTransactionId", googleTransactionId);
	        }
	        // shippingAddress
	        final JSONObject shippingAddressJson = getUserAddressAsJson(paymentData.getShippingAddress());
	        if (shippingAddressJson != null) {
	            result.put("shippingAddress", shippingAddressJson);
	        }
	
	        String tokenForBls = result.toString();
	        String encodedToken = Base64.encodeToString(tokenForBls.getBytes(), Base64.NO_WRAP | Base64.URL_SAFE);
	
	        return encodedToken;
	    }

Note:

This paymentToken should be sent to the BlueSnap API, which is detailed in the Processing Transactions section.

Testing in Sandbox

Google Pay does not provide test cards; however, you can use a “live” card within Google’s test environment. In a test environment, Google Pay returns a dummy token, which can't be charged.

Notes:

  • Sandbox supports Google Pay tokens produced by either setting (TEST or PRODUCTION), but BlueSnap's Production environment only supports PRODUCTION Google tokens.
  • While the Google Pay API is available in many markets, tokenized cards are only available in a subset of countries and on compatible Android devices. Reference Google’s integration guide before testing tokenized cards.

Processing Transactions

This section covers how to send the payment token data to BlueSnap to process the transaction using the Payment API or the Extended Payment API.

Processing transactions with the Payment API

You can validate if the Google Pay payment method is activated by viewing this setting in the BlueSnap Merchant Console.

Note:

Google Pay is activated by default.

Step 1: Validate that the Google Pay payment method is activated

In the Merchant Console, access the Methods of payment settings box and check if the Google Pay option is set to Show:

Step 2: Process transactions with the Payment API

The payment token data will be sent in the Encoded Payment Token property in the request.

Note:

The Google Pay token might result in a regular Credit Card or a Tokenized Card (when the card is inserted in the Google Pay app and shoppers use their mobile to do the purchase). The API requests are the same in either case, but the responses might vary.

Scenario 1: Shopper is new
For sales involving new shoppers, you must include the Encoded Payment Token property (e.g. encodedPaymentToken for JSON) in an Auth Only, Auth Capture, or Create Subscription request.

curl -v -X POST https://sandbox.bluesnap.com/services/2/transactions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "cardTransactionType": "AUTH_CAPTURE",
    "recurringTransaction": "ECOMMERCE",
    "softDescriptor": "DescTest",
    "amount": 11.00,
    "currency": "USD",
    "wallet": {
      "walletType": "GOOGLE_PAY",
      "encodedPaymentToken": "ImRhdGEiOiJuY1AvRitIUy8zeG5bXhCMFd"
    }
}
curl -v -X POST https://sandbox.bluesnap.com/services/2/transactions \
-H 'Content-Type: application/xml' \
-H 'Accept: application/xml' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
<card-transaction xmlns="http://ws.plimus.com">
  <card-transaction-type>AUTH_CAPTURE</card-transaction-type>
  <recurring-transaction>ECOMMERCE</recurring-transaction>
  <soft-descriptor>DescTest</soft-descriptor>
  <amount>11.00</amount>
  <currency>USD</currency>
  <wallet>
    <wallet-type>GOOGLE_PAY</wallet-type>
    <encoded-payment-token>ImRhdGEiOiJuY1AvRitIUy8zeG5bXhCMFd</encoded-payment-token>
  </wallet>
</card-transaction>

Scenario 2: Shopper is returning
For sales involving returning shoppers, you must include the shopper's Vaulted Shopper ID and Encoded Payment Token property in an Auth Only, Auth Capture, or Create Subscription request.

curl -v -X POST https://sandbox.bluesnap.com/services/2/transactions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
   "cardTransactionType": "AUTH_CAPTURE",
    "recurringTransaction": "ECOMMERCE",
    "softDescriptor": "DescTest",
    "amount": 11.00,
    "currency": "USD",
    "vaultedShopperId": 1234,
    "wallet": {
      "walletType": "GOOGLE_PAY",
      "encodedPaymentToken": "ImRhdGEiOiJuY1AvRitIUy8zeG5bXhCMFd"
    }
}
curl -v -X POST https://sandbox.bluesnap.com/services/2/transactions \
-H 'Content-Type: application/xml' \
-H 'Accept: application/xml' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
<card-transaction xmlns="http://ws.plimus.com">
  <card-transaction-type>AUTH_CAPTURE</card-transaction-type>
  <recurring-transaction>ECOMMERCE</recurring-transaction>
  <soft-descriptor>DescTest</soft-descriptor>
  <amount>11.00</amount>
  <currency>USD</currency>
  <vaulted-shopper-id>1234</vaulted-shopper-id>
  <wallet>
    <wallet-type>GOOGLE_PAY</wallet-type>
    <encoded-payment-token>ImRhdGEiOiJuY1AvRitIUy8zeG5bXhCMFd</encoded-payment-token>
  </wallet>
</card-transaction>

For more information:

Auth Capture

→ JSON    → XML

Auth Only

→ JSON    → XML

Create Subscription

→ JSON    → XML


Working with subscriptions?

Check out BlueSnap's Subscription guide: → JSON   → XML

Processing transactions with the Extended Payment API

The payment token data will be sent in the encoded-payment-token property in the request.

Scenario 1: Shopper is new

For sales involving new shoppers, include encoded-payment-token in the Create Order and New Shopper or Create Shopping Context request.

curl -v -X POST https://sandbox.bluesnap.com/services/2/batch/order-placement \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
<batch-order xmlns="http://ws.plimus.com">
  <order>
    <ordering-shopper>
      <web-info>
        <ip>62.219.121.253</ip>
        <remote-host>www.merchant.com</remote-host>
        <user-agent>Mozilla/5.0 (Linux; X11)</user-agent>
      </web-info>
      <wallet>
        <wallet-type>GOOGLE_PAY</wallet-type>
        <encoded-payment-token>ImRhdGEiOiJuY1AvRitIUy8zeG5bXhCMFd</encoded-payment-token>            
      </wallet>
    </ordering-shopper>
    <cart>
      <cart-item>
        <sku>
          <sku-id>2186654</sku-id>
        </sku>
        <quantity>1</quantity>
      </cart-item>
    </cart>
    <expected-total-price>
      <amount>260.00</amount>
      <currency>USD</currency>
    </expected-total-price>
  </order>
</batch-order>

Scenario 2: Shopper is returning

For sales involving returning shoppers, include encoded-payment-token and shopper-id in the Create Order with Existing Shopper or Create Shopping Context request.

curl -v -X POST https://sandbox.bluesnap.com/services/2/orders \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
<order xmlns="http://ws.plimus.com">
  <ordering-shopper>
    <shopper-id>19575996</shopper-id>
    <web-info>
      <ip>62.219.121.253</ip>
      <remote-host>www.merchant.com</remote-host>
      <user-agent>Mozilla/5.0 (Linux; X11)</user-agent>
    </web-info>
      <wallet>
        <wallet-type>GOOGLE_PAY</wallet-type>
        <encoded-payment-token>ImRhdGEiOiJuY1AvRitIUy8zeG5bXhCMFd</encoded-payment-token>            
      </wallet>
  </ordering-shopper>
  <cart>
    <cart-item>
      <sku>
        <sku-id>2152762</sku-id>
      </sku>
      <quantity>1</quantity>
    </cart-item>
  </cart>
  <expected-total-price>
    <amount>15.00</amount>
    <currency>USD</currency>
  </expected-total-price>
</order>

Working with subscriptions?

Check out our Subscriptions Guide.