#ScreamZ-Q

1 messages ยท Page 1 of 1 (latest)

steel inlet
#

๐Ÿ‘‹ happy to help

#

are you using Payment Intents

violet acorn
#

hello

#

I share you some code

#
 initPaymentSheet({
          setupIntentClientSecret: client_secret,
          merchantDisplayName: t("app"),
          // @ts-ignore // !!! See https://github.com/stripe/stripe-react-native/issues/945
          merchantIdentifier: Config.STRIPE.MERCHANT_IDENTIFIER,

          applePay: Config.STRIPE.ENABLE_APPLE_PAY
            ? {
                merchantCountryCode: "FR",
                paymentSummaryItems: [
                  {
                    label: "Caution Stride",
                    paymentType: "Immediate",
                    amount: "35",
                    isPending: false,
                  },
                ],
              }
            : undefined,
          googlePay: { merchantCountryCode: "FR", currencyCode: "EUR" },
          merchantCountryCode: "FR",
          testEnv: Config.STRIPE.TEST_ENVIRONMENT,
        })
steel inlet
#

this is a setupIntent

#

right?

violet acorn
#

is it

#

We are collecting the card detail to put a hold later when the user book a power bank

#

Then we remove the hold once the user is bringing back the power bank to the station

#

I used to play with isPending before, but could be nice to display what is the amount that will be taken in case

#

We already have it on the interface, but even, could be nice

#

In fact it works, it's just that it shows $

steel inlet
#

I wouldn't use SetupIntents to be honest

violet acorn
#

Tell me

steel inlet
violet acorn
#

It's currently working, we just updated the code.

steel inlet
#

I would use a Payment Intent with a capture: manual

violet acorn
#

The thing is we want to reuse the same card

#

That's what is done on the backend

#

The user do a setup intent, for future

steel inlet
#

you could save the card at the same time as doing a Payment Intent

violet acorn
#

Each time he take a power bank, the backend use the setup intent data to create a capture manual hold

steel inlet
#

you don't have to do it in 2 steps

violet acorn
#

Alright, sounds nice

#

I'll take a look at it, because it would need some change on the code

#

What if I want to change my card ? without triggering a new "transaction"

#

and putting a hold

#

Imagine i just received my new card from mailer and i want to update my account without taking a new power bank

steel inlet
#

you can always use the same PaymentIntent and change the payment method up until you confirm/capture it

violet acorn
#

It expires each time

#

Maybe we badly designed it

#

Currently what it does :

steel inlet
#

Imagine i just received my new card from mailer and i want to update my account without taking a new power bank
Yeah I agree that in that case you would use SetupIntents

#

but even then the amount should be 0

violet acorn
#

User create an account
User fill a setup intent
Then he scan a QR code on the nearest station
The backend generate a new payment intent with capture later for the hold
Battery ejected
Once the battery is brought back, the payment intent is canceled

When the user scan a new QR code, a new intent is created, and so on

violet acorn
#

๐Ÿ˜„

steel inlet
#

I'm not sure tbh

#

could you try without the extra params?

amount: "35",
isPending: false,
#

I think this

 applePay: Config.STRIPE.ENABLE_APPLE_PAY
            ? {
                merchantCountryCode: "FR",
                paymentSummaryItems: [
                  {
                    label: "Caution Stride",
                    paymentType: "Immediate",
                    amount: "35",
                    isPending: false,
                  },
                ],
              }
            : undefined,
``` is what's affecting the default behavior
#

I'm a bit curious why it exist in the Google Pay but not in the Apple Pay Params to be honest

#

I will try to dig deeper on this with the appropriate team

violet acorn
#

i'll try

#

So just to be clear you want me to try like this ?

 paymentSummaryItems: [
                  {
                    paymentType: "Immediate",
                    amount: "35โ‚ฌ",
                    isPending: false,
                  },
                ],
steel inlet
#

no not really

#

when there's an amount involved then I would recommend using Payment Intents

#

and when you need to specifically change the card because it was expired you could use the SetupIntent but without overriding the Apple Pay params