#jespr
1 messages · Page 1 of 1 (latest)
This is the screen. "Stäng" in the top left corner is the close button I'm referring to. Apologize for the non-English
I believe it should close itself and not have that interstitial page if you set up a returnURL
I do get the returnURL callback, but if I use that to close the view, the confirmPayment completion callback isn't run.
And Stripe's internal cleanup (like resetting the inProgress flag) isn't run.
when you say you're using confirmPayment and want this callback(on the delegate I assume) what exact integration are you using, what does the code look like?
we generally highly suggest using the PaymentSheet integration only
We have a custom UI. The function (and callback) I'm referring to is: STPPaymentHandler.sharedHandler.confirmPayment
yeah that's what I thought
maybe there's a bug? I just tested Klarna using PaymentSheet and it works perfectly, the webview of their page closes and my code gets the result correctly and it's all good.
I might still have some code to use that other integration, let me try replicate
but yeah we heavily recommend PaymentSheet and it's where all our development goes really
That's good to know.
so I'm just trying it now and it seems to work fine
Unfortunately same result with the latest SDK. I'll see if I can reproduce the result with a test project. Bug reports go to github if it turns out I can?
give me a bit to show you the code I use and stuff.
That would be amazing.
so for example I do this and the success print line happens
@objc func handleTestButtonTapped(){
let paymentIntentClientSecret = "pi_xxx_secret_yyy"
let paymentIntentParams = STPPaymentIntentParams(clientSecret: paymentIntentClientSecret)
// Billing details
let billingDetails = STPPaymentMethodBillingDetails()
billingDetails.email = "email@email.com"
let billingAddress = STPPaymentMethodAddress()
billingAddress.country = "BE"
billingDetails.address = billingAddress
// Klarna PaymentMethod params
let klarnaParams = STPPaymentMethodParams(klarna: STPPaymentMethodKlarnaParams(),
billingDetails: billingDetails,
metadata: nil)
paymentIntentParams.paymentMethodParams = klarnaParams
paymentIntentParams.returnURL="com.myapp://sheet-redirect"
STPPaymentHandler.shared().confirmPayment(withParams: paymentIntentParams, authenticationContext: self) { (handlerStatus, paymentIntent, error) in
switch handlerStatus {
case .succeeded:
// Payment succeeded
print("klarna success")
case .canceled:
// Payment was cancelled
print("canceled")
case .failed:
// Payment failed
print("failed")
print(error)
@unknown default:
fatalError()
}
}
}
That looks promising. Do you do anything with the return URL callback?
Got it.
Seems less likely to be a bug on your side then. I'll dig a bit further into it here.
Really appreciate all the feedback.
the fact you even get the "return to merchant" button to me heavily implies you're missing the returnURL or it's nil or not configured in your app's XCode settings or something
Well, it is there. Without it, I get an error trying to confirm the payment in the first place. But the code handling those links is a bit complicated (we have many different deep links), so there might something going wrong there.