-
Notifications
You must be signed in to change notification settings - Fork 993
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 CPM toggle to playground #4633
Conversation
if playgroundController.settings.merchantCountryCode == .US { | ||
SettingView(setting: $playgroundController.settings.customPaymentMethods) | ||
} |
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.
Seems like it's possible to turn this on while in US mode, then switch to another country and the setting will still be activated?
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.
Yeah it could! It would no-op internally, but better to not set it, updated this.
switch settings.customPaymentMethods { | ||
case .on: | ||
// Obtained from https://dashboard.stripe.com/settings/custom_payment_methods | ||
let customPaymentMethodType = PaymentSheet.CustomPaymentMethodConfiguration.CustomPaymentMethodType(id: "cpmt_1QpId5Lu5o3P18ZpLwSqMXws", |
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.
Maybe we have this vended from our merchant backend, and we add a parameter so we can test 1 or many custom payment methods? (e.g. the setting for customPaymentMethods is a value between 0-3 rather than a 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.
Hm, it feels needlessly complex tbh. Even if we needed multiple CPMs I'd rather have them defined client-side, this is more consistent with how merchants will integrate as well. Although nothing stopping them from using a backend to vend them as you suggested.
_ billingDetails: STPPaymentMethodBillingDetails | ||
) async -> PaymentSheetResult { | ||
return await withCheckedContinuation { continuation in | ||
handleExternalPaymentMethod(type: customPaymentMethodType.id, billingDetails: billingDetails) { result in |
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.
Will handling custom payment methods always be the same as handling external payment methods? Or will it eventually differ
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.
Handling confirmation of CPMs and EPMs will be the same. The merchant is responsible for handling the confirmation, then returning back to us the final result.
Summary
Motivation
Testing
Changelog
N/A