繁体   English   中英

使用Omnipay的PayPal Express Checkout未在Sandbox帐户中显示订单

[英]PayPal Express Checkout with Omnipay not showing order in Sandbox account

我在我的网站上使用了Omnipay PayPal_Express结账脚本,当我支付订单时一切正常,但订单没有显示在PayPal Sandbox帐户中。

当我为PayPal_Pro使用相同的脚本时,它会显示。

我的代码如下:

use Omnipay\Omnipay;

// PayPal Express:

if(isset($_POST['paypalexpress'])) {

$gateway = GatewayFactory::create('PayPal_Express');
$gateway->setUsername('{myusername}');
$gateway->setPassword('{mypassword}');
$gateway->setSignature('{mysignauture}');
$gateway->setTestMode(true);

$response = $gateway->purchase(
array(
    'cancelUrl'=>'http://www.mysite.com/?cancelled',
    'returnUrl'=>'http://www.mysite.com/?success',
    'amount' =>  "12.99",
    'currency' => 'GBP',
    'Description' => 'Test Purchase for 12.99'
    )

 )->send();

$response->redirect();
}

我在Sandbox中创建了两个测试帐户,一个用于上面的API,另一个用于支付。 我已尝试使用测试卡详细信息和登录信息付款,但订单详细信息未显示在帐户中。

有人可以帮忙吗?

当Paypal返回到returnUrl时,您似乎错过了completePurchase()部分。 我的代码假设您在变量$ order中有订单详细信息,但它可能看起来像这样:

if(isset($_GET['success'])) {
    $response = $gateway->completePurchase(array(
        'transactionId' => $order->transaction,
        'transactionReference' => $order->reference,
        'amount' => $order->total,
        'currency' => $order->currency,
    ))->send();

    if ( ! $response->isSuccessful())
    {
        throw new Exception($response->getMessage());
    }
}

如果您在返回时需要任何帮助来检索订单详细信息,请与我们联系。 它可以在重定向之前存储在会话中,也可以存储在数据库中。 如果您还没有,请查看示例代码: https//github.com/omnipay/example/blob/master/index.php

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM