#prateek_api

1 messages ¡ Page 1 of 1 (latest)

feral pierBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1280464897519386675

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

delicate lark
#

Do you have a valid/real card in your Google Wallet on the device you are testing with ?

covert valve
#

Yes, when our client tested it from USA; then they also added their card to the wallet.

brisk light
covert valve
#

We have tried 3 different ways:-

  1. By displaying all the available payment methods which are active from the dashboard within the payment sheet. By following this video from stipe's official YouTube Channel: https://youtu.be/uK7W5x_8gbg?si=ZlMHUhfQMeMuPYY3
  2. We followed this documentation for directly paying through Gpay: https://docs.stripe.com/payments/accept-a-payment?platform=react-native&ui=payment-sheet
  3. Displaying Stripe Checkout page in WebView: https://docs.stripe.com/payments/accept-a-payment?platform=web
brisk light
#

well let's focus on one of those approaches, which do you want to use?

#

I will say I don't think option 3 works, Google Pay doesn't support WebViews.
So really it's just option 1(PlatformPay integration) or 2(PaymentSheet)

covert valve
#

Okay, then lets try with Option 1

brisk light
covert valve
#

Yes, we have added these lines in the XML file. Can we connect on a google meet if possible?

brisk light
#

it's not possible

covert valve
#

okay, no problem. We are using stripe-react-native version 0.35.1

brisk light
#

thanks, and question 2?

covert valve
#

okay, will provide you the code. Just a minute

#

const res = await isPlatformPaySupported({ googlePay: { testEnv: true } })
console.log('res isPlatformPaySupported: ', JSON.stringify(res))
if (!res) {
handleShowToast({
status: SNACKBAR_TYPE.error,
description: 'Google pay is not supported'
})
} else {
const data = { packageId, paymentMethod: 'card' }
try {
const res = await processStripePayment(data)
console.log('res in process stripe payment: ', JSON.stringify(res))
console.log('client_Secret: ', res?.data?.data?.paymentIntent?.client_secret)
const { error } = await confirmPlatformPayPayment(
res?.data?.data?.paymentIntent?.client_secret,
{
googlePay: {
testEnv: true,
merchantName: 'Los Tres Reyes',
merchantCountryCode: 'US',
currencyCode: 'USD',
billingAddressConfig: {
format: PlatformPay.BillingAddressFormat.Full,
isPhoneNumberRequired: true,
isRequired: true
}
}
}
)

      if (error) {
        handleShowToast({
          status: SNACKBAR_TYPE.error,
          description: `${error.code}, ${error.message}`
        })
      } else {
        handleShowToast({
          status: SNACKBAR_TYPE.success,
          description: 'Payment confirmed successfully'
        })
      }
    } catch (err) {
      console.log('error occurred while payment: ', err)
    }
  }
#

isPlatformPaySupported is returning false

brisk light
#

hmm. Should just work. Can you test on other devices/users?

covert valve
#

I have tested it in 4 devices. Faced same issue in all the cases

brisk light
#

hmm. Well the next step is to provide enough code for a minimal-reproduction app project that we can run ourselves

#

note if you're in India it will never work

#

so when I say test it on other devices, I mean test on multiple devices in the US/Europe etc

covert valve
#

okay, 2 of the tested devices were in US and Australia. Just a small doubt, if a person has not added card in their wallet, then the payment sheet will not even show the option of Gpay?

brisk light
#

as far as I know yes; part of isPlatformPaySupported is checking that there is a card in the wallet as well

covert valve
#

Okay

#

Btw, should it work if I try to test it from India and use a VPN after adding card in the gpay wallet?

brisk light
feral pierBOT
covert valve
#

okay