简体   繁体   中英

paypal sandbox IPN php

I am working with Paypal Sandbox, i have a subscription button, my question is how do i get the notification about the payment, something like transaction ID or payment status like, 'pending', 'success' so that i can store in my database.

i tried searching, i see IPN everywhere, but i do not know how to implement that, i did register for IPN in my paypal account and i have the URL as well, i wrote this code code in that file.

and my subscription button code is as below.

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="admin@cypherincorporated.org.in">
<input type="hidden" name="lc" value="IN">
<input type="hidden" name="item_name" value="unlimited">
<input type="hidden" name="return" value="http://103.8.216.147:81/UPS/index.php">
<input type="hidden" name="item_number" value="3">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="src" value="1">
<input type="hidden" name="a3" value="80.00">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="Y">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-SubscriptionsBF:btn_subscribeCC_LG.gif:NonHostedGuest">
<input type="image" src="images/apply.png" border="0" name="submit" alt="PayPal – The safer, easier way to pay online." style="margin:35px 0 0 70px">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">

the sandbox payment works fine but i want some notification about the payment or the status.

Yes, you should use IPN for getting the payment notifications. Note that your IPN listener file should exists in the live server. IPN will not work in localhost.If all set, you will receive IPN notificaiton and you could check your server logs or send customize email upon getting the IPN to check if you are receiving the IPN.

To set the IPN dynamically use the notify_url variable:

    <input type="hidden" name="notify_url" value="http://path.to/your.ipn.php">

From the Variable Reference :

    notify_url
        Optional
        The URL to which PayPal posts information about the payment, in the form of Instant Payment Notification messages.

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