Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Notify URL should lead to the script that saves the returned data from PayPal, such as:</p> <pre><code> /** Fetch order from PayPal (IPN reply) * @return int received ID of inserted row if received correctly, 0 otherwise */ function FetchOrder() { $transactionID=$_POST["txn_id"]; $item=$_POST["item_name"]; $amount=$_POST["mc_gross"]; $currency=$_POST["mc_currency"]; $datefields=explode(" ",$_POST["payment_date"]); $time=$datefields[0]; $date=str_replace(",","",$datefields[2])." ".$datefields[1]." ".$datefields[3]; $timestamp=strtotime($date." ".$time); $status=$_POST["payment_status"]; $firstname=$_POST["first_name"]; $lastname=$_POST["last_name"]; $email=$_POST["payer_email"]; $custom=$_POST["option_selection1"]; if ($transactionID AND $amount) { // query to save data return $this-&gt;insertID; } else { return 0; } } </code></pre> <p>You can also choose to verify an order later on:</p> <pre><code>/** Verify PayPal order (IPN) * PayPal returns VERIFIED or INVALID on request * @return bool verified 1 if verified, 0 if invalid */ function VerifyOrder() { $_POST["cmd"]="_notify-validate"; $ch=curl_init(); curl_setopt($ch,CURLOPT_HEADER,0); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_USERAGENT,"your agent - replace"); curl_setopt($ch,CURLOPT_URL,"https://www.paypal.com/cgi-bin/webscr"); curl_setopt($ch,CURLOPT_POST, 1); foreach ($_POST as $key=&gt;$value) { $string.="&amp;".$key."=".urlencode(stripslashes($value)); } curl_setopt($ch, CURLOPT_POSTFIELDS, $string); $result=curl_exec($ch); if ($result=="VERIFIED") return 1; else return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload