【问题标题】:I am trying to get custom date to pass to PayPal我正在尝试将自定义日期传递给 PayPal
【发布时间】:2021-10-19 18:21:45
【问题描述】:

我正在尝试使用自定义变量 <input type="hidden" name="custom" value="SansburyTech|Purchase of a ToolCart|Dewalt Roller|SKU:164604646|Cost:163.50"> 将这行产品信息传递到 PayPal 表单,但它没有发生?

我做错了什么或忽略了什么?在PayPalDocs 上,它特别指出:以下是传递变量: customitem_numberitem_number_x发票

这里以我的完整 HTML Paypal 表单为例;

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="margin:0;padding:0;" target="PayPal">
          <input type="hidden" name="business" value="">
          <input type="hidden" name="cmd" value="_xclick">
          <input type="hidden" name="item_name" value="Toolcart">
          <input type="hidden" name="item_number" value="Dewalt Roller">
          <input
            type="hidden"
            name="custom"
            value="SansburyTech|Purchase of a ToolCart|Dewalt Roller|SKU:164604646|Cost:163.50">
          <input type="hidden" name="amount" value="244.50">
          <input type="hidden" name="currency_code" value="USD">
          <input type="hidden" name="receiver_email" value="">
          <input type="hidden" name="return" value="https://toolcart.info/pickup">
          <input type="hidden" name="no_note" value="0">
          <input type="image" src="/wp-content/themes/toolcart-theme/images/paypal.png" class="img-fluid" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
          <img border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
        </form>

将非常感谢任何答案! ~ 谢谢!

【问题讨论】:

  • 这可能是因为您的 custom 值中有符号,例如管道和冒号。我建议您对其进行 Base64 编码以确保安全。 (但你很好 w.r.t. 长度限制,即 255 个字符,你的值只有 76)。
  • 您是如何准确地读出变量的? (即它在哪里不起作用?)请发布您处理 IPN 或其他 PayPal 消息的 PHP 代码。
  • 但它没有发生是什么意思?请注意,IPN 回调中使用了自定义字段值。
  • 我只对在电子邮件中获取该自定义字段感兴趣,然后将其传递给 Zapier 并解析为 Quickbooks,但由于某种原因,该行没有传递到 PayPal 交易电子邮件中?
  • @ShrockCo custom 值不包含在任何 PayPal 生成的电子邮件中。它只出现在 IPN 消息和(我认为?)当用户被重定向回您的站点时。此外,Zapier 可能不是自动化 PayPal 的最佳工具(Zapier 并没有什么坏处,只是 PayPal 实在是太糟糕了,以至于你总是不得不自己编写手动代码)。跨度>

标签: php html wordpress forms paypal


【解决方案1】:

将我的评论转换为答案(为了那甜蜜的业力)。


OP 正在寻找custom 变量出现在 PayPal 生成的电子邮件消息中,这些电子邮件消息将被发送回商家帐户持有人(或客户)。这是行不通的,因为 PayPal 没有在任何电子邮件消息中包含 custom 变量:它只包含在 IPN 消息中。

【讨论】:

    【解决方案2】:

    通常最好的解决方案是只传递一个唯一标识符并将其余部分存储在您自己的数据库中。

    但是,如果您必须在任意 custom 字段中传递多个值,则示例中的管道似乎有问题。使用base64编码或者不同的分隔符--JSON格式是这里常见的选择,那么你可以在接收IPN的时候简单的解码成一个数组。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-11-07
      • 1970-01-01
      • 1970-01-01
      • 2021-05-20
      • 1970-01-01
      • 2020-10-18
      • 2011-02-18
      相关资源
      最近更新 更多