#Žiga
1 messages · Page 1 of 1 (latest)
curl https://api.stripe.com/v1/payment_intents
-u token
-d "amount"=1099
-d "currency"="eur"
I tried like this
but also like this
curl https://api.stripe.com/v1/setup_intents
-u token
-d "customer"="customer id"
for CardField I use confirmSetupIntent and create setupintent like so
curl https://api.stripe.com/v1/setup_intents
-u token
-d "customer"="customer id"
now i'm trying to do something similar for apple pay
So do you need to use a PaymentIntent or a SetupIntent?
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
Is it not working if you use the same request?
Could you share some relevant frontend code, please?
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
curl https://api.stripe.com/v1/setup_intents
-u token
-d "customer"="customer id"
What is the error you are getting?
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
}
I'm still looking, please give me a few minutes. Thanks!
ok thanks
Are you taking this function from stripe.js? confirmPlatformPaySetupIntent
Could you please share a SetupIntent ID that's failing?
what is a setupintent id?
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
give me 15 min and i'll send you the intent
hi
sorry for waiting
should I send you a setupintent before or after i try to use it?
or does it not matter
Doesn't matter. Try it out
Try confirming it
what do you mean confirming it?
Try using the setup intent in your code by calling confirmPlatformPaySetupIntent
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);
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,```
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
oh wait, are you passing the actual clientSecret to confirmPlatformPaySetupIntent function? or just the string 'client ssecret' ??
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
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
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
Ah okay..
can you try setting currency to eur ?
just want to check if that changes anything
yup
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
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?
huh interesting
okay looks like we've updated this doc with PlatformPay but its for PaymentIntents
https://stripe.com/docs/apple-pay?platform=react-native
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
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?
hm this now works
but i think 2 weeks ago i tried this and one of my cards didn't work
the did
ah what did you change?
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
confirmPlatformPayPayment shouldn't work with a SetupIntent seti_xxx_secret_yyyy
Were you working with a PaymentIntent all along?
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"
Gotcha. could it be because you have "paymentType": "Immediate", ?
PaymentType shouldn't be Immediate for SetupIntents
deferred
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
confirmSetupIntent is for web right?
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.
for adding card I followed this.
https://stripe.com/docs/payments/save-and-reuse-cards-only
but this doesn't support apple pay
Ah interesting. Is there a reason you're using this flow instead of the canonical flow we recommend with PaymentSheet?
https://stripe.com/docs/payments/save-and-reuse?platform=react-native&ui=payment-sheet
It supports ApplePay out of the box
We have some custom logic which unfortunately wouldn't work with that
but it says that if you can't use that, then use this one
https://stripe.com/docs/payments/save-and-reuse-cards-only
Ah I see. fwiw, we also have an option to extend the PaymentSheet flow to complete the payment in your own UI as shown here if that helps with custom logic that you currently have.
https://stripe.com/docs/payments/save-and-reuse?platform=react-native&ui=payment-sheet#react-native-flowcontroller
i'll try it out. But this is for future payments right? I just want to collect payment method for later
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)
Yeah that flow will not charge the customers.
Ah looks like the docs here in step 1 are incorrectly referencing a PaymentIntent
https://stripe.com/docs/payments/save-and-reuse?platform=react-native&ui=payment-sheet#react-native-flowcontroller:~:text=Update your UI-,with these details.,-const {
initPaymentSheet
You should be able to change it to setupIntentClientSecret instead
I'll flag it internally so that we can get it updated
ok thanks for your all help
i'll try using the payment sheet
NP! 🙂 Happy to help
Good luck