【问题标题】:What are the correct values for PayPal secure checkout with basket?使用购物篮的 PayPal 安全结账的正确值是多少?
【发布时间】:2011-07-29 22:18:45
【问题描述】:

我的购物车在未加密的情况下可以通过 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()));
}

【问题讨论】:

  • 我建议您在这里提问:webapps.stackexchange.com
  • 感谢您的回复。我并没有真正尝试使用网络应用程序,我正在使用 PayPal 的 API 编写代码,所以我不确定 webapps 网站是否适合发布问题。

标签: paypal shopping-cart


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2013-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-21
    • 2014-05-13
    • 2018-04-21
    • 2019-05-26
    • 1970-01-01
    相关资源
    最近更新 更多