gpt4 book ai didi

paypal - 什么是有效的支付方式 token ?

转载 作者:太空宇宙 更新时间:2023-11-03 16:24:26 24 4
gpt4 key购买 nike

我正在尝试创建一张信用卡,因此我需要调用 paymentMethodNone()。根据文档我可以

Use PaymentMethod.create() to create a payment method for an existing customer:

// 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();

但是,文档中没有关于有效 token 的信息。都不是here也不here - 还是我只是瞎了眼?

最佳答案

完全披露:我在 Braintree 工作。如果您还有任何疑问,请随时联系support .

您不需要 payment_method_token 来创建 PaymentMethod

要创建信用卡,您需要创建一个 PaymentMethod .首先,从传入请求中检索 payment_method_nonce。接下来,使用 PaymentMethodRequest 创建 PaymentMethod

//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);

关于paypal - 什么是有效的支付方式 token ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38706728/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com