【问题标题】:Braintree Drop in UI - add credit cardBraintree Drop in UI - 添加信用卡
【发布时间】:2016-11-19 00:33:45
【问题描述】:

是否可以选择只在 UI 中使用 Braintree 下拉菜单向用户添加信用卡,还是只能用于付款?我已将服务器配置为发送令牌和接收付款,但我希望我的用户能够在使用我的应用之前添加信用卡。

【问题讨论】:

    标签: ios braintree


    【解决方案1】:

    不,您不能只添加信用卡。

    根据我与 Braintree 支持团队的电子邮件通信,如果您使用的是 Drop-in Payment UI,那么您不能只添加信用卡。仅在进行任何交易时,用户都可以添加信用卡。

    【讨论】:

    【解决方案2】:

    这有点棘手,但我可以使用 Braintree SDK for iOs (v. 4.9.0) 中包含的组件来做到这一点

    你必须从你的服务器获取一个没有“customerId”的“令牌”(这样可以避免自动保存卡片)

    当您收到“令牌”时,您可以这样做:

                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;
    

    在这里,您可以访问标记化的卡片和带有卡片数据的视图控制器。

    您可以获取网关配置以显示支持的卡。

    希望能提供帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-05
      • 2016-11-06
      • 2018-12-13
      • 2015-05-10
      • 2014-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多