PayPal Pro Payment Gateway Integration in PHP

If you are working on an eCommerce project and concerned about the payment gateway for accepting credit cards, then PayPal Payments Pro could be the best option for you. The main advantages of PayPal Pro are that customers don’t need to leave your site for making payment. The customer can make credit card payments within your site and without any PayPal account.

PayPal Payments Pro provides a powerful and customizable solution to accept credit card payments in the web application. Website Payments Pro API allows you to accept credit and debit cards directly on the website. In this tutorial, we will show how to integrate PayPal Pro payment gateway in PHP with PayPal DoDirectPayment API. With the PayPal Pro payment gateway integration, you will be able to collect payment online from the buyer using a credit card or debit card.

Create PayPal Sandbox Account

Before start accepting payment via PayPal Pro payment gateway, the payment process needs to be tested. To test the transaction process with PayPal a sandbox account needs to be created on the PayPal Developer account. PayPal sandbox account allows you to test the transaction before making the payment gateway live on the production server.

First, create a PayPal sandbox account. You will get the API credentials in your sandbox Business account. To integrate the PayPal Pro payment gateway API your business account must be Website Payments Pro account. If you want to use a credit card as a payment method in your test transactions, you must configure a sandbox Business account as a Website Payments Pro account.

Once the PayPal business pro account creation is completed, you will get the NVP/SOAP Sandbox API Credentials under the API Credentials tab.

paypal-sandbox-payments-pro-nvp-soap-api-credentials-codexworld

You need to specify the API credentials at the time of PayPal DoDirectPayment API operations. Copy the API credentials (Username, Password, and Signature) for later use in the script.

Before getting started to implement PayPal Pro payment gateway in PHP, take a look at the files structure.

paypal_pro_integration_php/
├── config.php
├── dbConnect.php
├── index.php
├── payment_process.php
├── PaypalPro.class.php
├── js/
│   ├── jquery.min.js
│   └── creditCardValidator.js
└── css/
    └── style.css

Create Database Table

To store the transaction details, a table is required in the database. The following SQL creates a transactions table with some basic fields in the MySQL database.

CREATE TABLE `transactions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `item_number` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `item_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `item_price` float(10,2) NOT NULL,
  `item_price_currency` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'usd',
  `buyer_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `buyer_email` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `card_num` bigint(20) NOT NULL,
  `card_exp_month` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
  `card_exp_year` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
  `paid_amount` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `paid_amount_currency` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `txn_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `payment_status` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `created` datetime NOT NULL DEFAULT current_timestamp(),
  `modified` datetime NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

PaypalPro Library (PaypalPro.class.php)

The PaypalPro class is a custom library that handles PayPal DoDirectPayment API operations with PHP.

<?php 
/**
 * PaypalPro Class
 * Helps to make credit card payment by PayPal Payments Pro
 * 
 * Author: CodexWorld
 * Author Email: admin@codexworld.com
 * Author URL: http://www.codexworld.com
 * Licence: https://www.codexworld.com/license/
 */
class PaypalPro
{
    
//Configuration Options
    
var $apiUsername PAYPAL_API_USERNAME;
    var 
$apiPassword PAYPAL_API_PASSWORD;
    var 
$apiSignature PAYPAL_API_SIGNATURE;
    var 
$apiEndpoint = (PAYPAL_SANDBOX == TRUE)?'https://api-3t.sandbox.paypal.com/nvp':'https://api-3t.paypal.com/nvp';
    var 
$subject '';
    var 
$authToken '';
    var 
$authSignature '';
    var 
$authTimestamp '';
    var 
$useProxy FALSE;
    var 
$proxyHost '127.0.0.1';
    var 
$proxyPort 808;
    var 
$version '65.1';
    var 
$ackSuccess 'SUCCESS';
    var 
$ackSuccessWarning 'SUCCESSWITHWARNING';
    
    public function 
__construct($config = array()){ 
        
ob_start();
        
session_start();
        if (
count($config) > 0){
            foreach (
$config as $key => $val){
                if (isset(
$this->$key)){
                    
$this->$key $val;
                }
            }
        }
    }
    public function 
nvpHeader(){
        
$nvpHeaderStr "";
    
        if((!empty(
$this->apiUsername)) && (!empty($this->apiPassword)) && (!empty($this->apiSignature)) && (!empty($subject))) {
            
$authMode "THIRDPARTY";
        }else if((!empty(
$this->apiUsername)) && (!empty($this->apiPassword)) && (!empty($this->apiSignature))) {
            
$authMode "3TOKEN";
        }elseif (!empty(
$this->authToken) && !empty($this->authSignature) && !empty($this->authTimestamp)) {
            
$authMode "PERMISSION";
        }elseif(!empty(
$subject)) {
            
$authMode "FIRSTPARTY";
        }
        
        switch(
$authMode) {
            case 
"3TOKEN" 
                
$nvpHeaderStr "&PWD=".urlencode($this->apiPassword)."&USER=".urlencode($this->apiUsername)."&SIGNATURE=".urlencode($this->apiSignature);
                break;
            case 
"FIRSTPARTY" :
                
$nvpHeaderStr "&SUBJECT=".urlencode($this->subject);
                break;
            case 
"THIRDPARTY" :
                
$nvpHeaderStr "&PWD=".urlencode($this->apiPassword)."&USER=".urlencode($this->apiUsername)."&SIGNATURE=".urlencode($this->apiSignature)."&SUBJECT=".urlencode($subject);
                break;        
            case 
"PERMISSION" :
                
$nvpHeaderStr $this->formAutorization($this->authToken,$this->authSignature,$this->authTimestamp);
                break;
        }
        return 
$nvpHeaderStr;
    }
    
    
/**
      * hashCall: Function to perform the API call to PayPal using API signature
      * @methodName is name of API  method.
      * @nvpStr is nvp string.
      * returns an associtive array containing the response from the server.
    */
    
public function hashCall($methodName,$nvpStr){
        
// form header string
        
$nvpheader $this->nvpHeader();

        
//setting the curl parameters.
        
$ch curl_init();
        
curl_setopt($chCURLOPT_URL,$this->apiEndpoint);
        
curl_setopt($chCURLOPT_VERBOSE1);
    
        
//turning off the server and peer verification(TrustManager Concept).
        
curl_setopt($chCURLOPT_SSL_VERIFYPEERFALSE);
        
curl_setopt($chCURLOPT_SSL_VERIFYHOSTFALSE);
    
        
curl_setopt($chCURLOPT_RETURNTRANSFER,1);
        
curl_setopt($chCURLOPT_POST1);
        
        
//in case of permission APIs send headers as HTTPheders
        
if(!empty($this->authToken) && !empty($this->authSignature) && !empty($this->authTimestamp))
         {
            
$headers_array[] = "X-PP-AUTHORIZATION: ".$nvpheader;
            
curl_setopt($chCURLOPT_HTTPHEADER$headers_array);
            
curl_setopt($chCURLOPT_HEADERfalse);
        }
        else 
        {
            
$nvpStr $nvpheader.$nvpStr;
        }
        
//if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
       //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php 
        
if($this->useProxy)
            
curl_setopt ($chCURLOPT_PROXY$this->proxyHost.":".$this->proxyPort); 
    
        
//check if version is included in $nvpStr else include the version.
        
if(strlen(str_replace('VERSION='''strtoupper($nvpStr))) == strlen($nvpStr)) {
            
$nvpStr "&VERSION=" urlencode($this->version) . $nvpStr;    
        }
        
        
$nvpreq="METHOD=".urlencode($methodName).$nvpStr;
        
//setting the nvpreq as POST FIELD to curl
        
curl_setopt($ch,CURLOPT_POSTFIELDS,$nvpreq);
    
        
//getting response from server
        
$response curl_exec($ch);
        
        
//convrting NVPResponse to an Associative Array
        
$nvpResArray $this->deformatNVP($response);
        
$nvpReqArray $this->deformatNVP($nvpreq);
        
$_SESSION['nvpReqArray']=$nvpReqArray;
    
        if (
curl_errno($ch)) {
            die(
"CURL send a error during perform operation: ".curl_error($ch));
        } else {
            
//closing the curl
            
curl_close($ch);
        }
    
        return 
$nvpResArray;
    }
    
    
/** This function will take NVPString and convert it to an Associative Array and it will decode the response.
     * It is usefull to search for a particular key and displaying arrays.
     * @nvpstr is NVPString.
     * @nvpArray is Associative Array.
     */
    
public function deformatNVP($nvpstr){
        
$intial=0;
        
$nvpArray = array();
    
        while(
strlen($nvpstr)){
            
//postion of Key
            
$keypos strpos($nvpstr,'=');
            
//position of value
            
$valuepos strpos($nvpstr,'&') ? strpos($nvpstr,'&'): strlen($nvpstr);
    
            
/*getting the Key and Value values and storing in a Associative Array*/
            
$keyval substr($nvpstr,$intial,$keypos);
            
$valval substr($nvpstr,$keypos+1,$valuepos-$keypos-1);
            
//decoding the respose
            
$nvpArray[urldecode($keyval)] =urldecode$valval);
            
$nvpstr substr($nvpstr,$valuepos+1,strlen($nvpstr));
         }
        return 
$nvpArray;
    }
    
    public function 
formAutorization($auth_token,$auth_signature,$auth_timestamp){
        
$authString="token=".$auth_token.",signature=".$auth_signature.",timestamp=".$auth_timestamp ;
        return 
$authString;
    }
    
    public function 
paypalCall($params){
        
/*
         * Construct the request string that will be sent to PayPal.
         * The variable $nvpstr contains all the variables and is a
         * name value pair string with & as a delimiter
         */
        
        //payment details item fields
        
$itemStr = !empty($params['itemName'])?'&L_NAMEn='.$params['itemName']:'';
        
$itemStr .= !empty($params['itemNumber'])?'&L_NUMBERn='.$params['itemNumber']:'';
        
        
//indicate a recurring transaction
        
$recurringStr = (array_key_exists("recurring",$params) && $params['recurring'] == 'Y')?'&RECURRING=Y':'';
        
        
$nvpstr "&PAYMENTACTION=".$params['paymentAction']."&AMT=".$params['amount']."&CREDITCARDTYPE=".$params['creditCardType']."&ACCT=".$params['creditCardNumber']."&EXPDATE=".$params['expMonth'].$params['expYear']."&CVV2=".$params['cvv']."&FIRSTNAME=".$params['firstName']."&LASTNAME=".$params['lastName']."&CITY=".$params['city']."&ZIP=".$params['zip']."&COUNTRYCODE=".$params['countryCode']."&CURRENCYCODE=".$params['currencyCode'].$itemStr.$recurringStr;
    
        
/* Make the API call to PayPal, using API signature.
           The API response is stored in an associative array called $resArray */
        
$resArray $this->hashCall("DoDirectPayment",$nvpstr);
    
        return 
$resArray;
    }
}
?>

Site Settings and API Configuration (config.php)

In the config.php file, product details, PayPal API credentials, and database settings constant variables are defined.
Product details:

  • $itemName – Specify product name.
  • $itemNumber – Specify product number.
  • $payableAmount – Specify product price.
  • $currency – Specify currency code.

PayPal API constants:

  • PAYPAL_API_USERNAME – Specify the API username of the PayPal Business Pro account.
  • PAYPAL_API_PASSWORD – Specify the API password of the PayPal Business Pro account.
  • PAYPAL_API_SIGNATURE – Specify the API signature of the PayPal Business Pro account.
  • PAYPAL_SANDBOX – Specify whether you use Sandbox environment (TRUE/FALSE).

Database constants:

  • DB_HOST – Specify the database host.
  • DB_USERNAME – Specify the database username.
  • DB_PASSWORD – Specify the database password.
  • DB_NAME – Specify the database name.
<?php 

// Product details
$itemName   "Demo Product";
$itemNumber "P123456";
$payableAmount 25;
$currency   "USD";

// PayPal NVP/SOAP API Credentials
define('PAYPAL_API_USERNAME''API_Username');
define('PAYPAL_API_PASSWORD''API_Password');
define('PAYPAL_API_SIGNATURE''API_Signature');
define('PAYPAL_SANDBOX'TRUE); //TRUE=Sandbox or FALSE=Production

// Database configuration
define('DB_HOST''MySQL_Database_Host');
define('DB_USERNAME''MySQL_Database_Username');
define('DB_PASSWORD''MySQL_Database_Password');
define('DB_NAME''MySQL_Database_Name');

?>

Database Connection (dbConnect.php)

The dbConnect.php file is used to connect the database using PHP and MySQL.

<?php 

// Connect with the database
$db = new mysqli(DB_HOSTDB_USERNAMEDB_PASSWORDDB_NAME);

// Display error if failed to connect
if ($db->connect_errno) {
    
printf("Connect failed: %s\n"$db->connect_error);
    exit();
}

?>

PayPal Pro Checkout Form (index.php)

Credit Card Form:
Initially, an HTML form is provided to input the credit card information (Card Number, Expiration Date, CVC Number, Card Holder Name, and Email). Also, the product name and price are displayed at the top of the form.

<?php
// Include configuration file
include_once 'config.php';
?>

<div id="paymentSection">
    <form method="post" id="paymentForm">
        <h4>Item: <strong><?php echo $itemName?></strong></h4>
        <h4>Payable amount: <strong>$<?php echo $payableAmount.' '.$currency?></strong></h4>
        <ul>
            <li>
                <label>Card Number</label>
                <input type="text" placeholder="1234 5678 9012 3456" maxlength="20" id="card_number" name="card_number">
            </li>

            <li class="vertical">
                <ul>
                    <li>
                        <label>Expiry Month</label>
                        <input type="text" placeholder="MM" maxlength="2" id="expiry_month" name="expiry_month">
                    </li>
                    <li>
                        <label>Expiry Year</label>
                        <input type="text" placeholder="YYYY" maxlength="4" id="expiry_year" name="expiry_year">
                    </li>
                    <li>
                        <label>CVV</label>
                        <input type="text" placeholder="123" maxlength="4" id="cvv" name="cvv">
                    </li>
                </ul>
            </li>
            <li>
                <label>Name on card</label>
                <input type="text" placeholder="John Doe" id="name_on_card" name="name_on_card">
            </li>
            <li>
                <label>Email</label>
                <input type="text" placeholder="user@example.com" id="email" name="email">
            </li>
            <li>
                <input type="hidden" name="card_type" id="card_type" value=""/>
                <input type="button" name="card_submit" id="cardSubmitBtn" value="Proceed" class="payment-btn" disabled="true" >
            </li>
        </ul>
    </form>
</div>

jQuery Library:
We will use jQuery to process card payment without page refresh. So, include the jQuery library first.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>

Card Form Validation:
To validate credit card number we will use Credit Card Validator jQuery plugin, so include the creditCardValidator.js library.

function cardFormValidate(){
    var cardValid = 0;
      
    // Card number validation
    $('#card_number').validateCreditCard(function(result) {
        var cardType = (result.card_type == null)?'':result.card_type.name;
        if(cardType == 'Visa'){
            var backPosition = result.valid?'2px -163px, 320px -87px':'2px -163px, 320px -61px';
        }else if(cardType == 'MasterCard'){
            var backPosition = result.valid?'2px -247px, 320px -87px':'2px -247px, 320px -61px';
        }else if(cardType == 'Maestro'){
            var backPosition = result.valid?'2px -289px, 320px -87px':'2px -289px, 320px -61px';
        }else if(cardType == 'Discover'){
            var backPosition = result.valid?'2px -331px, 320px -87px':'2px -331px, 320px -61px';
        }else if(cardType == 'Amex'){
            var backPosition = result.valid?'2px -121px, 320px -87px':'2px -121px, 320px -61px';
        }else{
            var backPosition = result.valid?'2px -121px, 320px -87px':'2px -121px, 320px -61px';
        }
        $('#card_number').css("background-position", backPosition);
        if(result.valid){
            $("#card_type").val(cardType);
            $("#card_number").removeClass('required');
            cardValid = 1;
        }else{
            $("#card_type").val('');
            $("#card_number").addClass('required');
            cardValid = 0;
        }
    });
      
    // Card details validation
    var email = $("#email").val();
    var cardName = $("#name_on_card").val();
    var expMonth = $("#expiry_month").val();
    var expYear = $("#expiry_year").val();
    var cvv = $("#cvv").val();
    var regName = /^[a-z ,.'-]+$/i;
    var regEmail = /^[A-Z0-9._%+-]+@([A-Z0-9-]+\.)+[A-Z]{2,4}$/i;
    var regMonth = /^01|02|03|04|05|06|07|08|09|10|11|12$/;
    var regYear = /^2023|2024|2025|2026|2027|2028|2029|2030|2031|2032|2033|2034|2035|2036$/;
    var regCVV = /^[0-9]{3,3}$/;
    if(cardValid == 0){
        $("#card_number").addClass('required');
        $("#card_number").focus();
        return false;
    }else if(!regMonth.test(expMonth)){
        $("#card_number").removeClass('required');
        $("#expiry_month").addClass('required');
        $("#expiry_month").focus();
        return false;
    }else if(!regYear.test(expYear)){
        $("#card_number").removeClass('required');
        $("#expiry_month").removeClass('required');
        $("#expiry_year").addClass('required');
        $("#expiry_year").focus();
        return false;
    }else if(!regCVV.test(cvv)){
        $("#card_number").removeClass('required');
        $("#expiry_month").removeClass('required');
        $("#expiry_year").removeClass('required');
        $("#cvv").addClass('required');
        $("#cvv").focus();
        return false;
    }else if(!regName.test(cardName)){
        $("#card_number").removeClass('required');
        $("#expiry_month").removeClass('required');
        $("#expiry_year").removeClass('required');
        $("#cvv").removeClass('required');
        $("#name_on_card").addClass('required');
        //$("#name_on_card").focus();
        return false;
    }else if(!regEmail.test(email)){
        $("#card_number").removeClass('required');
        $("#expiry_month").removeClass('required');
        $("#expiry_year").removeClass('required');
        $("#cvv").removeClass('required');
        $("#name_on_card").removeClass('required');
        $("#email").addClass('required');
        //$("#email").focus();
        return false;
    }else{
        $("#card_number").removeClass('required');
        $("#expiry_month").removeClass('required');
        $("#expiry_year").removeClass('required');
        $("#cvv").removeClass('required');
        $("#name_on_card").removeClass('required');
        $("#email").removeClass('required');
        $('#cardSubmitBtn').prop('disabled', false);  
        return true;
    }
}

Payment Process using jQuery and Ajax:
The Ajax request is initiated to validate and process the card transaction through PayPal Pro API.

  • The given card information is sent to the server-side script (payment_process.php) via Ajax.
  • The transaction is processed in the server-side script and the payment status is returned.
  • Based on the response, the order info or error message is shown to the user.
$(document).ready(function(){
    // Initiate validation on input fields
    $('#paymentForm input[type=text]').on('keyup',function(){
        cardFormValidate();
    });
    
    // Submit card form
    $("#cardSubmitBtn").on('click',function(){
        $('.status-msg').remove();
        if(cardFormValidate()){
            var formData = $('#paymentForm').serialize();
            $.ajax({
                type:'POST',
                url:'payment_process.php',
                dataType: "json",
                data:formData,
                beforeSend: function(){
                    $("#cardSubmitBtn").prop('disabled', true);
                    $("#cardSubmitBtn").val('Processing....');
                },
                success:function(resp){
                    if(resp.status == 1){
                        $('#paymentSection').html('<p class="status-msg success">The transaction was successful! <br/>Reference ID: <span>#'+resp.data.ref_id+'</span> <br/>Transaction ID: <span>'+resp.data.txn_id+'</span> <br/>Paid Amount: <span>'+resp.data.amount+' '+resp.data.currency+'</span></p>');
                    }else{
                        $("#cardSubmitBtn").prop('disabled', false);
                        $("#cardSubmitBtn").val('Proceed');
                        $('#paymentSection').prepend('<p class="status-msg error">Transaction has been failed, please try again.</p>');
                    }
                }
            });
        }
    });
});

Validate and Process Payment (payment_process.php)

In the payment_process.php file, the submitted card details are validated and the charge is processed using PaypalPro PHP library and PHP.

  • Include the PayPalPro PHP library and configuration file.
  • Fetch the product details, buyer information, and card details.
  • Create an instance of PaypalPro class.
  • Call the paypalCall() function of PaypalPro class and pass the item, buyer, and card details ($paypalParams).
  • If the charge is successful, the transaction details will be inserted in the MySQL database.
  • The transaction status is returned to the Ajax request.
<?php 

// Include configuration file
include_once 'config.php';

// Include database connection file
include_once 'dbConnect.php';

// Include PayPalPro PHP library
require_once 'PaypalPro.class.php';

if(
$_SERVER['REQUEST_METHOD'] == 'POST'){
    
    
// Buyer information
    
$name $_POST['name_on_card'];
    
$nameArr explode(' '$name);
    
$firstName = !empty($nameArr[0])?$nameArr[0]:'';
    
$lastName = !empty($nameArr[1])?$nameArr[1]:'';
    
$email $_POST['email'];
    
$city 'Charleston';
    
$zipcode '25301';
    
$countryCode 'US';
    
    
// Card details
    
$creditCardNumber trim(str_replace(" """$_POST['card_number']));
    
$creditCardType $_POST['card_type'];
    
$expYear $_POST['expiry_year'];
    
$expMonth $_POST['expiry_month'];
    
$cvv $_POST['cvv'];
    
    
// Create an instance of PaypalPro class
    
$paypal = new PaypalPro();
    
    
// Payment details
    
$paypalParams = array(
        
'paymentAction' => 'Sale',
        
'itemNumber' => $itemNumber,
        
'itemName' => $itemName,
        
'amount' => $payableAmount,
        
'currencyCode' => $currency,
        
'creditCardType' => $creditCardType,
        
'creditCardNumber' => $creditCardNumber,
        
'expMonth' => $expMonth,
        
'expYear' => $expYear,
        
'cvv' => $cvv,
        
'firstName' => $firstName,
        
'lastName' => $lastName,
        
'city' => $city,
        
'zip'    => $zipcode,
        
'countryCode' => $countryCode
    
);
    
    
// Call PayPal API
    
$response $paypal->paypalCall($paypalParams);
    
$paymentStatus strtoupper($response["ACK"]);
    
    if(
$paymentStatus == "SUCCESS"){
        
// Transaction info
        
$transactionID $response['TRANSACTIONID'];
        
$paidAmount $response['AMT'];
        
$paidCurrency $response['CURRENCYCODE'];
        
        
// Insert tansaction data into the database
        
$sql "INSERT INTO transactions (item_number,item_name,item_price,item_price_currency,buyer_name,buyer_email,card_num,card_exp_month,card_exp_year,paid_amount,paid_amount_currency,txn_id,payment_status,created,modified) VALUES('".$itemNumber."','".$itemName."','".$payableAmount."','".$currency."','".$name."', '".$email."', '".$creditCardNumber."','".$expMonth."','".$expYear."','".$paidAmount."','".$paidCurrency."','".$transactionID."','".$paymentStatus."',NOW(),NOW())";
        
$insert $db->query($sql);
        
$last_insert_id $db->insert_id;
        
        
$data['status'] = 1;
        
$data['data'] = array(
            
'ref_id' => $last_insert_id,
            
'txn_id' => $transactionID,
            
'amount' => $paidAmount,
            
'currency' => $paidCurrency
        
);
    }else{
         
$data['status'] = 0;
    }
    
    
// Transaction status
    
echo json_encode($data);
}
?>

Recurring Payment:
If you want the recurring transaction, insert recurring key (recurring = Y) into the $paypalParams array.

$paypalParams = array( 
    ... 
    'recurring' => 'Y' 
); 
$response $paypal->paypalCall($paypalParams);

Make PayPal Pro Payment Gateway Live

Once the testing is completed and the payment process working properly on the Sandbox environment, do the following changes to make PayPal Pro payment gateway live.

In the config.php file,

  • Change the PayPal API credentials (PAYPAL_API_USERNAME, PAYPAL_API_PASSWORD, and PAYPAL_API_SIGNATURE) as per your PayPal Pro Business account.
  • Set PAYPAL_SANDBOX to FALSE.

Stripe Payment Gateway Integration in PHP

Do you want to get implementation help, or enhance the functionality of this script? Click here to Submit Service Request

35 Comments

  1. Tony Nguyen Said...
  2. Daniel Jimenez Said...
  3. Chris Said...
  4. Killahapt Said...
  5. Developer Said...
  6. Alfred Lupian Said...
    • CodexWorld Said...
  7. Kiran Said...
    • CodexWorld Said...
  8. MAHDI KHARBOUCHE Said...
  9. Billy Said...
    • CodexWorld Said...
  10. Sam Said...
  11. Dennis Said...
  12. Ali Haider Said...
  13. Russel Said...
    • CodexWorld Said...
  14. Sayani Said...
    • CodexWorld Said...
  15. Ken Boamponsem Said...
    • CodexWorld Said...
  16. Phine Said...
    • CodexWorld Said...
  17. Subrata Said...
  18. Yuri Boyka Said...
  19. Rupak Shrestha Said...
  20. Tapan Bhanot Said...
  21. Bhavin Said...
    • CodexWorld Said...
  22. Ankit Garg Said...
  23. Prince Lionel Said...
  24. Gerald Said...
  25. Manish Patel Said...
    • CodexWorld Said...
  26. Pierre Cobbaert Said...

Leave a reply

keyboard_double_arrow_up