GithubHelp home page GithubHelp logo

fragote / cakephp-paypalbuttons Goto Github PK

View Code? Open in Web Editor NEW

This project forked from visualex/cakephp-paypalbuttons

0.0 3.0 0.0 10 KB

Use PayPal Buttons as an ORM Table object in CakePHP3

License: MIT License

PHP 100.00%

cakephp-paypalbuttons's Introduction

PaypalButtons plugin

Software License

Installation

Install the plugin with composer

$ composer require tresorg/cakephp-paypalbuttons

Manual install is discouraged but you can check the composer.js file for package requirements.

Add the following configuration to Datasources in your config/app.php file.

'Datasources' => [
   ...
   'paypal_buttons' => [
      'className' => 'Muffin\Webservice\Connection',
      'service' => 'Tresorg/PaypalButtons.PaypalButtons',
      'endpoint' => 'https://api-3t.paypal.com/nvp',
      'credentials' => [
         'USER'      => 'paypal.username',
         'PWD'       => 'pass***word',
         'SIGNATURE' => 'your-signature-here-012345678900123456789001234567890',
         'VERSION'   => 94,
      ],
      // these options can be overridden upon button creation, per button
      'defaults' => [
         'notify_url'   => 'http://exmpl.com/ipn.php',      // IPN calls get called here
         'return'       => 'http://exmpl.com/thanks.php',   // Successful Sales Page
         'cancel_return'=> 'http://exmpl.com/tryagain.php', // Unsuccessful Sale URL
      ],
   ],
],

Usage

If you are loading this plugin from within an object that is not a CakePHP Controller or Shell, use the ModelAwareTrait in your class to get the methods: modelFactory & loadModel.

// use the Muffin Webservice
$this->modelFactory('Endpoint', ['Muffin\Webservice\Model\EndpointRegistry', 'get']);
// load your remote Webservice:
$paypalButtonsRemoteWebservice = $this->loadModel('PaypalButtons.PaypalButtons', 'Endpoint');
// sends the data to paypal
subscription = $this->PaypalButtonsRemote->save( new Entity([
   'item_number' => 'yourInventoryNumber',
   'item_name' => 'MyCoolProductName',
   'price' => 9.99,
   'subscription_type' => 'M', //monthly subscription
   'subscription_recurring' => '1', //recurring subscription
]));
// receive the paypal button ID add it to your form, etc
$buttonId = $buttonCreated->id;

Contribute

This Plugin works great with all currencies, subscriptions, trial periods. Shipping is not implemented yet.

Feel free to contribute, fork and PR.

๐Ÿบ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.