1) Click on ‘Checkout with PayPal’ button and see the experience.
2) If you get any Firewall warning, add rule to the Firewall to allow incoming connections for your application.
3) Checkout with PayPal using a buyer sandbox account provided on this page. And you're done!
4) The sample code uses default sandbox credentials which are set in paypal_config.php. You can create your own credentials by creating PayPal Seller and Buyer accounts on Sandbox here.
5) Make following changes in paypal_config.php:
- If using your own Sandbox seller account, update PP_USER_SANDBOX, PP_PASSWORD_SANDBOX and PP_SIGNATURE_SANDBOX values with your sandbox credentials
- SANDBOX_FLAG: Kept true for working with Sandbox, it will be false for live.
<form id="myContainer" action="paypal_ec_redirect.php" method="POST">
<input type="hidden" name="PAYMENTREQUEST_0_AMT" value="10.00"></input>
<input type="hidden" name="currencyCodeType" value="USD"></input>
<input type="hidden" name="paymentType" value="Sale"></input>
<!--Pass additional input parameters based on your shopping cart. For complete list of all the parameters click here -->
</form>
<script type="text/javascript">
window.paypalCheckoutReady = function () {
paypal.checkout.setup('Your merchant email id', {
container: 'myContainer', //{String|HTMLElement|Array} where you want the PayPal button to reside
environment: 'sandbox' //or 'production' depending on your environment
});
};
</script>
<script src="//www.paypalobjects.com/api/checkout.js" async></script>
<form action="paypal_ec_redirect.php" method="POST">
<input type="hidden" name="PAYMENTREQUEST_0_AMT" value="10.00"></input>
<input type="hidden" name="currencyCodeType" value="USD"></input>
<input type="hidden" name="paymentType" value="Sale"></input>
<!--Pass additional input parameters based on your shopping cart. For complete list of all the parameters click here -->
<input type="image" src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png" alt="Check out with PayPal"></input>
</form>
3) In paypal_config.php, uncomment the 'Express Checkout URLs for Sandbox' and comment out the 'In-Context in Express Checkout URLs for Sandbox'.
Do the same for the 'Live' URLs.