简体   繁体   English

Braintree PHP 如何在没有 DropIn 的情况下获取 Nonce 以进行 Vaulting

[英]Braintree PHP How To Get Nonce Without DropIn for Vaulting

For our use case, we have an existing form that captures the customer's credit card information.对于我们的用例,我们有一个捕获客户信用卡信息的现有表单。 To smooth out the transition from one payment processor to the next since we're not sure when that will happen, we would like to vault the payment method in Braintree without charging the card but keep our existing form.为了顺利地从一个支付处理器过渡到下一个,因为我们不确定何时会发生这种情况,我们希望在不向卡收费的情况下在 Braintree 中存储支付方式,但保留我们现有的表格。

I see how to vault the nonce that we receive from the Drop-In UI, and I was able to find an answer on SO that described how to pass the payment information directly to Braintree and charging it, however, I have had no luck in finding a way to just pass the card information to braintree for the purposes of vaulting the payment method (with or without the intermediate step of receiving a nonce).我看到了如何保管我们从 Drop-In UI 收到的随机数,并且我能够在 SO 上找到一个答案,该答案描述了如何将付款信息直接传递给 Braintree 并对其进行收费,但是,我没有运气找到一种将卡信息传递给braintree的方法,以存储支付方式(有或没有接收随机数的中间步骤)。

EDIT: I've discovered the $gateway->customer()->create() and $gateway->creditCard()->create() functions, however, of the various 'unique identifiers' returned from the credit card create call, none of them appear to be vaultable.编辑:我发现了$gateway->customer()->create()$gateway->creditCard()->create()函数,但是,从信用卡创建调用返回的各种“唯一标识符” ,它们似乎都不是可保管的。

It was buried a bit in the documentation, but I was able to do this with an intermediate step:它在文档中被隐藏了一点,但我可以通过一个中间步骤来做到这一点:

  1. create customer $gateway->customer()->create(...)创建客户$gateway->customer()->create(...)
  2. create credit card $gateway->creditCard()->create(...)创建信用卡$gateway->creditCard()->create(...)
  3. take the token from the previous call and pass it to $gateway->paymentMethodNonce()->create(..)从上一次调用中获取令牌并将其传递给$gateway->paymentMethodNonce()->create(..)
  4. then take the customer id and the newly created nonce and passed them to $gateway->paymentMethod()->create(...)然后获取客户 ID 和新创建的 nonce 并将它们传递给$gateway->paymentMethod()->create(...)
  5. the necessary vault token was stored in the results object $result->paymentMethod->graphQLId必要的保险库令牌存储在结果 object $result->paymentMethod->graphQLId

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM