繁体   English   中英

使用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

成功将卡保存到Vault中后,它给了我一个令牌为了检索卡中的数据,我这样做:

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

并向我退还了卡的详细信息,现在我要使用该卡的详细信息或令牌进行付款(因为我很困惑)。 以前我通过UI下降成功完成了付款,但是这次我想使用保管库

全面披露:我在Braintree工作。 如果您还有其他疑问,请随时与支持小组联系。

现在,您已经具有付款方式令牌 ,可以将该值作为参数传递给Transaction Sale API调用 ,以使用保存的付款方式完成交易,而不是代表一次性使用付款方式的付款方式现时

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

暂无
暂无

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

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