【问题标题】:Omnipay with 2Checkout ErrorOmnipay 出现 2Checkout 错误
【发布时间】:2015-10-21 17:04:49
【问题描述】:

我收到一个错误Error Code:PE101

docs 这么说;

没有传入“sid”参数的值/无效值。

好吧,我使用的是Omnipay for 2Checkout,它似乎是在要求AccountNumber——而不是sid。

查看help,他们似乎暗示sid 与帐号相同;

sid – 您的 2Checkout 帐号。 (最多 64 个字符)

那是什么?如何设置sid 没有setSid() 方法!

目前,我的代码是;

    $gateway = Omnipay::create('TwoCheckout');
    $gateway->setAccountNumber($accountId);
    $gateway->setSecretWord($secretWord);

    $response = $gateway->purchase(array(
        'returnUrl' => $returnUrl . '?' . http_build_query($arguments),
        'cancelUrl' => $cancelUrl,
        'amount' => $payment->getAmount(),
        'description' => $description,
        'transactionId' => $paymentId
    ))->send();

    $result = $response->getRedirectData();

print_r($response->getData());的结果

abort: (a)
always: ()
complete: ()
done: ()
error: ()
fail: ()
getAllResponseHeaders: ()
getResponseHeader: (a)
overrideMimeType: (a)
pipe: ()
progress: ()
promise: (a)
readyState: 4
responseText: "Array↵(↵ [sid] => 901294374↵ [cart_order_id] => fmXkqNGlOshGspuxYXhL37eyLikXziuw↵ [merchant_order_id] => fmXkqNGlOshGspuxYXhL37eyLikXziuw↵ [total] => 61.00↵ [tco_currency] => ↵ [fixed] => Y↵ [skip_landing] => 1↵ [x_receipt_link_url] => https://checkout.example.dev/ecommerce/payment/complete?paymentId=fmXkqNGlOshGspuxYXhL37eyLikXziuw&pending=1&twocheckout=1↵)↵{"paymentId":"fmXkqNGlOshGspuxYXhL37eyLikXziuw","url":"\/ecommerce\/checkout\/postredirect?softwareVersion=7.66\u0026checkoutUrl=https%3A%2F%2Fwww.2checkout.com%2Fcheckout%2Fpurchase\u0026paymentId=fmXkqNGlOshGspuxYXhL37eyLikXziuw"}"
setRequestHeader: (a,b)
state: ()
status: 200
statusCode: (a)
statusText: "OK"
success: ()
then: ()
__proto__: Object

【问题讨论】:

    标签: omnipay 2checkout


    【解决方案1】:

    很抱歉将此作为“答案”,我还不能离开 cmets。

    Omnipay-2checkout 已经将 accountNumber 参数作为“sid”传递给 2checkout(参见 here)。尝试根据您的请求致电getData,以查看传递给他们的确切信息:

    $gateway = Omnipay::create('TwoCheckout');
    $gateway->setAccountNumber($accountId);
    $gateway->setSecretWord($secretWord);
    
    $response = $gateway->purchase(array(
        'returnUrl' => $returnUrl . '?' . http_build_query($arguments),
        'cancelUrl' => $cancelUrl,
        'amount' => $payment->getAmount(),
        'description' => $description,
        'transactionId' => $paymentId
    ));
    
    var_dump($response->getData());
    

    还值得检查您使用的是correct 帐号。

    【讨论】:

    • 好的,x_receipt_link_url 的值是否被传递给 Omnipay?结果对我来说看起来不错,你能看出什么问题吗? - 我已经更新了我的答案
    • @mike3875 虽然我从未在生产中使用过 2checkout,但 $response->getRedirectUrl() 应该会为您提供您需要发送用户以输入其帐单详细信息的 URL。
    猜你喜欢
    • 2016-08-15
    • 1970-01-01
    • 2016-02-19
    • 2015-11-21
    • 2015-04-10
    • 2014-12-07
    • 2020-09-24
    • 2018-01-01
    • 1970-01-01
    相关资源
    最近更新 更多