【问题标题】:How to process existing customer payment method when using hosted fields?使用托管字段时如何处理现有的客户付款方式?
【发布时间】:2016-05-21 17:17:19
【问题描述】:

我正在使用 Braintree 托管字段来处理付款,但是在查找或查找如何为客户提交现有付款方式的示例时遇到问题。使用braintree_customer_id,我可以检索客户信息,包括包含最后4 位数字、cardType、令牌和其他信息的creditCards 数组。由于我使用的是托管字段,所以我使用的 javascript 看起来像:

braintree.setup("<?= $clientToken ?>", 'custom', {
  id: 'my-form',
  hostedFields: {
    styles: {
      'input': {
        'font-family': '"Helvetica Neue", Helvetica, Arial, sans-serif',
        'font-size': '14px',
      },
      '::-moz-placeholder': { 'color': '#999' },
      ':-ms-input-placeholder': { 'color': '#999' },
      '::-webkit-input-placeholder': { 'color': '#999' },
    },
    number: {
      selector: '#hosted-fields-number',
      placeholder: 'Credit Card Number'
    },onFieldEvent: handleFieldEvent,
    cvv: {
      selector: '#hosted-fields-cvv',
      placeholder: 'CVV'
    },
    expirationDate: {
      selector: '#hosted-fields-expiration',
      placeholder: 'Expiration Date'
    }
  }, onPaymentMethodReceived: function (obj) {
        var nonce = obj.nonce;
        console.log(obj);
        if(nonce){
            final_checkout(nonce);
        }
    },
    onError: function (){
        alert('wrong details');
    }
});

我如何获得能够执行我的付款流程所需的付款方式 nonce?下面的示例使用托管字段,如何使用 customer_id 和 token 处理现有客户?

【问题讨论】:

    标签: javascript php braintree


    【解决方案1】:

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

    通过paymentMethodToken 向特定客户的付款方式收费。由于此信息不是 PCI 敏感数据,您可以将其直接传递到您的服务器并拨打Braintree_Transaction::salecall。这可以在托管字段流之外完成。您可以让客户指定特定的付款方式或输入新付款方式的信息。

    【讨论】:

    • 感谢您的回复,我已通过将卡令牌与托管字段流分开传递来成功处理沙盒中的交易,因为插件使用相同的脚本,我有点困惑。跨度>
    猜你喜欢
    • 2017-01-07
    • 1970-01-01
    • 2015-10-13
    • 2018-12-12
    • 2021-08-13
    • 2015-06-07
    • 2018-01-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多