贝宝创建计费协议,给出了取消URL错误

时间:2018-08-29 10:07:14

标签: php paypal sdk subscription

我正在使用PHP SDK实现Paypal的订阅。两天前,一切运行正常。但是今天,我正在为我的站点创建一个新的计费计划,它给了我错误,这很奇怪。

PayPal\Exception\PayPalConnectionException Object
(
    [url:PayPal\Exception\PayPalConnectionException:private] => https://api.sandbox.paypal.com/v1/payments/billing-plans/
    [data:PayPal\Exception\PayPalConnectionException:private] => {"name":"VALIDATION_ERROR","details":[{"field":"merchant_preferences.cancel_url","issue":"Missing/Invalid URL entered.Max length is 2048"}],"message":"Invalid request. See details.","information_link":"https://developer.paypal.com/docs/api/payments.billing-plans#errors","debug_id":"74013e96ce3e"}
    [message:protected] => Got Http response code 400 when accessing https://api.sandbox.paypal.com/v1/payments/billing-plans/.
    [string:Exception:private] => 
    [code:protected] => 400
    [file:protected] => E:\xampp\htdocs\www\paypalDemo\PayPal-PHP-SDK\paypal\rest-api-sdk-php\lib\PayPal\Core\PayPalHttpConnection.php
    [line:protected] => 202
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => E:\xampp\htdocs\www\paypalDemo\PayPal-PHP-SDK\paypal\rest-api-sdk-php\lib\PayPal\Transport\PayPalRestCall.php
                    [line] => 78
                    [function] => execute
                    [class] => PayPal\Core\PayPalHttpConnection
                    [type] => ->
                    [args] => Array
                        (
                            [0] => {"name":"Monthly Basic Plan","description":"Basic Plan.","type":"fixed","payment_definitions":[{"name":"Regular Payments","type":"REGULAR","frequency":"Year","frequency_interval":"1","cycles":"90","amount":{"value":"297","currency":"USD"}}],"merchant_preferences":{"return_url":"http://localhost/www/paypalDemo/ExecuteAgreement.php?success=false","auto_bill_amount":"yes","initial_fail_amount_action":"CONTINUE","max_fail_attempts":"0"}}
                        )

                )

            [1] => Array
                (
                    [file] => E:\xampp\htdocs\www\paypalDemo\PayPal-PHP-SDK\paypal\rest-api-sdk-php\lib\PayPal\Common\PayPalResourceModel.php
                    [line] => 104
                    [function] => execute
                    [class] => PayPal\Transport\PayPalRestCall
                    [type] => ->
                    [args] => Array
                        (
                            [0] => Array
                                (
                                    [0] => PayPal\Handler\RestHandler
                                )

                            [1] => /v1/payments/billing-plans/
                            [2] => POST
                            [3] => {"name":"Monthly Basic Plan","description":"Basic Plan.","type":"fixed","payment_definitions":[{"name":"Regular Payments","type":"REGULAR","frequency":"Year","frequency_interval":"1","cycles":"90","amount":{"value":"297","currency":"USD"}}],"merchant_preferences":{"return_url":"http://localhost/www/paypalDemo/ExecuteAgreement.php?success=false","auto_bill_amount":"yes","initial_fail_amount_action":"CONTINUE","max_fail_attempts":"0"}}
                            [4] => 
                        )

                )

            [2] => Array
                (
                    [file] => E:\xampp\htdocs\www\paypalDemo\PayPal-PHP-SDK\paypal\rest-api-sdk-php\lib\PayPal\Api\Plan.php
                    [line] => 363
                    [function] => executeCall
                    [class] => PayPal\Common\PayPalResourceModel
                    [type] => ::
                    [args] => Array
                        (
                            [0] => /v1/payments/billing-plans/
                            [1] => POST
                            [2] => {"name":"Monthly Basic Plan","description":"Basic Plan.","type":"fixed","payment_definitions":[{"name":"Regular Payments","type":"REGULAR","frequency":"Year","frequency_interval":"1","cycles":"90","amount":{"value":"297","currency":"USD"}}],"merchant_preferences":{"return_url":"http://localhost/www/paypalDemo/ExecuteAgreement.php?success=false","auto_bill_amount":"yes","initial_fail_amount_action":"CONTINUE","max_fail_attempts":"0"}}
)

这是我用来创建结算计划的代码。

$merchantPreferences = new MerchantPreferences();

$merchantPreferences->setReturnUrl("http://localhost/www/paypalDemo/ExecuteAgreement.php?success=true")
    ->setCancelUrl("http://localhost/www/paypalDemo/ExecuteAgreement.php?success=false")
    ->setAutoBillAmount("yes")
    ->setInitialFailAmountAction("CONTINUE")
    ->setMaxFailAttempts("0");

我的代码没有任何变化,它一直在起作用,但是今天它给了我这个例外。

0 个答案:

没有答案