服务器端的 Braintree 文档:https://developer.paypal.com/braintree/docs/guides/paypal/server-side/java 只涵盖“结账”和“金库结账”流程,不包括金库流程。
我想知道的是,如果我不向客户收费,只希望客户同意计费协议,然后存储支付方式令牌以供将来付款, 正确的方法是什么?
我的搜索让我找到了两个可能的答案:
.firstName("Fred")
.lastName("Jones")
.paymentMethodNonce(nonceFromTheClient);
Result<Customer> result = gateway.customer().create(request);
result.isSuccess();
// true
Customer customer = result.getTarget();
customer.getId();
// e.g. 160923
customer.getPaymentMethods().get(0).getToken();
// e.g. f28w here I got the payment method token which I can store on my end
https://developer.paypal.com/braintree/docs/guides/ payment-methods/java
PaymentMethodRequest request = new PaymentMethodRequest()
.customerId("131866") // I don't need customerID, can I just put some dummy value?
.paymentMethodNonce(nonceFromTheClient);
Result<? extends PaymentMethod> result = gateway.paymentMethod().create(request);
我走在正确的道路上吗?哪种方法是正确的? (如果是新客户,我不关心客户ID?)
谢谢!