Braintree php后端

时间:2017-04-13 08:11:41

标签: php braintree

我从https://github.com/braintree/braintree_php_example克隆braintree项目。比我创建帐户https://www.braintreepayments.com/sandbox。我必须返回client_token。我调试了这段代码

$result = Braintree\Transaction::sale([
    'amount' => $amount,
    'paymentMethodNonce' => $nonce,
    'options' => [
        'submitForSettlement' => true
    ]
]);
var_dump($result->transaction);

但令牌= null。也许我的步骤不正确?

//////////////////////////////// 我做的! 我创建了用户

$result = Braintree_Customer::create([
'firstName' => 'Mike',
'lastName' => 'Jones',
'company' => 'Jones Co.',
'email' => 'mike.jones@example.com',
'phone' => '281.330.8004',
'fax' => '419.555.1235',
'website' => 'http://example.com']);

比我得到customer_id

$result->customer->id;

比得到令牌

$clientToken = Braintree_ClientToken::generate([
    "customerId" => $result->customer->id
]);

https://www.braintreepayments.com/sandbox中的自定义注册可能存在问题。

也许我没有提供所有信息

0 个答案:

没有答案