首页 文章

使用购物篮的PayPal安全结账的正确值是什么?

提问于
浏览
0

当PayPal未加密时,我已经能够使我的购物车正常工作,但在转移到加密表格时我无法进行更新 .

[这是目前全部使用沙箱网站]

我上传了我的安全证书等,并且值的加密似乎没问题 .

我的未加密表单使用_cart作为cmd . 使用此我收到错误消息“我们已检测到此购物车有问题 . 如果问题仍然存在,请与商家联系 . ” .

因此,由于“正常”结帐命令在转移到加密付款时从_xclick更改为_s-xclick,我接下来尝试使用_s-cart作为命令 . 这会导致出现错误消息“您已请求过期的PayPal版本 . 此错误通常是由于使用书签造成的 . ”哪个有用 .

我的购物车的加密值包含cmd值_cart,如购物车结帐文档中所示 .

有谁知道正确的值应该是什么? PayPal开发人员文档包含购物车结帐和单项加密结帐的样本,但没有(我已经能够找到)购物车加密结帐 .

我的加密表单目前看起来像这样:

<form id="Paypal" name="Paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-cart">
    <input type="hidden" name="encrypted" value="@ViewBag.EncryptedBasket" />
    <button type="submit" id="paypal-checkout-button" value="PayPal">Checkout</button>
</form>

我的加密值是:

var valuePairs = (new[]
    {
        new KeyValuePair<string, string>("cmd", "_cart"),
        new KeyValuePair<string, string>("upload", "1"),
        new KeyValuePair<string, string>("business", Globals.Settings.PayPal.AccountEmail),
        new KeyValuePair<string, string>("currency_code", Globals.Settings.PayPal.CurrencyCode),
        new KeyValuePair<string, string>("return", returnUrl),
        new KeyValuePair<string, string>("cancel_return", cancelUrl),
        new KeyValuePair<string, string>("cert_id", Globals.Settings.PayPal.CertificateId),
    }).ToList();

for (int i = 0; i < ShoppingCart.Items.Count; i++)
{
    var index = i + 1;
    var item = ShoppingCart.Items[i];

    valuePairs.Add(new KeyValuePair<string, string>("amount_" + index, item.Product.FinalUnitPrice.ToString("N2")));
    valuePairs.Add(new KeyValuePair<string, string>("item_name_" + index, item.Product.Title));
    valuePairs.Add(new KeyValuePair<string, string>("item_number_" + index, item.Product.ProductId.ToString()));
    valuePairs.Add(new KeyValuePair<string, string>("quantity_" + index, item.Quantity.ToString()));
}

1 回答

  • 0

    如果其他人想知道,每次使用加密付款时都应使用_s-xclick命令,然后可以使用_cart命令加密项目,并确保将参数upload = 1添加到请求中 .

相关问题