PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Ewerton Daniel   Standard Paypal PHP SDK   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Standard Paypal PHP SDK
Compose orders and process payments using Paypal
Author: By
Last change:
Date: 1 year ago
Size: 3,228 bytes
 

Contents

Class file image Download

Generic badge Generic badge Twitter

PayPal Standard PHP SDK

_This library provides developers with a simple set of bindings to help you integrate PayPal Standard to a website and start receiving payments._

? Requirements

php >= 8.1

guzzlehttp/guzzle >= 7.0.1

echosistema/simple-http-request" >= 1.0.1

? Coming soon package to PHP versions < 8.1.

? Installation

First time using PayPal? Create your PayPal account in PayPal, if you don?t have one already.

Download Composer if not already installed

On your project directory run on the command line "composer require ewertondaniel/paypal-standard-php-sdk" for PHP 8.1;

That's it! PayPal Standard PHP SDK has been successfully installed!

??? Examples

? Getting authorization


use EwertonDaniel\PayPal\Auth;

        $authentication = new Auth($client_id, $client_secret, $is_production);
        $authentication->getScopes();
        $authentication->getAccessToken();
        $authentication->getTokenType();
        $authentication->getAppId();
        $authentication->getExpiresIn();
        $authentication->getNonce();

? Create an Order


use EwertonDaniel\PayPal\Order;

        $order = new Order($authentication);
        
        //Set Purchase Unit
        $order->setPaypalRequestId()
            ->setIntent('CAPTURE')
            ->purchaseUnit()
            ->setCurrencyCode('BRL')
            ->addItemWithBasicData('Blacksaber Mandalore', 1, 29900) // string $name, int $quantity, int $value
            ->setReferenceId()
            ->setDescription('I can write up to one hundred and twenty seven characters as a description...');
            
        // Set Payment Source    
        $order->pushPurchaseUnit()
            ->paymentSource()
            ->paypal()
            ->experienceContext()
            ->setPaymentMethodPreference('IMMEDIATE_PAYMENT_REQUIRED')
            ->setBrandName('Bounty Hunters Guild (BHG)') // Company name
            ->setLocale('pt-BR')
            ->setLandingPage('LOGIN')
            ->setShippingPreference('NO_SHIPPING')
            ->setUserAction('PAY_NOW')
            ->setReturnUrl('https://example.com/returnUrl')
            ->setNotificationUrl('https://example.com/notifyUrl')
            ->setCancelUrl('https://example.com/cancelUrl');
            
        $response = $order->create();

? Order Details


use EwertonDaniel\PayPal\Order;
        $order_id = $_POST['token'];
        $detail = $order->setOrderId($order_id)->detail();

? Documentation

? Visit the PayPal for further information regarding:

PayPal REST APIs Documentation