简体   繁体   English

条纹IOS SDK不匹配AllResponseFields?

[英]Stripe IOS SDK not matching AllResponseFields?

I'm trying to do a simple count check for a customer to see if they need to add a source before moving onto another page. 我正在尝试对客户进行简单的计数检查,以查看他们是否需要在移至另一页之前添加源。 However, my calls to the STPCustomer object's attributes are not matching the information for the full response. 但是,我对STPCustomer对象的属性的调用与完整响应的信息不匹配。

I've tried clearing the customer cache and reloading the customer, but uh... still no match. 我已经尝试清除客户缓存并重新加载客户,但是...仍然没有匹配项。

Here's a truncated like, essentials code. 这是一个截断的基本代码。 The class has the STPPaymentContextDelegate attached. 该类具有STPPaymentContextDelegate附加。

private var customerContext = STPCustomerContext? 
private var paymentContext = STPPaymentContext? 

func setupStripe() {
self.paymentContext = STPPaymentContext(customerContext: self.customerContext!)

    self.paymentContext?.hostViewController = self
    self.paymentContext?.delegate = self

    self.paymentView = STPPaymentMethodsViewController(configuration: STPPaymentConfiguration.shared(), theme: STPTheme.default(), customerContext: self.customerContext!, delegate: self)
}

func getCustomerSources() {

if let customer = customerContext.retrieveCustomer({ (customer, error) in
        if customer != nil {
             print(customer.sources.count)
             print(customer.sources)
             print(customer.allResponseFields)
        }
    })
}

When I run getCustomerSources() on the test customer, I am expecting: 当我在测试客户上运行getCustomerSources()时,我期望:

 1
 [ba_1Dvf46LrBVaGM6Sq9qIYhOlJ]
 AnyHashable("id"): cus_number, AnyHashable("email"): rosa_diaz@gmail.com, AnyHashable("default_source"): ba_1Dvf46LrBVaGM6Sq9qIYhOlJ, AnyHashable("created"): 1548220659, AnyHashable("description"): LiG8WbVhT8SVhta8LdfUuWzOwQn2, AnyHashable("livemode"): 0, AnyHashable("object"): customer, AnyHashable("sources"): {
  data =     (
            {
        "bank_name" = "STRIPE TEST BANK";
        country = US;
        currency = usd;
        customer = "cus_EOQzwwGPjzopjS";
        fingerprint = 1AQMB9nzeGSGXHst;
        id = "ba_1Dvf46LrBVaGM6Sq9qIYhOlJ";
        last4 = 6789;
        metadata =             {
        };
        object = "bank_account";
        "routing_number" = 110000000;
        status = verified;
    }
   );
   "has_more" = 0;
   object = list;
   "total_count" = 1;
   url = "/v1/customers/cus_EOQzwwGPjzopjS/sources";
}])

However, instead of my 1 and ba_1Dvf46LrBVaGM6Sq9qIYhOlJ , I am getting 0 and [] . 但是,我得到的是0[] ,而不是我的1ba_1Dvf46LrBVaGM6Sq9qIYhOlJ But the allResponseFields section is the same. 但是 allResponseFields部分相同。

Any ideas as to why there's a discrepancy between what the STPCustomer object attributes are returning and what the actual response is telling me? 关于为什么STPCustomer对象属性返回的内容与实际响应告诉我的内容之间存在差异的任何想法?

it's hard to say what's going on without knowing more about the error parameter that your callback receives. 如果不了解回调函数接收到的error参数,很难说是怎么回事。 It sounds like there might be an error parsing the API response, and printing the error passed into your retrieveCustomer block should give you a better idea about what's going on. 听起来好像在解析API响应时可能有错误,并且打印传递到您的retrieveCustomer块中的error应该使您对发生的事情有更好的了解。 If the error persists I'd recommend contacting support@stripe.com with details, as they can help directly with iOS app questions! 如果错误仍然存​​在,我建议您联系support@stripe.com并提供详细信息,因为它们可以直接解决iOS应用问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM