Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Programmatically close the Apple Pay payment sheet? #3558

Closed
RZR666 opened this issue May 3, 2024 · 8 comments
Closed

[Feature] Programmatically close the Apple Pay payment sheet? #3558

RZR666 opened this issue May 3, 2024 · 8 comments
Labels
fixed in master Fixed in master, awaiting next update kind:improvement triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@RZR666
Copy link

RZR666 commented May 3, 2024

I really need to be able to programmatically close the Apple Payment sheet, I used to be able to on an older SDK, is it still possible?

Many Thanks

@RZR666
Copy link
Author

RZR666 commented May 4, 2024

I added,

`var mockSuccess: StripeAPI.PaymentIntent = StripeAPI.PaymentIntent(id: "", clientSecret: "", amount: 0, canceledAt: nil, captureMethod: .automatic, confirmationMethod: .automatic, created: Date(), currency: "", stripeDescription: "", livemode: false, receiptEmail: "", sourceId: "", paymentMethodId: "", status: .succeeded, shipping: nil);

completion(.success(mockSuccess))`

into

PaymentIntent+API.swift

as a quick fix, since I want to continue doing the clientSecret check on the api.

@yuki-stripe yuki-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label May 28, 2024
@yuki-stripe
Copy link
Collaborator

Hello, this feature is not available today but thank you for the suggestion. We revisit our roadmap periodically and will keep this idea in mind.

@ryang1428
Copy link

@yihong-stripe Any updates on this? In some error scenarios we need to dismiss the Apple Pay sheet in order to show the user an error message.

Ideally we'd have access to the PKPaymentAuthorizationController thats sitting on the STPApplePayContext (but private) so we can access the dismiss function
image (15)

It's right there but again it's private so we cant access it. Apple allows this with a straight up Apple Pay implementation; it's the SDK that is limiting this.

@yihong-stripe
Copy link

@yihong-stripe Any updates on this? In some error scenarios we need to dismiss the Apple Pay sheet in order to show the user an error message.

Do you mean @yuki-stripe ?

@ryang1428
Copy link

Yes sorry! 🤦‍♂️

yuki-stripe added a commit that referenced this issue Jan 15, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
## Summary
See https://stripe.slack.com/archives/C0353FPANQ0/p1736808910348399 

## Motivation
https://jira.corp.stripe.com/browse/MOBILESDK-2987
#3558 

## Testing

Added unit test, does not actually test we call `cancel` under the hood
though.

Manually tested calling the cancel API after I receive the payment
method:


https://github.com/user-attachments/assets/810e8608-771e-4b7e-9b1c-31e4e8f5177b


## Changelog
See CHANGELOG
@yuki-stripe
Copy link
Collaborator

You'll be able to programmatically dismiss the sheet by calling a new dismiss instance method in the next release!

@yuki-stripe yuki-stripe added the fixed in master Fixed in master, awaiting next update label Jan 15, 2025
@ryang1428
Copy link

Awesome I will keep a look out for that thanks @yuki-stripe 🙌

@yuki-stripe
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in master Fixed in master, awaiting next update kind:improvement triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

No branches or pull requests

4 participants