How to integrate PayPal express checkout?

Solution:1

Try this code I used in my project and it works.

PHP:

$paypal_url='https://www.paypal.com/cgi-bin/webscr'; 
$paypal_id='example@example.com';

HTML:

<form action='<?php echo $paypal_url; ?>' method='post' name='frmPayPal1'>
    <input type='hidden' name='business' value='<?php echo $paypal_id;?>'>
    <input type='hidden' name='cmd' value='_xclick'>
    <input type='hidden' name='item_name' value='Products Total'>
    <input type='hidden' name='amount' value='<?php echo $tot;?>'>
    <input type='hidden' name='no_shipping' value='1'>
    <input type='hidden' name='currency_code' value='USD'>
    <input type='hidden' name='handling' value='0'>
    <input type='hidden' name='cancel_return' value='http://localhost/paypal/cancel.php'>
    <input type='hidden' name='return' value='http://localhost/paypal/success.php'>
    <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
    <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

Solution:2

To implement PayPal Express Checkout you need to do some server side code (PHP, ASP.Net, …). What you are trying to do is an HTML form which won’t work. You have to do 3 API calls to validate a full payment.

In each call you will use your API credentials.