Setup Paypal Payment Gateway Integration in PHP

Paypal Integration

Here is the tutorial where you can learn how to Setup Paypal Payment Gateway Integration in PHP

Paypal provides the payment gateway to make money transfer through the internet. This tutorial will explain how to Integrate Paypal Payment Gateway in your website in PHP.

Paypal, provides two environments: Real-time and Sandbox. So during the integration developers can check transactions in the Sandbox environment and then can go for production environment

There are following steps:

  1. You must have account on Paypal, Paypal will provide you dashboard to configure your keys.
  2. Add the following code in your Payment page. you can add this code where you want to display the Paypal pay button.
<form id="form1" method="POST" action"confirm_page.php" >
<div id="paypal-button"></div> 

3. Now you need to put Script code for integration.

<script src=""></script>

        env: 'production', // Optional: specify 'sandbox' environment
	 client: {
          sandbox:    'sandbox-key',
          production: 'production-key' 

         payment: function() 
            var env    = this.props.env;
            var client = this.props.client;
            return, client, {
                transactions: [
                       amount: { total: 50, currency: 'USD' }

        commit: true, // Optional: show a 'Pay Now' button in the checkout flow

		style: {
            size: 'medium',
            color: 'silver',
            shape: 'rect',
            label: 'checkout'
        onAuthorize: function(data, actions) {
            // Optional: display a confirmation page here
              return actions.payment.execute().then(function() {
                // Show a success page to the buyer        
    }, '#paypal-button');

When user clicks on the pay button then it will open the popup box for payment, after the payment user will be redirected to confirm page.


Please enter your comment!
Please enter your name here