简体   繁体   English

paypal直接支付休息API的自定义参数

[英]Custom Parameter for paypal direct payment rest API

I am using paypal REST API for making direct payments. 我使用paypal REST API进行直接付款。 I want to create internal transaction id before initiating the transaction and use that for identifying the transactions from my end. 我想在启动事务之前创建内部事务id,并使用它来识别我的事务。

I am trying to set id using 我正在尝试使用id设置

 $payment = new Payment();
 $payment->setId($tId);

Paypal is approving the request and payment is getting done but I am not getting this id in response. Paypal正在批准该请求并且付款已经完成,但我没有得到此ID作为回应。

Is there any way by which I can send custom parameters to paypal and get them back in response? 有什么方法可以将自定义参数发送到贝宝并让他们回复?

You can use custom variable to pass your custom data, and paypal will return it backto you in post in response. 您可以使用自定义变量来传递您的自定义数据,并且paypal会在回复时将其返回给您。

<input type="hidden" name="amount" value="<?php echo $totalAmount; ?>"/>
<input type="hidden" name="business" value="your_paypal_biz_id"/>
<input type="hidden" name="notify_url" value="<?php echo site_url(); ?>/zad_notify.php"/>
<input type="hidden" name="item_name" value="Image editing"/>
<input type="hidden" name="currency_code" value="USD"/>
<input type="hidden" name="return" value="<?php echo $paypalReturnUrl; ?>"/>
<input type="hidden" name="cancel_return" value="<?php echo site_url(); ?>/payment_error.php?id=<?php echo $sr_no; ?>"/>
<input type="hidden" name="custom" value="<?php echo $sr_no; ?>" />

alternatively you can also pass your id in notify url as query string parameter and you will get it back in return url file. 或者您也可以将您在通知网址中的ID作为查询字符串参数传递,然后您将在返回的url文件中将其返回。

 <input type="hidden" name="amount" value="<?php echo $totalAmount; ?>"/>
    <input type="hidden" name="business" value="your_paypal_biz_id"/>
<input type="hidden" name="notify_url" value="<?php echo site_url(); ?>/zad_notify.php?id=5"/>
    <input type="hidden" name="item_name" value="Image editing"/>
    <input type="hidden" name="currency_code" value="USD"/>
    <input type="hidden" name="return" value="<?php echo $paypalReturnUrl; ?>"/>
    <input type="hidden" name="cancel_return" value="<?php echo site_url(); ?>/payment_error.php?id=<?php echo $sr_no; ?>"/>

Hope this help to you, :) 希望对你有所帮助,:)

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

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