【问题标题】:What are valid payment-method-tokens?什么是有效的支付方式令牌?
【发布时间】:2016-12-06 23:58:41
【问题描述】:

我正在尝试创建信用卡,因此我需要致电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();

但是,文档中没有关于有效令牌的信息。 herehere 都不是——还是我只是瞎了眼?

【问题讨论】:

    标签: paypal braintree


    【解决方案1】:

    全面披露:我在 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);
    

    【讨论】:

    • 我们如何检索 payment_method_nonce?
    • 你能在服务器端创建一个支付随机数吗?
    猜你喜欢
    • 2015-05-30
    • 2016-12-09
    • 2014-02-02
    • 2016-07-18
    • 1970-01-01
    • 2013-11-18
    • 2016-12-06
    • 2012-09-04
    • 2016-02-19
    相关资源
    最近更新 更多