#ortegagroup_code
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/1286061685781565566
๐ 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.
- ortegagroup_api, 2 hours ago, 68 messages
Hello
Can you explain a bit more what exactly is happening? It would also help if you have a screen recording that you could share as well.
hell bismarck
I'll send you a screen recording right now of how it works for both Apple Pay and for inserting a card.
Great, thanks
This example is with apple pay intent
This example is add new card
The payment is not processed and the screen remains blank.
Okay let's start with Apple Pay
First, it looks like there is an alert with an error
What does that say?
And have you added a log within your applePayContext function to make sure it makes it to your completion block?
Talking about this step: https://docs.stripe.com/apple-pay?platform=ios#client-side
I'm not an iOS dev but ViewController should not matter afaik
Are you calling StripeAPI.deviceSupportsApplePay()?
Ah wait that is just for the device you are testing with.
That error indicates an issue with your Apple Pay Certificate I think
I'm following exactly this code that I took from the Stripe repository
Did you create an Apple Pay Cert?
Yes
And you added the Apple Pay capability with the correct Apple Merchant ID?
Yes
I'm pretty positive this is a cert issue here. That error comes from Apple. Same error is discussed in this SO for instance: https://stackoverflow.com/questions/29618296/stripe-and-apple-pay-not-working-in-ios-app
I'd recommend recreating your cert and double checking all of that setup
That's fine
For the second issue, when adding a Card through Payment Sheet, it looks like the Payment Sheet dismissed just fine.
What is your code doing after Payment Sheet completes?
It remains blank
Ah
You just are doing: if case .completed = result { // A PaymentIntent can't be reused after a successful payment. Prepare a new one for the demo. self.paymentSheet = nil preparePaymentSheet() }
So yeah
You don't do anything
Which is why the screen is blank
That all seems expected...
you need to write code to handle what happens at that point
Do I add a dismiss.callAsFunction or a boolean that closes the sheet and navigates the user out of the checkout process at that point?
You don't have to do anything to close the sheet. Once it closes your paymentResult block is called.
Then generally you would navigate your customer to a confirmation screen or something that indicates to them their purchase was successful
Excellent, it helped me a lot and I also verified that the certificate configured in Stripe was an old one.
Thank you very much, after so many attempts one does not see those details.
๐
Give me a few minutes to verify that this is the error.
I have another question, I have the backend hosted on render.com but if I retrieve the customerId to be able to correctly display the paymentSheet, why doesn't it load? I see the render logs and it shows me the console.log that should be displayed when the /checkout endpoint is called but it doesn't load and takes too long. What is the reason if the backend correctly receives the call?
This is the Xcode log I put that calls the function that communicates with the backend
๐ stepping in for my teammate, give me a few minutes
๐
What does your frontend code look like for this?
.onAppear {
updateAmount()
let total = totalAmount(subtotal: subtotal, taxes: salesTax)
// model.preparePaymentSheetWithCheckoutFlow(totalAmount: Int(total), location: orderCompleted.Store)
model.preparePaymentSheetWithCheckoutFlow(totalAmount: Int(total))
}
This code is for when the view appears where the function that communicates with the backend is called
Once that happens the code that should display the buttons is the following:
Got it. Give me a few minutes, I'm getting help from a teammate
Hello again! Can you add way more logging to your code to see how far it gets in the process and where exactly it's getting stuck?
What happens is that it takes a while for the button to choose the payment method and the actual button to pay to appear. Finally, the user (me) has to close the application and reopen it for it to load correctly.
Followed by that when the payment is successful the success sheet is displayed and closed automatically.
So to clarify, it does work, but it takes too long and takes extra steps?
Exactly, but in the Xcode console it tells me that the customerId was sent to the backend and the backend responds that it received it, so I don't understand what slows down the process if the communication is carried out effectively.
That's why I recommended adding more logging, so you can see exactly where it's getting stuck.
In order to move forward you need to narrow down the exact line of code where it's getting stuck, then figure out why that's happening.
Yes.
I was able to resolve the payment issue, it is late or not processed. It's good
But for example, when the keyboard is displayed to insert a new card as a payment method, when you complete the form and close it, the screen goes blank.
Okay. What's your question?
This is the example
I can't tell from here. You need to add more logs to your code to figure out exactly what happens leading up to that, and why the expected code after that doesn't get called.
Happy to help!
One questions, are you iOS developer?