Jump to content

Redirecting to Paypal with order details


scooby1

Recommended Posts

Hello

 

I am trying to redirect the user to paypal when then they press a button a new page runs.

 

 

$urlParams = array(
    'cmd' => '_cart',
    'upload' => 1,
    'charset' => 'utf-8',
    'business' => '[email protected]',
    'return' => 'http://www.mywebsite.com',
    'currency_code' => 'GBP',
    'amount_1' => $row['total'],
    'item_name_1' => $row['id'],

);

// Build the URL
$urlParams = http_build_query($urlParams, '', '&');
$url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';

header('location:' .$url. '?' . $urlParams);

 

All I am trying to do is send across the Total order price and the order number. It redirects fine to paypal, and all the information is correctly displayed in the address bar but paypal says "Error Detected - Your shopping cart is empty". Has anyone had this problem before?

 

Thanks for your help!

 

Tom

Don't worry guys after a bit of research I managed to do it like this.....

 


header("Location:https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=myemailaddress%40hotmail.com&item_name="
. urlencode(www.mywebsite.com)
. "+Order&item_number=PROD" . $row['id']
."&amount=" . urlencode(sprintf('%.2f',
$row['total'])) . " &no_note=l&currency_code=GBP&lc=GB");

 

Thanks for looking anyway.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.