gpt4 book ai didi

javascript - 使用 Braintree 付款从保险库中检索数据

转载 作者:太空宇宙 更新时间:2023-11-03 16:14:00 25 4
gpt4 key购买 nike

我首先在 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

成功将卡保存在保险库中后,它会给我一个 token 为了检索卡的数据,我这样做了:

$result = $this->gateway->creditCard()->find($token);

它返回给我卡的详细信息,现在我想用这个卡的详细信息或 token 执行付款(因为我很困惑)。之前我使用 drop in UI 成功完成了付款,但这次我想使用 vault

最佳答案

完全披露:我在 Braintree 工作。如果您有任何其他问题,请随时联系 support .

现在您有了 payment method token ,您可以将该值作为参数传递给 Transaction Sale API Call为了使用保存的付款方式完成交易而不是 payment method nonce ,代表一次性使用的支付方式。

示例

$result = $gateway->transaction()->sale(
[
'paymentMethodToken' => 'the_payment_method_token',
'amount' => '100.00'
]
);

关于javascript - 使用 Braintree 付款从保险库中检索数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49297356/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com