Page 1 of 1

php??? script to integrate my website with 2checkout.com

Posted: Sat Oct 01, 2005 9:38 am
by asailor
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


hi,

im currently building my own site and using 2checkout.com to process my payments. i have my realtime setup up and running but i just want to try
and fine tune it so its abit more user friendly this is the script i currently have

Code: Select all

<?php
$toEmail = "xxxxxxx@xxxxxxx.xxx";
$fromEmail = "xxxxxx@xxxxxx.xxx";
$thankURL = "https://xxxxxx.xxx/addpack.cgi?authcode=xxxxxxxxxx;email=$email;M_domain=$merchant_order_id;M_typeid=xxxx;status=Y";
$body =

    "Credit Card Status .. $credit_card_processed \n" .

    "Total Billed ........ $total \n" .

    "Order Number ........ $order_number \n" .

    "Merchant Order ID ... $merchant_order_id \n" .

    "Cart Order ID ....... $cart_order_id \n" .

    "Product ID .......... $product_id \n\n" .

    "Card Holder Name .... $card_holder_name \n" .

    "Email Address ....... $email \n" .

    "Phone Number ........ $phone \n" .

    "Street Address ...... $street_address \n" .

    "City, State Zip ..... $city, $state $zip \n" .

    "Country ............. $country \n" .
  



mail("$toEmail", "New Order: $merchant_order_id", $body, "FROM: $fromEmail");
header("Location: $thankURL");
?>
this script works ok with the direct return turned "off" however once you turn it on so that the customer is automatically returned to your website it does not work. this is because effectively the thankurl is a redirect and o2checkout's direct return will not work with a script that has a redirect in it.
im wondering if someone can help me with this script what i need to achieve is the values in the thankurl need to be sent to my secure serve in
order for the real time activation to take place but i would also like the remainder of the details emailed to me.
is this possible with php as im relatively new to it but with a few pointers am more than willing to give it ago myself.
If this is not possible with php what program would you suggest i use as i either need to pass the variables returned from 2checkout as a url or
have a script pass them which is over my head although im going to give it ago with some research and see what i can come up with.
any help would be gratefully appreciated

thanks in advance

al


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Sat Oct 01, 2005 9:58 am
by feyd
this is not a code snippet, moved to PHP - Code.

Posted: Sat Oct 01, 2005 10:26 am
by shiznatix
seriously. im not sure what you want to do. you send the information to 2checkout then you want it to go back to your website? whats wrong with your use of header();? please be a little more specific.

Thanks for the reply hope this makes abit more sense

Posted: Sat Oct 01, 2005 12:19 pm
by asailor
have you used the new 2checkout v2 software????
currently the user clicks on the buy now button on my website fills out the payment details and then clicks complete purchase where he is taken to 2checkout's order processed page from there they have to click the fianalize now button at the top which then brings them back to my my site and my php script. This is how the script is currently working and works quite well except people see the order complete page and because they dont read it thouroughly they miss the finalize my order now link which which stops there accounts being created automatically in real time as this only occurs if they click the finalize now button as this is how they are returned to my php script.
what i am trying to do is turn 2checkout's direct return on so that when you click complete purchase now your are automatically returned directly to my site skipping the finalize my purchase now stage.

because my script is in essence a redirect it will not work with 2checkouts direct return so i need a script that achieves what i already have but does not do it as a redirect as mine currently does.

basically they are taken to my thank you page (php page) once they have completed there purchase and i need to pick up the pass back variables from 2checkout and submit them to my secure server in the following format

https://secureserveraddress/file called?authcode=my password for the automatic setup;email=$email;Product=$merchant_order_id;M_typeid=3609;status=Y"

i basically need to pass all the details as they are to my secure server without using a redirect from my thank you page


hope you can help and that this makes abit more sense


al