我正在开发一个需要访问PayPal的应用程序。我使用php-rest-paypal sdk。在我的Sandbox帐户中,您可以看到绿色检查的api电话,在我使用沙箱帐户完成付款后,我的“买家”或“服务商”中没有显示活动 - 帐户?
我尝试使用谷歌,但似乎我是唯一一个遇到此问题的人。
这是我的代码:
$apiContext = new ApiContext(
new OAuthTokenCredential(
$this->clientID,
$this->clientSecret)
);
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$amount = new Amount();
$amount->setCurrency('EUR');
$amount->setTotal($order->getSum());
$transaction = new Transaction();
$transaction->setAmount($amount);
$redirectUrls = new \PayPal\Api\RedirectUrls();
$redirectUrls->setReturnUrl("http://localhost:8080/checkout/confirm");
$redirectUrls->setCancelUrl("http://localhost:8080/checkout/summary");
$payment = new Payment();
$payment->setIntent('sale')
->setPayer($payer)
->setTransactions(array($transaction))
->setRedirectUrls($redirectUrls);
try {
$payment->create($apiContext);
echo "\n\nRedirect user to approval_url: " . $payment->getApprovalLink() . "\n";
}
catch (\PayPal\Exception\PayPalConnectionException $ex) {
file_get_contents(CURRENT_PROJECT_DIRECTORY.'/tmp/paypal-log.log', $ex->getData());
}
有人可以给我一些提示吗?我做错了吗?