square / in-app-payments-ios

Public repository that hosts the Square In-App Payments SDK iOS binaries
15 stars 6 forks source link

-cardEntryViewController:didCompleteWithStatus: not called #23

Closed ghost closed 3 years ago

ghost commented 4 years ago

For our app we're integrating Square in-app payments in the EU, so we're combining SQIPCardEntryViewController with SQIPBuyerVerificationSDK.

I'm not sure if it's this reason, or another reason, but after going through the entire payment flow, then calling the completion handler with nil, we see that the payment animation plays, but the -cardEntryViewController:didCompleteWithStatus: delegate method is never called so that screen just remains open forever.

We've worked around this by checking after a few seconds of calling the completion handler if it's still open, and then closing it if it is, but this probably isn't the best approach. Is there something more we should be doing to get this delegate method firing?

MikeSilvis commented 4 years ago

hey @lyptt, we have not seen this issue before. Can you confirm version? Also if you can reproduce this in a sample project that you can send over that would be really helpful!

ghost commented 4 years ago

Hey @MikeSilvis, I've just gone through the issue in a sample project. Turns out this situation only occurs if you try to dismiss / pop its parent view controller whilst it itself is dismissing, so chaining everything behind dismiss completion blocks seems to get it all working properly.

This is probably more of an iOS thing than a Square thing, although if you're checking if the parent view controller exists in dismiss that could also be the culprit. We're using version 1.3.0 of the SDK.

Only thing I've noticed is dismissing the card entry vc doesn't animate at all, it just blinks out of existence, which is a bit weird. That happens with the sample project too, so I've attached the project in case it's not a known issue.

Appreciate the fast reply, thanks!

test.zip

MikeSilvis commented 3 years ago

@lyptt sorry for the delay.

it looks like in the completion you are calling cardEntryViewController.dismiss which is actually trying to dismiss a VC on top of the Card Entry View. If you just call:

dismiss(animated: true, completion: nil)

It appears to work fine.

MikeSilvis commented 3 years ago

Going to mark this issue as resolved. Please re-open if needed.