我正在尝试创建信用卡,因此我需要致电paymentMethodNone()
。根据文件,我可以
使用PaymentMethod.create()为现有客户创建付款方式:
// It's not clear what A_PAYMENT_METHOD_TOKEN has to be
Result<PaymentMethodNonce> result = bt.paymentMethodNonce()
.create("A_PAYMENT_METHOD_TOKEN");
String nonceFromTheClient = result.getTarget().getNonce();
Customer customer = customerResult.getTarget();
PaymentMethodRequest paymentMethodRequest = new PaymentMethodRequest()
.customerId(customer.getId())
.paymentMethodNonce(nonceFromTheClient);
Result<? extends PaymentMethod> paymentMethodResult = bt.paymentMethod()
.create(paymentMethodRequest);
PaymentMethod paymentMethod = paymentMethodResult.getTarget();
答案 0 :(得分:1)
完全披露:我在Braintree工作。如果您有任何其他问题,请随时联系support。
您无需payment_method_token
即可创建PaymentMethod
。
要创建信用卡,您需要创建PaymentMethod。首先,从传入的请求中检索payment_method_nonce
。接下来,使用PaymentMethod
创建PaymentMethodRequest
。
//payment_method_nonce will be a post parameter in the request
//set nonceFromTheClient to equal payment_method_nonce
PaymentMethodRequest paymentMethodRequest = new PaymentMethodRequest()
.customerId(customer.getId())
.paymentMethodNonce(nonceFromTheClient);
Result<? extends PaymentMethod> result = gateway.paymentMethod().create(request);