Paypal 订阅设置 IPN 侦听器 url

Paypal 发布了一个 Github 存储库,其中包含 IPN 监听器的示例代码。

您可以查看 Github 存储库:https ://github.com/paypal/ipn-code-samples

您可以在下面找到 IPN PHP 类:

<?php


class 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 的地方。

有任何想法吗?


12345678_0001
浏览 86回答 1
1回答

开心每一天1111

要开始接收 IPN 消息,请输入通知 URL 并选择下面的接收 IPN 消息。PayPal 会继续生成并存储 IPN 消息,直到您再次选择“接收 IPN 消息”(或关闭 IPN)。
打开App,查看更多内容
随时随地看视频慕课网APP