Braintree Drop in UI - 添加信用卡
Braintree Drop in UI - add credit card
是否可以选择仅向 UI 中有 Braintree drop 的用户添加信用卡,或者它是否只能用于付款?我已将我的服务器配置为发送令牌和接收付款,但我希望我的用户能够在使用我的应用程序之前添加信用卡。
不可以,不能只添加信用卡。
根据我与 Braintree 支持团队的电子邮件通信,如果您使用的是直接付款 UI,那么您不能仅添加信用卡。仅进行任何交易时,用户将能够添加信用卡。
弄清楚有点棘手,但我可以使用 iOs ( v. 4.9.0 )
的 Braintree SDK 中包含的组件来做到这一点
你必须从你的服务器获取一个没有 "customerId" 的 "token"(这样可以避免自动保存卡片)
收到 "token" 后,您可以这样做:
NSString* token = [jsonData valueForKey:@"response"];
self.req=[[BTDropInRequest alloc] init];
self.req.applePayDisabled = YES ;
self.cardForm = [[BTDropInController alloc] initWithAuthorization:token request:self.req handler:^(BTDropInController * _Nonnull controller, BTDropInResult * _Nullable result, NSError * _Nullable error) {
}];
BTCardFormViewController* vd = [[BTCardFormViewController alloc] initWithAPIClient:self.cardForm.apiClient request:self.cardForm.dropInRequest];
vd.supportedCardTypes = [NSArray arrayWithObject:@(BTUIKPaymentOptionTypeVisa)];
vd.delegate = self;
UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:vd];
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
navController.modalPresentationStyle = UIModalPresentationPageSheet;
}
[self presentViewController:navController animated:YES completion:nil];
上面的代码将呈现标准的 Braintree 表单来收集卡片数据。
您必须实施 BTCardFormViewControllerDelegate 才能获得令牌化卡。
- (void)cardTokenizationCompleted:(BTPaymentMethodNonce * _Nullable )tokenizedCard error:(NSError * _Nullable )error sender:(BTCardFormViewController *) sender;
在这里您可以访问标记化的卡片和带有卡片数据的视图控制器。
您可以获取网关配置以显示支持的卡。
希望能帮到你。
是否可以选择仅向 UI 中有 Braintree drop 的用户添加信用卡,或者它是否只能用于付款?我已将我的服务器配置为发送令牌和接收付款,但我希望我的用户能够在使用我的应用程序之前添加信用卡。
不可以,不能只添加信用卡。
根据我与 Braintree 支持团队的电子邮件通信,如果您使用的是直接付款 UI,那么您不能仅添加信用卡。仅进行任何交易时,用户将能够添加信用卡。
弄清楚有点棘手,但我可以使用 iOs ( v. 4.9.0 )
的 Braintree SDK 中包含的组件来做到这一点你必须从你的服务器获取一个没有 "customerId" 的 "token"(这样可以避免自动保存卡片)
收到 "token" 后,您可以这样做:
NSString* token = [jsonData valueForKey:@"response"];
self.req=[[BTDropInRequest alloc] init];
self.req.applePayDisabled = YES ;
self.cardForm = [[BTDropInController alloc] initWithAuthorization:token request:self.req handler:^(BTDropInController * _Nonnull controller, BTDropInResult * _Nullable result, NSError * _Nullable error) {
}];
BTCardFormViewController* vd = [[BTCardFormViewController alloc] initWithAPIClient:self.cardForm.apiClient request:self.cardForm.dropInRequest];
vd.supportedCardTypes = [NSArray arrayWithObject:@(BTUIKPaymentOptionTypeVisa)];
vd.delegate = self;
UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:vd];
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
navController.modalPresentationStyle = UIModalPresentationPageSheet;
}
[self presentViewController:navController animated:YES completion:nil];
上面的代码将呈现标准的 Braintree 表单来收集卡片数据。
您必须实施 BTCardFormViewControllerDelegate 才能获得令牌化卡。
- (void)cardTokenizationCompleted:(BTPaymentMethodNonce * _Nullable )tokenizedCard error:(NSError * _Nullable )error sender:(BTCardFormViewController *) sender;
在这里您可以访问标记化的卡片和带有卡片数据的视图控制器。
您可以获取网关配置以显示支持的卡。
希望能帮到你。