2017 © Pedro Peláez
 

library paypal-rest-api

Very Easy to use PayPal REST API Wrapper Class.

image

vatps/paypal-rest-api

Very Easy to use PayPal REST API Wrapper Class.

  • Wednesday, October 7, 2015
  • by vatps
  • Repository
  • 2 Watchers
  • 1 Stars
  • 25 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PayPal REST API Wrapper

Very Easy to use PayPal REST Enabled API Wrapper Class in PHP., (*1)

Requires PHP 5.4 and curl extension., (*2)

Installation

You can install the paypal-rest-api using Composer. Just add the following to your composer.json:, (*3)

{
    "require": {
        "vatps/paypal-rest-api": "dev-master"
    }
}

You will then need to: * run composer install to get these dependencies added to your vendor directory * add the autoloader to your application with this line: require("vendor/autoload.php"), (*4)

Alternatively you can just download the PayPal.php file and include it manually., (*5)

Laravel Installation

Run composer require vatps/paypal-rest-api in terminal., (*6)

Code Example (Create a Payment)

<?php
use \VPS\PayPal;

$client_id = 'ATTUpBCpxG7h9PLUpENHKmhMiJsZqsJ-4tib0_oflCL9WFs8enQEGOxxIGZJ';
$client_secret = 'EM9xPhC2KJUiIoZ3l6965T0b7_X5QQX035JJfc9ijHtMKn4bGmE_qyTR45A9';
$sandbox = true;                                        

$pp = new PayPal($client_id, $client_secret, $sandbox);

$data = array(
    'intent' => 'sale',
    'payer' => array(
        'payment_method' => 'paypal'
    ),
    'transactions' => array(
        array(
            'amount' => array(
                'total' => '9.99',
                'currency' => 'USD'
            ),
            'description' => 'Demo Request'
        )
    ),
    'redirect_urls' => array(
        'return_url' => 'http://mydomain.dev/return.php',
        'cancel_url' => 'http://mydomain.dev/cancel.php'
    )
);

$request = $pp->post('/v1/payments/payment', $data);

var_dump($request);

You can find all available API operations at https://developer.paypal.com/docs/api/, (*7)

Contact me if you need any help., (*8)

The Versions

07/10 2015

dev-master

9999999-dev https://github.com/vatps/paypal-rest-api

Very Easy to use PayPal REST API Wrapper Class.

  Sources   Download

MIT

The Requires

  • ext-curl *
  • php >=5.4.0

 

api php class paypal