首页 文章

Braintree支付网关 - 获取客户信息

提问于
浏览
2

我在我的网络应用程序中使用Braintree支付网关 . 我想知道我是否可以从中获取用户信息 .

我无法保存卡的详细信息,这是不允许的 . 但是如果我需要为同一个用户运行另一个交易,我可以从Braintree本身获取他的信息并自动填写卡的详细信息吗?

2 回答

  • 1

    我在布伦特里工作 . 如果您想了解比Stack Overflow更多的信息,请联系我们的支持团队 .

    像Braintree这样的支付网关的主要优势之一是它们可以在不必接触信用卡信息的情况下对信用卡信息进行标记 .

    基本上,您使用Braintree.js加密浏览器中的卡信息,以便您的服务器永远不会看到它 .

    然后,您将该加密信息传递给Braintree . 作为回报,您将获得一个像 "xg67ba" 这样的令牌,您可以在以后再次使用该令牌为同一张卡充电:

    result = Braintree::Transaction.sale(
      :amount => "100.00",
      :customer => {
        :first_name => "Dan",
        :last_name => "Smith"
      },
      :credit_card => {
        :number => "encryped_credit_card_number",
        :expiration_date => "encryped_expiration_date",
        :cvv => "encrypted_cvv"
      },
      :options => {
        :store_in_vault => true
      }
    )
    
    result.transaction.customer_details.id
    #=> e.g. "131866"
    result.transaction.credit_card_details.token
    #=> e.g. "f6j8"
    

    所以下次,它看起来像:

    result = Braintree::Transaction.sale(
      :amount => "10.00",
      :customer_id => "131866",
      :credit_card => {:cvv => 'encrypted_cvv'}
    )
    

    每张信用卡都与客户相关联,因此如果您只想为客户的/默认卡充值,您只需提供 customer id 即可 . 建议再次从客户那里获取 cvv (不允许任何人存储),但不是必需的 .

  • 5

    获得客户ID后,您可以使用以下PHP代码获取客户详细信息 .

    $customerId = 67222186;  
       try{
           $result = Braintree_Customer::find($customerId); 
          echo $result->id; echo "\n";
          echo $result->firstName; echo "\n";
          echo $result->lastName; echo "\n";
          echo $result->email; echo "\n";
          echo $result->phone; echo "\n";
       }  catch (Exception $e){
        echo $e->getMessage();
      }
    

    http://www.web-technology-experts-notes.in/2015/06/manage-customer-details-in-braintree.html

相关问题