Friday, 21 July 2017

PHP - PayPal Integration


PayPal is a payment processing system, We can integrate PayPal with websites by using with php.

PayPal integration file system

PayPal integration file system included 4 files as shown below.

  • constants.php − This file has included API user name, password and signature.

  • CallerService.php − This file has included PayPal Services, which is used to call PayPal services.

  • confirmation.php − This file has included a form with minimum fields required to make payment process and it will return payment success or failure.

  • PayPal_entry.php − This page has used to send the user the data to PayPal. It acts as an adapter between PayPal and user form.

The user has to download a PayPal SDK file from here and exact a zip file. The zip file contains four php files, We don't need to change any file except constants.php

The constants.php file contains code as shown below −

<?php
   define('API_USERNAME', 'YOUR USER NAME HERE');
   define('API_PASSWORD', 'YOUR PASSWORD HERE');
   define('API_SIGNATURE', 'YOUR API SIGNATURE HERE');
   define('API_ENDPOINT', 'https://api-3t.paypal.com/nvp');
   define('USE_PROXY',FALSE);
   define('PROXY_HOST', '127.0.0.1');
   define('PROXY_PORT', '808');
   define('PAYPAL_URL', 'https://www.PayPal.com/webscr&cmd=_express-checkout&token=');
   define('VERSION', '53.0');
?>

The user will declare User Name, password and signature in above syntax which are placed in constants.php. This is an experimental example so the last amount will be added to sandbox's account.

Related Posts:

  • PHP - PayPal Integration PayPal is a payment processing system, We can integrate PayPal with websites by using with php. PayPal integration file system PayPal integration fi… Read More
  • PHP - DOM Parser Example A HTML Dom parser written in PHP5.X versions. Dom Parser is very good at dealing with XML as well as HTML. Dom parser travels based on tree based an… Read More
  • PHP - SAX Parser Example SAX parser has used to parse the xml file and better for memory management than sample xml parser and DOM. It does not keep any data in memory so it… Read More
  • PHP - XML Introduction What is XML? XML is a mark-up language to share the data across the web, XML is for both human read-able and machine read-able. Example of share-abl… Read More
  • PHP - Ajax XML Parser Ajax XML Example Using with Ajax we can parser xml from local directory as well as servers, Below example demonstrate how to parser xml with web bro… Read More

0 comments:

Post a Comment