Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] : presentPaymentSheet() is not opening stripe payment sheet in android #267

Closed
hpvnarola opened this issue May 25, 2021 · 12 comments · Fixed by #276
Closed

[Android] : presentPaymentSheet() is not opening stripe payment sheet in android #267

hpvnarola opened this issue May 25, 2021 · 12 comments · Fixed by #276
Labels
bug Something isn't working P0 Address these issues first

Comments

@hpvnarola
Copy link

Describe the bug
presentPaymentSheet() is not opening the stripe payment sheet in android when passing direct charge payment intent client secret. it's working fine in iOS.

server-side

// Direct charge
const payment_intent = await payment.getPaymentIntent(
    {
        payment_method_types: ['card'],
        amount: parseFloat(amount) * 100,
        currency: 'usd',
        application_fee_amount: tools.calculateApplicationFee(amount),
    }, 
    {
        stripeAccount: user.stripe_connect_id,
    }
);
console.log(payment_intent.client_secret, '------');
return res.status(200).send({
    status: 200,
    message: 'Checkout data fetched successfully.',
    data: {
        paymentIntent: payment_intent.client_secret,
        customer: customer_id,
    }
});

client-side(react-native -> android)

console.log(data);
const { error, paymentOption } = await initPaymentSheet({
    customerId: data.customer,
    paymentIntentClientSecret: data.paymentIntent,
});

const { error, paymentOption } = await presentPaymentSheet({
    clientSecret: data.paymentIntent,
});

Expected behavior
The payment sheet should open in android as well like in IOS.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [macOS 10.15.7 Catalina]
  • Browser [chrome, safari]
  • Version [node: v15.2.1, react-native: 0.63.4, "@stripe/stripe-react-native": "^0.1.2"]

Smartphone (please complete the following information):

  • Device: [Moto G5S]
  • OS: [Android 8.1.0 API 27]
  • Browser [stock browser, safari]
@thorsten-stripe
Copy link
Contributor

Are you setting stripeAccountId to be the same value as user.stripe_connect_id in your StripeProvider component? https://stripe.dev/stripe-react-native/api-reference/interfaces/stripeproviderprops.html#stripeaccountid

@thorsten-stripe thorsten-stripe added the question Further information is requested label May 25, 2021
@hpvnarola
Copy link
Author

Yes, I'm doing the same, I wrapped the children components inside StripeProvider, below you can see the code for the StripeProvider setup.
Below also have attached the video for what happens when invoking stripe payment in android.
It's a live project and we are facing a problem with android please help us with this.

Video link: https://drive.google.com/file/d/1NCW12oiso_InVKEEZ3VU3h3uGJpxK1il/view?usp=sharing

<StripeProvider
    publishableKey={Tools.getStripeKeys().PUBLISHABLE_KEY}
    stripeAccountId={params?.churchDetail?.stripe_connect_id}>
    <View style={styles.container}>
        <KeyboardAwareScrollView
            style={styles.wrapper}
            bounces={false}
            keyboardShouldPersistTaps={'handled'}
            keyboardOpeningTime={Number.MAX_SAFE_INTEGER}
            showsVerticalScrollIndicator={false}>
            <View style={styles.card}>
                <Input
                    placeholder={t('add_donation_plan.amount')}
                    style={[styles.subjectInput, { marginBottom: 0 }]}
                    placeholderColor={Colors.GRAY}
                    value={amount}
                    onChangeText={(text) => {
                        setAmount(text);
                        setAmountError('');
                    }}
                    keyboardType={'numeric'}
                    errorMsg={amountError}
                />
            </View>
            <Button
                label={t(
                    'church_details_profile.donate',
                ).toUpperCase()}
                style={styles.button}
                onPress={onPressDonate}
                isLoading={isLoadingSetupCheckout}
            />
        </KeyboardAwareScrollView>
    </View>
</StripeProvider>

@thorsten-stripe thorsten-stripe added bug Something isn't working P0 Address these issues first and removed question Further information is requested labels May 26, 2021
@thorsten-stripe
Copy link
Contributor

@hpvnarola thank you for reporting this, and sorry for the inconvenience! I've just merged the fix into master and am hoping to release it within v0.1.3 by end of week. If you need it earlier, you can clone down master branch and build the library locally: https://github.com/stripe/stripe-react-native/blob/master/CONTRIBUTING.md#install-library-as-local-repository

@RajeshRRathod
Copy link

RajeshRRathod commented May 31, 2021

I used master branch "@stripe/stripe-react-native": "https://github.com/RajeshRRathod/stripe-react-native#master", in package.json
but still payment sheet dialog open just one second & its close automatic in android
i found error message : {"code":"Failed","message":""}
pls give me any suggestion for this issue, its urgent

@hpvnarola
Copy link
Author

Hi @thorsten-stripe
Thanks for resolving the issue and provide quick support

We are waiting for the latest release with fixes

@NuHunter
Copy link

I ran into the same problem when I used flutter -> presentPaymentSheet() is not opening stripe payment sheet in android

@RONAKDHOLARIYA
Copy link

RONAKDHOLARIYA commented Feb 25, 2022

<StripeProvider merchantIdentifier="merchant.identifier" publishableKey="publishableKey">

Adding merchantIdentifier in my app work fine in adnroid

@Mihai-github
Copy link

Mihai-github commented Sep 15, 2022

Hi, I've run into the same problem after the paymentSheet appeared for the first time if we close it and try to make it occur for the second time we have no error but it won't appear and we have no idea how to debug this issue at least...

Maybe someone has any idea?

@arslanafzal077
Copy link

arslanafzal077 commented Sep 18, 2022

payment sheet dialog open with loading for just one second & its close automatic in ios simulator..and after that i'm unable to use my app .i have to run again from xcode to use the app

@mannu2saini
Copy link

mannu2saini commented Feb 3, 2023

I have same issue presentPaymentSheet is not appearing on android device.In the previous version merchantDisplayName was not there .So update
 stripe-react-native version 0.23.1 and pass merchantDisplayName in initPaymentSheet after that it works for me.

  const {error}  = initPaymentSheet({
      merchantDisplayName:appConstant.userName,
      customerId: this.state.customerId,
      customerEphemeralKeySecret: this.state.ephemeralKey,
      paymentIntentClientSecret: this.state.clientSecretkey,
    })

@saad9624-tribalScale
Copy link

Just add merchantDisplayName under initPaymentSheet , it will open the modal in android.

@ankitk-nimblechapps
Copy link

Screenshot_2023-02-06-13-29-59-94_a40c374f801420dce36ea483382aa15e
while calling initpaymentSheet method app crashed with these error in android, please help me with these issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P0 Address these issues first
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants