Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This should work: <pre><code>$tid = $_GET['tx']; $auth_token = "zzzzzzzzzzzzzzzzzzzz"; $paypal_url = "www.sandbox.paypal.com"; $url = "https://" . $paypal_url . "/cgi-bin/webscr"; $post_vars = "cmd=_notify-synch&amp;tx=" . $tid . "&amp;at=" . $auth_token; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vars); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 15); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_USERAGENT, 'cURL/PHP'); $fetched = curl_exec($ch); $lines = explode("\n", $fetched); $keyarray = array(); if (strcmp ($lines[0], "SUCCESS") == 0) { for ($i=1; $i&lt;count($lines);$i++){ list($key,$val) = explode("=", $lines[$i]); $keyarray[urldecode($key)] = urldecode($val); } // check the payment_status is Completed // check that txn_id has not been previously processed // check that receiver_email is your Primary PayPal email // check that payment_amount/payment_currency are correct // process payment $firstname = $keyarray['first_name']; $lastname = $keyarray['last_name']; $itemname = $keyarray['num_cart_items']; $amount = $keyarray['mc_gross']; echo ("&lt;h2&gt;Thank you for your purchase!&lt;/h2&gt;"); } else if (strcmp ($lines[0], "FAIL") == 0) { echo ("&lt;h2&gt;Sorry, something went wrong&lt;/h2&gt;"); // log for manual investigation } </code></pre> <p>Also $_GET['tx'] look up stops working after ~5 minutes </p>
    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. 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