Paypal 发布了一个 Github 存储库,其中包含 IPN 监听器的示例代码。您可以查看 Github 存储库:https ://github.com/paypal/ipn-code-samples您可以在下面找到 IPN PHP 类:<?phpclass PaypalIPN{ /** @var bool Indicates if the sandbox endpoint is used. */ private $use_sandbox = false; /** @var bool Indicates if the local certificates are used. */ private $use_local_certs = true; /** Production Postback URL */ const VERIFY_URI = 'https://ipnpb.paypal.com/cgi-bin/webscr'; /** Sandbox Postback URL */ const SANDBOX_VERIFY_URI = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr'; /** Response from PayPal indicating validation was successful */ const VALID = 'VERIFIED'; /** Response from PayPal indicating validation failed */ const INVALID = 'INVALID'; /** * Sets the IPN verification to sandbox mode (for use when testing, * should not be enabled in production). * @return void */ public function useSandbox() { $this->use_sandbox = true; } /** * Sets curl to use php curl's built in certs (may be required in some * environments). * @return void */ public function usePHPCerts() { $this->use_local_certs = false; } /** * Determine endpoint to post the verification data to. * * @return string */ public function getPaypalUri() { if ($this->use_sandbox) { return self::SANDBOX_VERIFY_URI; } else { return self::VERIFY_URI; } } /** * Verification Function * Sends the incoming post data back to PayPal using the cURL library. * * @return bool * @throws Exception */ public function verifyIPN() { if ( ! count($_POST)) { throw new Exception("Missing POST Data"); }我正在使用贝宝订阅: https://developer.paypal.com/docs/business/subscriptions/但我找不到可以指定 IPN Listener url 的地方。有任何想法吗?
1 回答
开心每一天1111
TA贡献1836条经验 获得超13个赞
要开始接收 IPN 消息,请输入通知 URL 并选择下面的接收 IPN 消息。PayPal 会继续生成并存储 IPN 消息,直到您再次选择“接收 IPN 消息”(或关闭 IPN)。
- 1 回答
- 0 关注
- 165 浏览
添加回答
举报
0/150
提交
取消