Shopify / mobile-buy-sdk-android

Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using their credit card.
MIT License
216 stars 136 forks source link

Google Pay private app integration #664

Open grepx opened 4 years ago

grepx commented 4 years ago

Hi, I've been trying to add a native Google Pay integration running on a private Shopify Plus app following the instructions given in various places across this repository, the issue tracker, and the sample app. As mentioned here I have successfully gotten hold of a Google Pay token by using Shopify as my gateway. The SHOP ID was set to the ID for the shop as returned on the shops.json endpoint of the Admin API. This is in spite of Shopify not being listed on the full list of Google Pay gateways here but I've sent a request to Google for more information on that point.

I then attempt to attach the Google Pay payment data/token to the checkout as instructed here but using the V2 (checkoutCompleteWithTokenizedPaymentV2) of this endpoint located in the Storefront API. I do not know what to set the paymentToken.publicKeyHash to since the instructions are vague on this point. If I don't set it then it causes the payment processing to fail (which is understandable).

I have also trawled through the sample app project and have seen evidence that it once supported Android Pay but everything has been commented out.

We already have Google Pay up and running on the web checkout. We also have a successful native app Apple Pay integration with this private app and have seen conversion rate increases on the iOS app that we need to be able to recreate on the Android app. Please could somebody on the team provide any guidance possible about whether this SDK supports native checkout using Google Pay with a private app and the steps to integrate it.

rushabh13 commented 4 years ago

Hi,

I have integrated Google Pay with the help of Shopify SDK, But getting "this merchant is not enabled for googlepay" on production environment. (My Client has already made the Shopify Shop live, So I have only option to test in the Production environment).

Maybe I have to make a request for production access from the Google Pay team which is mentioned here, but the issue is, By which credential should I do login process, as while enabling the Google Pay, Shopify team doesn't ask me or give me the credential for Google Pay related checkout. They have just the tickbox option to enable it inside the ACCELERATED CHECKOUTS section(Yes, I have enabled the Google Pay option inside my Shopify shop)

grepx commented 4 years ago

Hi @rushabh13, In your Google Pay Payment Request did you set the tokenization specification like this?

"tokenizationSpecification":{
            "type":"PAYMENT_GATEWAY",
            "parameters":{
               "gateway":"shopify",
               "gatewayMerchantId":"[[SHOPIFY_SHOP_ID]]"
            }
         }
rushabh13 commented 4 years ago

Hi @grepx, Yes I have done the same.

I can open the Google Pay dialog in the Test environment and getting the "This merchant is not enabled for Google Pay" error in the Production environment.

rushabh13 commented 4 years ago

@grepx, Also, Someone on Stackoverflow, mentioned that I have to whitelist my SHA1 key inside the Google Play Console, but there is no any fields inside the Google Play Console where I could whitelist my SHA1 key.

Note: I have uploaded my apk on play store and from there I am getting the 405 error code.

Maragues commented 4 years ago

@grepx @rushabh13 Would you be kind enough to share some gists with the checkout tokenized request? I'm at the point were I have the Google Pay token, but then there's no documentation on Shopify's side

I've manually created a Checkout, and my assumption is I need to add shipping & handler details, etc. It'd be much easier with an example.

Thank you very much!

vixdug commented 4 years ago

Hi @Maragues @grepx

Please see my comment here and let me know if any issues arise: https://github.com/Shopify/mobile-buy-sdk-android/issues/665#issuecomment-676587934

Kaszmir commented 3 years ago

Hello, @grepx @Maragues did you implement Google Pay payment as a gateway to your android app or you gave up? I have a similar problem to you:

Business Profile on Google console was ​created and verified, I'm able to show Google Pay popup and create a payment request to Google, I'm receiving the token object from Google and sending it to Shopify using the checkoutCompleteWithTokenizedPaymentV3 mutation query. This action returns success and then I'm trying to get the Payment object when it'll be ready. During getting the payment object I'm getting an error: "There was an issue processing your payment. Try again or use a different payment method."

No info about what exactly should be sent in the TokenizedPaymentInputV3 object in the paymentData field. I don't know that should be all String from the token field from Google's response or only a specific field? And what should be sent as an identifier field?

When I set the value of the test field on true the payment is proceeding correctly, the problem occurs only when I want to make a real transaction.

cc @vixdug

Maragues commented 3 years ago

We gave up, which is pretty sad and disappointing.

Akash-Manjhi commented 3 years ago

@Kaszmir I have given test true but I am facing this issue - "There was an issue processing your payment. Try again or use a different payment method". Storefront.TokenizedPaymentInputV3 input = new Storefront.TokenizedPaymentInputV3(moneyInput, idempotencyKey, checkoutData.getShippingAddressInput(), checkoutData.getPaymentData(), Storefront.PaymentTokenType.GOOGLE_PAY).setTest(true);

I am passing in paymentData the json which I receive after payment in Google Pay. Payment is successful from google pay but during polling for checkout completion I receive the payment data but order is null with error message: "There was an issue processing your payment. Try again or use a different payment method". Anyone have any Idea?