脑树自动续费有什么方法?

时间:2019-11-15 11:51:51

标签: php laravel braintree braintree-sandbox

嗨,我正在使用braintree(braintree / braintree_php“:” 4.5.0)。我已经在网络中实现了3dsecure。它工作正常。我需要使用PaymentMethodToken自动续订付款。下面的代码我已用于自动续订。

$trans = [
            'amount' => "14.63",
            'merchantAccountId' => "Vo**ID",
            'paymentMethodToken' =>"token",
            'transactionSource' => "recurring",
            'customFields' => [
                'client_id' => "id",
                'service_id' => "id",
                'invoice_id' => "id",
                'action' => "autorenew",
                'slots' => "15",
            ],
            'options' => [
                'submitForSettlement' => true,
                'storeInVaultOnSuccess' => true,
                'paypal' => [
                    'description' =>"Renew server",
                ]
            ]
        ];
 $transaction = $gateway->transaction()->sale($trans);

运行此代码时,我得到以下错误

  

Util.php第59行中的授权:

上面的代码在用户输入要支付的信用卡信息时有效。这仅在我使用PaymentMethodToken进行付款以自动续费时才会出错。

参考:https://developers.braintreepayments.com/guides/paypal/server-side/php

1 个答案:

答案 0 :(得分:0)

据我了解您的要求。您需要进行自动付款。

为此,布伦特里(Braintree)提供了执行此操作的最佳方法,称为Subscription

如果需要更多帮助,请告诉我。