Open
Conversation
This change should allow the consumer application to conditionally show the payment sheet depending on the returned value of a Promise. If the click handler returns a promise, then its value is checked. If it is true then the payment sheet is displayed after the promise resolves. If the promise returns false then nothing happens. If the click handler does not return a promise, its return does not influence the behavior. In other words, the behavior is the same as before.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
This PR proposes that the consumer application should optionally be able to delay showing the payment sheet until some checks are performed on their side. This was implemented by allowing the click handler to return either a promise or void. The new functionality only happens if the click handler's return type is a promise.
Screenshots / Videos
Promise returns true:
https://github.com/user-attachments/assets/db2ae8b9-ab14-4d49-af8f-14660cfe1710
Promise returns false:
https://github.com/user-attachments/assets/852ca429-9566-462b-8c80-ea3fbca616d2
No promise returned from click handler:
https://github.com/user-attachments/assets/43060b8d-4193-4468-9fe3-4924a103c406
No click handler defined:
https://github.com/user-attachments/assets/1630b02b-ad27-4ada-8261-6355b4b24d9f