-
Notifications
You must be signed in to change notification settings - Fork 264
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
Add capabilityCredit and capabilityDebit merchantCapability options for Apple Pay #748
Add capabilityCredit and capabilityDebit merchantCapability options for Apple Pay #748
Conversation
…or Apple Pay These allow developers to pass `capabilityCredit: true` or `capabilityDebit: true` when opening an Apple Pay interface to filter to only credit or debit cards. See: https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest/1916123-merchantcapabilities
Brendan Long seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
I doubt this is exactly how you want to implement this, but I figured example code would make it easier to find this if you do want to do it. |
if (params["capabilityCredit"] as? Bool ?? false) { | ||
paymentRequest.merchantCapabilities.update(with: .capabilityCredit) | ||
} | ||
if (params["capabilityDebit"] as? Bool ?? false) { | ||
paymentRequest.merchantCapabilities.update(with: .capabilityDebit) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think of something like
if let cardType = params["supportedCardType"] as? NSString {
if (cardType.isEqual(to: "Credit")) {
paymentRequest.merchantCapabilities.update(with: .capabilityCredit)
} else if (cardType.isEqual(to: "Debit")) {
paymentRequest.merchantCapabilities.update(with: .capabilityDebit)
}
}
So we only add 1 param to handle this, and default to accepting both credit and debit?
It would also be good to see if Google Pay exposes a similar filter so we have cross-platform support for this feature: https://developers.google.com/pay/api/android/guides/tutorial#allowed-payment-methods |
@@ -59,6 +59,8 @@ export namespace ApplePay { | |||
} | |||
|
|||
export interface PresentParams { | |||
capabilityCredit?: Boolean; | |||
capabilityDebit?: Boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this PR is going to be merged as #1164 is marking as fixing this same issue, but in JS boolean type should use a lower case b.
This is now released in v0.22.0 via #1164 |
I might be missing something, but I don't see where the option to specify only credit or debit was done. In presentParams I don't see a field relevant to this. |
This is released as part of the new Platform Pay API, which replaced the individual Apple/Google Pay APIs: https://github.com/stripe/stripe-react-native/blob/master/src/types/PlatformPay.ts#L65 |
These allow developers to pass
capabilityCredit: true
orcapabilityDebit: true
when openingan Apple Pay interface to filter to only credit or debit cards.
See: https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest/1916123-merchantcapabilities
Fixes #728