Dane przekazywane sa do paypal poprzez nastepujacy formularz:
<FORM ACTION="https://www.sandbox.paypal.com/uk/cgi-bin/webscr" METHOD="POST"> <INPUT TYPE="hidden" name="cmd" value="_xclick"> <input type="hidden" name="amount" value="{TOTAL_PRICE_TO_PAY}"> <input type="hidden" name="business" value="track__1212504437_biz@op.pl"> <input type="hidden" name="item_name" value="teazone order nr. {ORDER_ID}"> <input type="submit" value="go"> </form>
Platnosc odbywa sie bez problemu. Wybralem sposob PDT. IPN niestety nie dziala... moze z tego samego powodu.
Plik ktory "odbiera" platnosc ma nastepujaca tresc:
<?php // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-synch'; $tx_token = $_GET['tx']; $auth_token = "ke8Hlh6ycV***********************************8"; $req .= "&tx=$tx_token&at=$auth_token"; // post back to PayPal system to validate $header .= "POST /cgi-bin/webscr HTTP/1.0r\n"; $header .= "Content-Type: application/x-www-form-urlencodedr\n"; // If possible, securely post back to paypal using HTTPS // Your PHP server will need to be SSL enabled // $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); if (!$fp) { // HTTP ERROR } else { // read the body data $res = ''; $headerdone = false; // read the header $headerdone = true; } else if ($headerdone) { // header has been read. now read the contents $res .= $line; } } // parse the data for ($i=1; $i<count($lines);$i++){ } // 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['item_name']; $amount = $keyarray['payment_gross']; } // log for manual investigation } } foreach($lines as $v) { } ?>
powyzszy kod sciagniety ze strony paypal. Jedyna modyfikacja jest echo na koncu.
Niestety za kazdym razem zwracana jest FAIL Error 4003. Z tego co sie zorientowalem blad ten oznacza brak takiej transakcji, a dokladniej dane wyslane sa rozne od danych odebranych.
Niestety nie wiem co z tym zrobic... zwyczajnie brakuje i pomyslow. Bede wdzieczny za jakas pomoc. Pozdrawiam.