使用 Braintree 付款从保险库中检索数据
Payment with Braintree retrieving data from vault
我首先在API的帮助下创建了一个客户,当一个客户创建成功时它返回给我customerId,在customerId的帮助下我创建了一张信用卡。
// for creating user
gateway->customer()->create([
'firstName' => $firstName,
'lastName' => $lastName,
'company' => $company,
'email' => $email,
'phone' => $phone,
'fax' => $fax,
'website' => $website
]);
//for creating card
$result = $this->gateway->creditCard()->create([
'customerId' => $customerId,
'number' => $number,
'expirationDate' => $expirationDate,
'cvv' => $cvv
成功将卡保存在保险库中后,它会给我一个 令牌 为了检索卡的数据,我这样做了:
$result = $this->gateway->creditCard()->find($token);
它返回给我卡的详细信息,现在我想用这个卡的详细信息或令牌执行付款(因为我很困惑)。之前我通过 drop in UI 成功完成了付款,但这次我想使用 vault
完全披露:我在 Braintree 工作。如果您有任何其他问题,请随时联系
support.
现在您有了 payment method token, you can pass that value as a parameter to the Transaction Sale API Call in order to complete a transaction with the saved payment method as opposed to a payment method nonce,它代表一次性付款方式。
例子
$result = $gateway->transaction()->sale(
[
'paymentMethodToken' => 'the_payment_method_token',
'amount' => '100.00'
]
);
我首先在API的帮助下创建了一个客户,当一个客户创建成功时它返回给我customerId,在customerId的帮助下我创建了一张信用卡。
// for creating user
gateway->customer()->create([
'firstName' => $firstName,
'lastName' => $lastName,
'company' => $company,
'email' => $email,
'phone' => $phone,
'fax' => $fax,
'website' => $website
]);
//for creating card
$result = $this->gateway->creditCard()->create([
'customerId' => $customerId,
'number' => $number,
'expirationDate' => $expirationDate,
'cvv' => $cvv
成功将卡保存在保险库中后,它会给我一个 令牌 为了检索卡的数据,我这样做了:
$result = $this->gateway->creditCard()->find($token);
它返回给我卡的详细信息,现在我想用这个卡的详细信息或令牌执行付款(因为我很困惑)。之前我通过 drop in UI 成功完成了付款,但这次我想使用 vault
完全披露:我在 Braintree 工作。如果您有任何其他问题,请随时联系 support.
现在您有了 payment method token, you can pass that value as a parameter to the Transaction Sale API Call in order to complete a transaction with the saved payment method as opposed to a payment method nonce,它代表一次性付款方式。
例子
$result = $gateway->transaction()->sale(
[
'paymentMethodToken' => 'the_payment_method_token',
'amount' => '100.00'
]
);