#Žiga

1 messages · Page 1 of 1 (latest)

forest lichenBOT
violet crater
#

Hi! Let me help you with this.

#

How do you create the SetupIntent?

wintry cloak
#

now i'm trying to do something similar for apple pay

violet crater
#

So do you need to use a PaymentIntent or a SetupIntent?

wintry cloak
#

i just want to get card details for future off session payments

#

for just credit card info i'm using confirmSetupIntent
and now i need same thing but for apple pay

#

I hope that makes sense

violet crater
#

Is it not working if you use the same request?

wintry cloak
#

no

#

after 20 seconds it says apple pay not completed

violet crater
#

Could you share some relevant frontend code, please?

wintry cloak
#

sure

#
const { setupIntent, error } = await confirmPlatformPaySetupIntent(
          'client ssecret',
          {
            applePay: {
              merchantCountryCode: userStore.userServiceCountry.code,
              currencyCode: userStore.userServiceCountry.currencyIsoCode,
              cartItems: items,
              shippingType: 'servicePickup',
            },
          },
        );

        console.log('setupIntent', setupIntent);
        console.log('error', error);
#

I call this when user click on apple pay button

#

client secret is created like this

violet crater
#

What is the error you are getting?

wintry cloak
#

no error

#

sorry

#

after 20 seconds i get a native popup saying apple pay not completed

#

after i dismiss this popup i just get "The payment has been canceled"

#
{
    "code": "Canceled",
    "localizedMessage": "The payment has been canceled",
    "message": "The payment has been canceled",
    "declineCode": null,
    "type": null,
    "stripeErrorCode": null
}
violet crater
#

I'm still looking, please give me a few minutes. Thanks!

wintry cloak
#

ok thanks

violet crater
#

Are you taking this function from stripe.js? confirmPlatformPaySetupIntent

wintry cloak
#

i'm using react native

#

im importing it from @stripe/stripe-react-native

violet crater
#

Could you please share a SetupIntent ID that's failing?

wintry cloak
#

what is a setupintent id?

violet crater
#

When you send this request - curl https://api.stripe.com/v1/setup_intents ... - you create a SetupIntent, this object has an ID. It usually looks like seti_xxx

#

Please share it with me and I will be able to help you more efficiently

hardy blade
#

Hello 👋
Taking over and catching up

#

Let me know if you have a follow up qs thanks

wintry cloak
#

give me 15 min and i'll send you the intent

wintry cloak
#

hi

#

sorry for waiting

#

should I send you a setupintent before or after i try to use it?

#

or does it not matter

hardy blade
#

Doesn't matter. Try it out

wintry cloak
#

ok

#

id right?

#

seti_1MeJSpBaqoRVG089zML5Vmqe

hardy blade
#

Try confirming it

wintry cloak
#

what do you mean confirming it?

hardy blade
#

Try using the setup intent in your code by calling confirmPlatformPaySetupIntent

wintry cloak
#

that's what I'm calling already

#
const { setupIntent, error } = await confirmPlatformPaySetupIntent(
          'client ssecret',
          {
            applePay: {
              merchantCountryCode: userStore.userServiceCountry.code,
              currencyCode: userStore.userServiceCountry.currencyIsoCode,
              cartItems: items,
              shippingType: 'servicePickup',
            },
          },
        );

        console.log('setupIntent', setupIntent);
        console.log('error', error);
hardy blade
#

I don't see a confirmation request come in for this SetupIntent
Can you share the whole text of the error you're seeing in the logs?

#

also try to print out these values

              currencyCode: userStore.userServiceCountry.currencyIsoCode,
              cartItems: items,```
wintry cloak
#

quick question

#

Im testing this on test account but i'm using my actuall card?

#

i'll switch to a simulator and try again

#

give me a few minutes please

hardy blade
#

oh wait, are you passing the actual clientSecret to confirmPlatformPaySetupIntent function? or just the string 'client ssecret' ??

wintry cloak
#

actual thing 😄

#

I just removed it now

#

im sending client_secret

#

that's the right one, right?

#

code is GB
currency is GBP
items is [{
"label": "Laundryheap Limited",
"amount": "0",
"paymentType": "Immediate",
"isPending": true
}]

#

seti_1MeJhwBaqoRVG0898wHJ3oLN

{
"code": "Canceled",
"localizedMessage": "The payment has been canceled",
"message": "The payment has been canceled",
"declineCode": null,
"type": null,
"stripeErrorCode": null
}

That's what i get after 20 seconds

hardy blade
#

So client-secret looks something like seti_xxxx_secret_yyyyy

#

That's what you should be returning from your server-side once you create a SetupIntent

wintry cloak
#

aha but both id and client_secret start with seti

#

also I am sending client_secret whitch starts with seti and includes secret

#

but to you I send the id which also starts with seti but doesn't include secret

hardy blade
#

Ah okay..
can you try setting currency to eur ?

#

just want to check if that changes anything

wintry cloak
#

ok

#

so GB and EUR?

hardy blade
#

yup

wintry cloak
#

no difference

#

Can you share with me the docs for this please?

#

i wasn't able to find anytninng for my case

#

the only think I found was still using the deprecated presentApplePay

#

but nothing current

hardy blade
#

Yeah unfortunately we're still in the middle of updating the canonical docs for this flow so not sure if there's anything I can share.
As far as I know, it should work pretty much the same as it does with presentApplePay

#

Do you mind sharing your full code for the component?

wintry cloak
#

but presentApplePay doesn't take client secret

#

just the apple pay object

hardy blade
#

The only difference here with SetupIntents would be in Step 6 and Step 7
Step 6/ Create a Setupintent

Step 7/ Confirm it client-side with confirmPlatformPaySetupIntent

wintry cloak
#

but here the client secret looks like this
pi_...secret...

#

is this correct?

hardy blade
#

Yeah the doc is for accepting a payment (with PaymentIntents API) and not saving the PaymentMethod (with SetupIntents API)

#

Can you share your complete code for the component?

wintry cloak
#

hm this now works

#

but i think 2 weeks ago i tried this and one of my cards didn't work

#

the did

hardy blade
#

ah what did you change?

wintry cloak
#

thanks for now. I'll try this way now a few times and check that all cards I have work

#

switch to confirmPlatformPayPayment
and I get client secret with the amount and currency

hardy blade
#

confirmPlatformPayPayment shouldn't work with a SetupIntent seti_xxx_secret_yyyy
Were you working with a PaymentIntent all along?

wintry cloak
#

no before i had confirmPlatformPaySetupIntent
and used

  -u pub_key \
  -d "customer"="customer_id"

now i use confirmPlatformPayPayment
and get client secret like so

  -u  \
  -d "amount"=100 \
  -d "currency"="gbp"
hardy blade
#

Gotcha. could it be because you have "paymentType": "Immediate", ?

#

PaymentType shouldn't be Immediate for SetupIntents

wintry cloak
#

what should they be?

#

Deferred
Immediate
Recurring

hardy blade
#

deferred

wintry cloak
#

using confirmPlatformPaySetupIntent with payment type deffered still doesn't work
I'll try the confirmPlatformPayPayment now and see if it works

#

but I have one more question
when adding credit card I use confirmSetupIntent
shouldn't I then for apple pay use confirmPlatformPaySetupIntent

from what I understand both should allow me to add card for future payment and do this without chargin the card when authorizing it

hardy blade
#

confirmSetupIntent is for web right?

wintry cloak
#

no. for mobile

#

both are from react native

#

@stripe/stripe-react-native

hardy blade
#

Is there a specific doc you're following for this? If so, can you share a link?
I don't think we recommend using confirmSetupIntent with ReactNative.

wintry cloak
hardy blade
wintry cloak
hardy blade
wintry cloak
#

i'll try it out. But this is for future payments right? I just want to collect payment method for later

hardy blade
#

i'll try it out. But this is for future payments right? I just want to collect payment method for later
One and the same thing 🙂 It allows you to store the PaymentMethod for later use (future payments)

wintry cloak
#

but I don't want to charge them

#

just collect payment method

hardy blade
#

Yeah that flow will not charge the customers.

#

I'll flag it internally so that we can get it updated

wintry cloak
#

ok thanks for your all help
i'll try using the payment sheet

hardy blade
#

NP! 🙂 Happy to help
Good luck

wintry cloak
#

thanks

#

have a nice day