#ortegagroup_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1279087657233809412
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- ortega_paymentsheet-group, 14 hours ago, 37 messages
Hello
Functionally, PaymentSheet does not have a dependency on webhook endpoints
the sheet to select the user's payment method cannot be displayed, the client_secret, ephemeralKey, publishableKey and customerId arrive correctly to the client.
What do you mean by that exactly? Can you elaborate?
I don't understand why it doesn't work.
Are you following any guides
I'm replicating the same code from Stripe's own documentation for SwiftUI language and still no success.
In order not to give you so much text, I will send you the link to the example that is in a stripe git repository
Use exactly this code
Are you seeing any errors in your console when you try to present the sheet?
I'd recommend you follow this guide instead: https://docs.stripe.com/payments/accept-a-payment?platform=ios. It has step by step instructions to setup PaymentSheet on iOS
Yes, the Xcode console error is as follows:
Error Domain=com.stripe.lib Code=50 "There was an unexpected error -- try again in a few seconds" UserInfo={com.stripe.lib:StripeRequestIDKey=req_Pqrwfhg72jCjl6, com.stripe.lib:StripeErrorCodeKey=resource_missing, com.stripe.lib:ErrorMessageKey=No such payment_intent: 'pi_3PtOWOAZJHGoU7Pr0JPbkyEy', com.stripe.lib:StripeErrorTypeKey=invalid_request_error, NSLocalizedDescription=There was an unexpected error -- try again in a few seconds, com.stripe.lib:hintKey=No matching PaymentIntent could be found. Ensure you are creating a PaymentIntent server side and using the same publishable key on both client and server. You can find more information at https://stripe.com/docs/api/payment_intents/create, com.stripe.lib:ErrorParameterKey=intent}
I understand that a payment method is missing, but the payment sheet is for the user to choose the payment method, I don't understand.
You're using wrong API keys in your code
I have already tried this code, identical to the one in the documentation, and I get the same error.
The PaymentIntent was created https://dashboard.stripe.com/test/logs/req_VvmMXHWMlXHUwU on acct_1PlxwpAZJHGoU7Pr
You're trying to access it using API keys that belong to acct_1Pe15fHKD95FdBqC
Where do I see that API key? Sorry.
Not sure what you mean by that? Do you mean in your code or on Stripe?
My code, this acct_1Pe15fHKD95FdBqC where can I find it?
You can't find the account ID in your code but you must be setting pk_test_xxx in your iOS app somewhere. That key belongs to acct_1Pe15fHKD95FdBqC
You should use pk_test_xxx that belongs to acct_1PlxwpAZJHGoU7Pr instead
If you're using the same code as the guide then your publishableKey comes from your server. So you'd want to make sure you're returning the right key
Okay, can you give me a few minutes to fix that?
sure
I already checked in the backend that the publishable key I was sending as a response is different from the one in my Stripe control panel. Now I compile and test, please don't leave me lol
NP! ๐ Take your time
Awesome
I have a one question
Sure
I entered a test credit card 4242, and I selected save payment method for future payments, but when I exit the application and compile again, that payment is not saved. How can I implement this?
Does your API create a new customer each time you try to initiate a new payment?
You'd need to make sure you're re-using the same customer
That happens, it creates a new customer when paying again.
Should I modify the endpoint?
Yup
Or create a new endpoint for this case
Upto you
on how you want to handle it
but you'd only see saved payment methods if you're re-using the customer
Only with ephemeralKey?
ephemeralKey should belong to the customer you're reusing, yes
Is there documentation to view it and know how to implement it correctly? If so, could you provide it to me?
Thank you very much!
Hmm we don't have any specific docs for that unfortunately
In your API, instead of doing
const customer = await stripe.customers.create()
You'd want to change it to for example, a retrieve call where you fetch an existing customer instead
I implemented something but it was in the frustrating process of so many attempts that I commented on it on the server, I attached it in an image so you can take a look if it is well implemented.
yup that makes sense
you'd just need to make sure customerId is a valid cus_xxx ID
otherwise you'd see API errors
Excellent, I really appreciate the help Hanzo. I was already getting frustrated.
NP! Happy to help
You can leave it open in the chat because I will be working on finalizing those details and I may need help again.
Hanzo are you there?
Hi there ๐ taking over, as my colleague needs to step away
How can we help?
I have this view in my iOS app, but I want to display the cards that the user saves in stripe. Is this possible?
Which Stripe SDK are you using?
iOS for SwiftUI
Let me see if I can get you a mobile engineer. Someone will circle back in a few
Hello again
Are you asking about CustomerSheet? https://docs.stripe.com/elements/customer-sheet
@celest bramble I believe CustomerSheet should help with what you're looking for
Excellent, don't you recommend what I'm doing?
I say this because customerSheet requires a setupIntent.
Not sure I follow. Are you trying to show saved payment methods outside the PaymentSheet flow correct?
If so, SetupIntent is expected
as CustomerSheet allows you to store payment methods too
Yes
In the PaymentSheet and outside the PaymentSheet since you can configure a payment method without making a purchase.
PaymentSheet takes care of Storing the payment method automatically and does not require a SetupIntent..
Outside PaymentSheet, you can use CustomerSheet
Totally upto you on how you want to model it in your API as long as the CustomerSheet adapter is getting the right values it needs
Happy to help ๐