0

我收到一个错误Error Code:PE101

文档是这样说的;

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

好吧,我正在为 2Checkout 使用 Omnipay,这似乎是在要求AccountNumber-not sid

查看他们似乎暗示与帐号相同的帮助;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
4

1 回答 1

0

很抱歉将此作为“答案”,我还无法发表评论。

Omnipay-2checkout 已经将 accountNumber 参数作为“sid”传递给 2checkout(参见此处)。尝试调用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());

检查您是否使用了正确的帐号也是值得的。

于 2015-10-22T07:51:22.953 回答