#Ender1776 [syndicate]
1 messages ยท Page 1 of 1 (latest)
Hello ๐
For it to fail silently is definitely weird.
What guide are you following for the integration?
https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=custom
main app.js
<StripeProvider
publishableKey="pk_test_..."
urlScheme="oururl" // required for 3D Secure and bank redirects
merchantIdentifier="merchant.com.ourcompany" // required for Apple Pay
>
gradle:
implementation(project(':stripe_stripe-react-native')) { exclude module: 'appcompat' }
server response for payment intent:
{"customer": "cus_****", "ephemeralKey": "ek_test_", "paymentIntent": "pi_", "publishableKey": "pk_test_*****"}
RN screen component (fails with and without customFlow):
const { error, paymentOption } = await initPaymentSheet({
merchantDisplayName: 'Sippd',
customerId: customer,
customerEphemeralKeySecret: ephemeralKey,
paymentIntentClientSecret: paymentIntent,
allowsDelayedPaymentMethods: false,
defaultBillingDetails: {
name: 'Test User'
},
googlePay: {
merchantCountryCode: 'US',
testEnv: true // use test environment
},
customFlow: true
});
that said, is there a way to do this custom, without the payment sheet, and just use our own page to trigger apple/google pay, and display the card field and our own input for address, etc, and submit through the RN SDK, all the online docs use the default stripe payment sheet
have you tried printing
customer, ephemeralKey, paymentIntent
variables before passing intoinitPaymentSheet?
also what happens when you print error variable?
We do have docs on how you can integrate Apple Pay using React Native (without PaymentSheet)
https://stripe.com/docs/apple-pay
For Google Pay, too
https://stripe.com/docs/google-pay
yes, i posted it above, but just removed all the extra characters, but I get back values just fine, and they are the values being passed.
server response for payment intent:
{"customer": "cus", "ephemeralKey": "ektest*", "paymentIntent": "pi_", "publishableKey": "pktest"}
I don't get an error. I do have a log stmt after initPaymentSheet, but it crashes on initPaymentSheet, so it never gets there
and yeah, I've seen the docs for setting up apple and google pay, but thats not really what I'm asking, the docs for RN all assume you are going to use the presentPaymentSheet option, but we'd rather use our own UI for collecting information
๐ If you wrap your call to initPaymentSheet in a try...catch block are you able to catch the exception?
nope, the app is setup with a Sentry error boundary, so it should be catching that stuff, but wrapped a try catch around it just incase to check this and still no error, just crashes to android home
It's really strange that there's no error or detail of any kind. I'm not that familiar with Android; is there some kind of system log you can check for clues?
Is this on an actual device or an emulator?
emulator, still in early dev on this feature
Maybe try spinning up a brand new emulator and see if the results are different? No error of any kind usually means something pretty low-level is not working correctly.
if I was going the custom route, would I still need initPaymentSheet, or is there a way to do this without, and just using confirmPayment at the end, with my payment intent
Using the PaymentSheet is strongly recommended, but if you only want to accept card payments you can use the Card Element only instead: https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=custom
What version of our React Native SDK are you using?
"@stripe/stripe-react-native": "^0.21.0",
Ah, okay, that's pretty recent, so unlikely to be the issue.
If you do go with the custom, non PaymentSheet route you may want to use 0.22.0 which has a new component for Apple Pay and Google Pay. More details here: https://github.com/stripe/stripe-react-native/blob/master/CHANGELOG.md#0220---2022-12-02
However, one other thing to check for the PaymentSheet: what payment_method_types are you setting on the Payment Intent?
const paymentIntent = await stripe.paymentIntents.create({
amount: amount,
currency: 'usd',
customer: customer.id,
automatic_payment_methods: {
enabled: true,
},
}
thanks for the tip on 22.0
Can you try without automatic_payment_methods and see if it makes any difference?
I'm wondering if it might be getting tripped up because you have a payment method enabled which isn't compatible with React Native.
nope, same result, will try v22 with cardfield instead of using payment sheet
Okay. Just out of curiosity, does it crash the same way on iOS?