zoukankan      html  css  js  c++  java
  • 解决Opencart paypal ipn 返回 INVALID

    系统出现个别订单状态是Pending,但Paypal已经收到钱,按照下面步骤逐一排查

    1.打开Paypal的设置,修改Debug Mode为Enabled

    2.后台System 》 Tools 》Error Logs,查看日志,发现出现问题的订单返回PP_STANDARD :: IPN RESPONSE: INVALID

    3.通过在Paypal官网查询,发现以下文字:

    To ensure that symbols and special characters in the date or other fields are processed correctly, use rawurlencode and rawurldecode instead of urlencode and decode.

    查询Error Logs,出现问题的订单返回PP_STANDARD :: IPN REQUEST记录里invoice的后面,会有两个++号,导致链接不完整,从而导致IPN返回INVALID

    查询 pp_standard.php代码,发现Opencart官方使用的是urlencode,修改为rawurlencode。

    附上Paypal传送门 Receiving an INVALID message from PayPal

    4.修改paypal的字符编码

    go to your Paypal profile

    click My selling tools in the sidebar

    scroll to the bottom and click PayPal button language encoding

    click More options and set the encoding to UTF-8

     
     

    P.S.urlencode与rawurlencode区别

    urlencode:返回字符串,此字符串中除了-_.之外的所有非字母数字字符都将被替换成百分号(%)后跟两位十六进制数,空格则编码为加号(+)。此编码与 WWW 表单 POST 数据的编码方式是一样的,同时与application/x-www-form-urlencoded的媒体类型编码方式一样。由于历史原因,此编码在将空格编码为加号(+)方面与 RFC1738 编码不同。

    rawurlencode:返回字符串,此字符串中除了-_.之外的所有非字母数字字符都将被替换成百分号(%)后跟两位十六进制数。这是在 RFC 1738 中描述的编码,是为了保护原义字符以免其被解释为特殊的 URL 定界符,同时保护 URL 格式以免其被传输媒体(像一些邮件系统)使用字符转换时弄乱。

  • 相关阅读:
    DP--HDU 1003求数字串中的最大连续序列(含有DP过程详细分析)
    递归+DFS--简单迷宫问题--百练2802
    枚举--百练2812--恼人的青蛙(内含枚举基本思想总结)
    计蒜客:最大子阵
    hdu 4515 小Q系列故事——世界上最遥远的距离
    日期计算
    最大最小公倍数
    hdu 1568 Fibonacci
    矩阵快速幂
    矩阵乘法
  • 原文地址:https://www.cnblogs.com/chixiaobai/p/9504786.html
Copyright © 2011-2022 走看看