简体   繁体   中英

PayPal IPN URL Set Using API

I am using srmklive/paypal package for PayPal payment in laravel project. And set up an IPN handler function like this.

public function postNotify(Request $request)
{
    // Import the namespace Srmklive\PayPal\Services\ExpressCheckout first in your controller.
    $provider = new ExpressCheckout;

    $request->merge(['cmd' => '_notify-validate']);
    $post = $request->all();        

    $response = (string) $provider->verifyIPN($post);

    if ($response === 'VERIFIED') {                      
        // Your code goes here ...
    }                            
} 

Is there any API for specifying the IPN URL?

Or should I set it only in the PayPal account?

Every PayPal transaction processing API has a parameter to set the notify_url for that transaction, which (if set) will override and take precedence over any default IPN url set at the account level. So yes, it is best for your integration to set it at transaction time, in the API calls that set up and commit the transaction.

The syntax for doing so will depend on which PayPal APIs you are using; you must consult their reference and look for the notify parameter.

Since it seems you might be using Express Checkout NVP, in that case the parameter name is PAYMENTREQUEST_0_NOTIFYURL in the SetExpressCheckout call

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM