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' => 'my_business_email@hotmail.com',
    '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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.