sahusoftcom / paypal-expresscheckout-digital-goods by faizahmedfarooqui

PHP (Laravel) Package for PayPal Express CheckOut of Digital Goods
229
1
16
Package Data
Maintainer Username: faizahmedfarooqui
Maintainer Contact: faiz@sahusoft.com (faizahmedfarooqui)
Package Create Date: 2017-03-23
Package Last Update: 2019-10-21
Home Page: http://geekyants.com
Language: PHP
License: Sahu Soft India Private Limited
Last Refreshed: 2024-12-21 03:02:00
Package Statistics
Total Downloads: 229
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 16
Total Forks: 1
Total Open Issues: 0

PayPal ExpressCheckout Digital Goods Laravel Version: 1.0

Service Provider of PayPal ExpressCheckout Digital Goods API for Laravel PHP Framework [ Packagist ]

Installation:

Type the following command in your project directory composer require sahusoftcom/paypal-expresscheckout-digital-goods

OR

Add the following line to the require section of composer.json:

{
    "require": {
        "sahusoftcom/paypal-expresscheckout-digital-goods": "dev-master"
    }
}

How to use:

  • You should use the PayPal class to access its function.
  • Then follow the below example for further assisstance,
<?php
namespace App;
 
use SahusoftCom\PayPal\PaymentRequest;
use SahusoftCom\PayPal\PaymentResponse;

class PaymentController {	

    	public $apiContext;
    
	public function __construct()
	{
	    $apiContext = (object)[];
		
            $apiContext->APIUSERNAME = "YOUR-API-USERNAME";
            $apiContext->APIPASSWORD = "YOUR-API-PASSWORD";
            $apiContext->APISIGNATURE = "YOUR-API-SIGNATURE";
            $apiContext->ENDPOINT = "https://api-3t.sandbox.paypal.com/nvp";
            $apiContext->VERSION = "65.1";
            $apiContext->REDIRECTURL = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=";
	    
	    $data = [];
            $data['RETURNURL'] = "http://paypal.local.geekydev.com/getDone";
            $data['CANCELURL'] = "http://paypal.local.geekydev.com/getCancel";
            $data['NOTIFYURL'] = "http://paypal.local.geekydev.com/getNotified";
        
            $data['CURRENCY'] = "USD";
            $data['TOTAL_AMOUNT'] = "100";
            $data['AMOUNT'] = "100";
            $data['TAX_AMOUNT'] = "0";
            $data['DESCRIPTION'] = "Movies";
            $data['PAYMENT_ACTION'] = "SALE";
            $data['NOSHIPPING'] = "1";
        
            $data['ITEM_LIST'] = [];
            $data['ITEM_LIST'][0] = [
            	'NAME'			=> 'First Item Name',
        		'NUMBER'		=> 123,
        		'QUANTITY'		=> 1,
        		'TAX_AMOUNT'	=> 0,
        		'AMOUNT'		=> 100,
        		'URL'           => "Your product's url",
        		'DESCRIPTION'	=> 'First Name Description'
            ];
	}
	
	public function checkOut()
	{
            $object = new PaymentRequest($this->apiContext);
            $object->execute($this->data);
	}
	
	public function getDone()
	{
            $object = new \SahusoftCom\PayPal\PaymentResponse($apiContext);
            $response = $object->handle($this->data);

            echo "<pre>";
            print_r($response);
            echo "</pre>";
	}
	
	public function getCancel()
	{
	   // Do your thing
	}