Sat*_*tys 5 php paypal payment-gateway paypal-sandbox
我正在尝试集成贝宝,但遇到了这个错误。
我们很抱歉。该卖家不接受以您的货币付款。请返回卖家并选择其他付款方式。
我设置的货币是美元。我没有阻止它,我已将它添加到我的帐户中。
这是代码,我使用的是 PHP。
$transaction_value = $this->payment_detail['amount'];
// $this->response($transaction_value);
$apiContext = new \PayPal\Rest\ApiContext(new \PayPal\Auth\OAuthTokenCredential(PAYPAL_CLIENTID,PAYPAL_SECRET));
$payer = new \PayPal\Api\Payer();
$payer->setPaymentMethod('paypal');
$amount = new \PayPal\Api\Amount();
$amount->setTotal($transaction_value);
$amount->setCurrency($this->payment_detail['currency']);
// $amount->setCurrency('INR');
$transaction = new \PayPal\Api\Transaction();
$transaction->setAmount($amount);
$redirectUrls = new \PayPal\Api\RedirectUrls();
$redirectUrls->setReturnUrl(PROTOCOL.base_url().'pay/api/process')
->setCancelUrl(PROTOCOL.base_url().'home');
$payment = new \PayPal\Api\Payment();
$payment->setIntent('sale')
->setPayer($payer)
->setTransactions(array($transaction))
->setRedirectUrls($redirectUrls);
try {
$payment->create($apiContext);
// $this->response(array("paymentId" => $payment->id));
header('Location: '.$payment->getApprovalLink());
exit(0);
// echo $payment;
// echo "\n\nRedirect user to approval_url: " . $payment->getApprovalLink() . "\n";
}
catch (\PayPal\Exception\PayPalConnectionException $ex) {
// This will print the detailed information on the exception.
//REALLY HELPFUL FOR DEBUGGING
echo $ex->getData();
}
Run Code Online (Sandbox Code Playgroud)
所以我找到了解决这个问题的方法。
只需登录商家帐户(可能是沙盒帐户)(例如:someone-facilitator@domain)。
然后单击仪表板右上角的齿轮图标打开设置页面。
现在,从左侧边栏单击“销售工具”,然后单击“获取付款和管理我的风险”部分下“批量付款”前面的“更新按钮”。
请参阅所附图片。
现在,在“接收付款首选项”部分中,针对“允许以我不持有的货币向我发送付款:”问题选择“是,接受...”。
就是这样。
| 归档时间: |
|
| 查看次数: |
12814 次 |
| 最近记录: |