2016-11-10 9 views
1

Braintree_Customer :: create()在braintree中成功返回信用卡对象吗?是Braintree_Customer :: create()成功返回信用卡对象

它在验证对象中失败时返回。

如果Braintree_Customer :: create()成功或失败,我想知道访问信用卡对象的最佳做法。

+0

是它返回creditCards [creditCards对象数组]并且还用于paymentMethods [paymentMethods对象数组]。 现在我想知道访问它的最佳做法。 –

回答

1

好像您可以访问成功结果对象(Python)中新创建的客户的付款方式;

我的客户创造的呼叫:

result = braintree.Customer.create({ 
    'first_name': 'John', 
    'last_name': 'Smith', 
    'company': 'Internet', 
    'email': '[email protected]', 
    'payment_method_nonce':'fake-valid-nonce' 
}) 

所以

result.customer.payment_methods 

将在索引0,这实质上是布伦特里的Credit Card Result object,它包含了所有合适的返回包含新创建的支付方法的数组该信用卡对象的属性。