PAYPAL instant payment notification (IPN) is used PayPal to identify and deal with real-time purchase of server to server communications interface. IPN send the PayPal payment you receive immediate notification and confirmation, and provide payments to be, has been canceled or failure of the state of transactions and other data.
IPN can be used to customize a variety of management and the opening of PayPal's API and communications, including:
- Custom Web site for customers shopping in real time back
- Through IPN "transmit" variable to track customers
- To download the software and other digital products, the distribution of key visit
- Automatically carry out operations
- Partners to track sales and commissions
- In your own database to store information on the transaction
Search variable
Carried out after the payment, PayPal will be sent to POST through PayPal server notify_url variables specified in the notice sent URL. The script is above the designated paypal_ipn_handler.php, so the creation of this document, and as such the following definition of it:
1
2
3
4
5
6
7
8
9
10
11
Of 12
13
| <? Php
'includes/user_functions.php' ) ; include ( 'includes / user_functions.php');
'includes/shared_functions.php' ) ; include ( 'includes / shared_functions.php');
/ / Assign posted variables to local variables
$_POST [ 'payment_status' ] ; $ payment_status = $ _POST [ 'payment_status'];
$_POST [ 'mc_gross' ] ; $ amountDue = $ _POST [ 'mc_gross'];
$_POST [ 'txn_id' ] ; $ txn_id = $ _POST [ 'txn_id'];
$_POST [ 'mc_currency' ] ; $ payment_currency = $ _POST [ 'mc_currency'];
$_POST [ 'custom' ] ; $ cartid = $ _POST [ 'custom'];
$_POST [ 'business' ] ; $ my_email = $ _POST [ 'business'];
$_POST [ 'payer_email' ] ; $ email = $ _POST [ 'payer_email'];
... |
First of all, through PayPal to send POST over an important variable in the preservation of local variables.
Verify payment
To pay for a way to verify is: to collect from PayPal to send over the variables and send them through the re-POST. Continue to define paypal_ipn_handler.php, add the following code: