我在 Laravel 中创建计费协议(protocol)时遇到错误。这是错误。
访问时得到 Http 响应代码 500 https://api.sandbox.paypal.com/v1/payments/billing-agreements/ .
{"name":"INTERNAL_SERVICE_ERROR","message":"An internal service error has occurred","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#INTERNAL_SERVICE_ERROR","debug_id":"*********"}
这是我的代码:
$payerInfo = new PayerInfo();
$payerInfo->setFirstName($user->first_name)
->setLastName($user->last_name)
->setEmail($user->email);
$payer = new Payer();
$payer->setPaymentMethod('paypal')
->setPayerInfo($payerInfo);
$newPlan = new Plan();
$newPlan->setId($plan_id);
$agreement = new Agreement();
$agreement->setName($plan[0]->name.' Subscription')
->setDescription($plan[0]->name." Subscription")
->setStartDate(gmdate("Y-m-d\TH:i:s\Z", time()+60))
->setPayer($payer)
->setPlan($newPlan);
try {
$agreement->create($api_context);
} catch(PayPal\Exception\PayPalConnectionException $e) {
echo $ex->getCode(); // Prints the Error Code
echo $ex->getData(); // Prints the detailed error message
die($ex);
}
任何人都可以指导我哪里出错了吗?
最佳答案
Paypal 有时会在使用经常使用的测试 CC 时抛出错误 500,例如您正在使用的测试 CC,因此请尝试使用另一个测试 CC 或尝试使用真实的 CC 号码,只要您处于沙盒模式,它就不会向您收费或类似的东西那个。
关于php - 尝试为 paypal 创建计费协议(protocol)时出现 Http 响应代码 500 错误 - PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37813459/