As Paypal already released their new REST APIs for several month and they marked their old approach NVP and SOAP API as LEGACY way to invoke PayPal payment gateway, it’s necessary to update my PayPal Digital Goods tools by PayPal Rest API.

My PayPal Digital Goods tools actually is a PayPal payment gateway to help you selling digital products on your website. Different for 3rd platform like Shoppy, you don’t need to pay any subscription fees for that. Everything is under your control. This tool is built by PHP programming language. PHP latest stable release version is 8.0.2. Therefore, I strongly recommend to working with your PHP project with the latest stable version. Besides PHP, I can also implement PayPal payment gateway with Python or Javascript. But all these are designed for different purpose. Currently, let’s focus on PHP development.

PHP Development ENV for PayPal REST API

Here are all tools for building PHP development environment:

  • PHP
  • VSCode
  • PHP Debug (VScode Extension released by Xdebug)
  • XDebug (PHP Extension)

Here is the official VS code document for developing PHP.

Debug

To debug PHP in VScode, let’s install the PHP Debug VScode extension. After that, we need to install the xdebug PHP extension and enable it in PHP.ini file. Xdebug Wizard can help to download the right version. Here is the way to download the correct version targeting your PHP:

  • Make sure you already install PHP in your system.
  • Type following statment in command line:
php -i > info.txt
  • Open info.txt file
  • Copy and paste content in the wizard
  • Click “Analyse my phpinfo() output” button
  • Following the coming instruction to download xdebug and enable it

For example, this is my installation instruction:

  • Download php_xdebug-3.1.5-7.4-vc15-x86_64.dll (As my current PHP version is 7.4 in Windows). This is different basing on your system and PHP version
  • Rename it to php_xdebug.dll
  • Move the downloaded file to ext folder is D:\Program Files\php-7.4.30\ext
  • Update D:\Program Files\php-7.4.30\php.ini and add the line:
zend_extension = xdebug 
xdebug.mode = debug
xdebug.start_with_request = yes

Now we can programe and debug our PHP script in VS code. This is how debug looks like:

Previous PostNext Post

Leave a Reply

Your email address will not be published. Required fields are marked *