简体   繁体   English

使用 API 设置 PayPal IPN URL

[英]PayPal IPN URL Set Using API

I am using srmklive/paypal package for PayPal payment in laravel project.我在 Laravel 项目中使用 srmklive/paypal 包进行 PayPal 付款。 And set up an IPN handler function like this.并像这样设置一个 IPN 处理函数。

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?是否有任何用于指定 IPN URL 的 API?

Or should I set it only in the PayPal account?或者我应该只在 PayPal 帐户中设置它?

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.每个 PayPal 交易处理 API 都有一个参数来设置该交易的 notify_url,该参数(如果设置)将覆盖并优先于在帐户级别设置的任何默认 IPN url。 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.所以是的,您的集成最好在事务时间设置它,在设置和提交事务的 API 调用中。

The syntax for doing so will depend on which PayPal APIs you are using;这样做的语法取决于您使用的 PayPal API; you must consult their reference and look for the notify parameter.您必须查阅他们的参考资料并查找notify参数。

Since it seems you might be using Express Checkout NVP, in that case the parameter name is PAYMENTREQUEST_0_NOTIFYURL in the SetExpressCheckout call由于您似乎正在使用 Express Checkout NVP,在这种情况下, SetExpressCheckout调用中的参数名称为PAYMENTREQUEST_0_NOTIFYURL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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