tipsi-stripe icon indicating copy to clipboard operation
tipsi-stripe copied to clipboard

save card for future usage without payment

Open prox2 opened this issue 3 years ago • 4 comments

Before I have submitted the issue

[ ] I have read an installation guide
[ ] I know that for an iOS I need to install pods because I've read the installation guide
[ ] I have read a linking guide and checked that everything is OK like in manual linking guide
[ ] I know that before using tipsi-stripe I need to set options for my app as described in usage guide

The problem

I am trying to add card without payment for future usage, but as showing in example, is to add card during payment of the order . i have tried the fowling (stripe.confirmSetupIntent) after retrieve the client secret from backend

// this will open card from to retrieve the data and pass it with `confirmSetupIntent` method
const token = await stripe.paymentRequestWithCardForm({
            smsAutofillDisabled: true,
            requiredBillingAddressFields: 'full',
            prefilledInformation: {
                billingAddress: {
                    name: "myname",
                    line1: "streetname",
                    line2: '',
                    city: "city",
                    state: "state",
                    country: 'MY',
                    postalCode: "postalcode",
                    email: "[email protected]",
                },
            },
        })
// here the `confirmSetupIntent` method
 try {
            const result = await stripe.confirmSetupIntent({
                clientSecret,
                token
            })
            console.log('Result', result)
            if (result.status == 'succeeded') {
                setLoading(false)
                Alert.alert('card added')
            }

        } catch (error) {
            setLoading(false)
            console.log('PaymentIntent Error', error)
        } 

But awlays end up with this error : Exception in native call from JS I am spending till 3 days trying to figure it out, and all what i found is so confusing and there is no clear documentation, i hope can someone give me idea of the basic implement of saving cards for future usage without do payment.

Environment

  • tipsi-stripe version: 9.0.0
  • Last tipsi-stripe version where the issue was not reproduced (if applicable): N/A
  • iOS or Android: Android
  • OS version: windows version 2004
  • React-Native version: "react": "16.13.1", "react-native": "0.63.4",
  • (Android only) com.google.firebase:firebase-core version: The Firebase Android library firebase-core is no longer needed based on firebase documentation so i don't have installed version in my app

Links to logs and sources

For Android, please provide the following sections from android/app/build.gradle: buildToolsVersion = "29.0.2" minSdkVersion = 21 compileSdkVersion = 29 targetSdkVersion = 29

Screenshots, GIFs (Must to have)

Screenshot_20210429-094430

prox2 avatar Apr 29 '21 01:04 prox2

In java code, they are expecting paymentMethod or paymentMethodId, clientSecret parameters, which might be not in document after adding paymentMethodId my code is working

sandipgupta55 avatar Apr 30 '21 05:04 sandipgupta55

@sandipgupta55 thank you for replying , could you please show me sample code

prox2 avatar Apr 30 '21 07:04 prox2

@sandipgupta55 thank you for replying , could you please show me sample code

const result = await stripe.confirmSetupIntent({ clientSecret: 'seti_xxxxxxxxxxxxxxx', paymentMethodId: 'pm_xxxxxxxxxxxx', });

sandipgupta55 avatar Apr 30 '21 07:04 sandipgupta55

@sandipgupta55 oh I see alright I will try that

prox2 avatar Apr 30 '21 07:04 prox2

Closing this ticket, so that new users don't think this project is still active.

Stripe does not want you using this, and you will find pain if you do; Please migrate to the official @stripe/stripe-react-native package, for your user's safety, and your developer's sanity!

See more:

  • https://github.com/tipsi/tipsi-stripe/issues/779
  • https://github.com/tipsi/tipsi-stripe/issues/842

fbartho avatar Jun 20 '23 20:06 fbartho