PayPal xclick payment


/ Published in: PHP
Save to your folder(s)

PayPal test account can be created at https://developer.paypal.com/
HTML Variables for Website Payments Standard at https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables


Copy this code and paste it in your HTML
  1. define('PAYPAL_BUSINESS', '[email protected]');
  2. define('PAYPAL_URL', 'https://www.paypal.com/cgi-bin/webscr');
  3. define('PAYPAL_RETURN_URL', 'http://www.domain.com/process-paypal-response.php');
  4.  
  5. $amount = explode('.', number_format($post_price, 2));
  6. $paypal_data = array(
  7. 'cmd' => '_xclick',
  8. 'business' => PAYPAL_BUSINESS,
  9. 'item_name' => 'Order '.$order_id,
  10. 'item_number' => $order_id,
  11. 'amount' => $amount[0].'.'.$amount[1],
  12. 'currency_code' => 'EUR',
  13. 'button_subtype' => 'services',
  14. 'no_shipping' => 1,
  15. 'custom' => 'buy_now',
  16. 'return' => PAYPAL_RETURN_URL
  17. );
  18.  
  19. header('Location: '.PAYPAL_URL.'?'.http_build_query($paypal_data));

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.