Giter Club home page Giter Club logo

paypal's Introduction

This library is written in php 5.3 and uses namespaces.

use PayPalNVP\PayPalNVP,
    PayPalNVP\Profile\ApiSignature,
    ...

or you can use class names with namespaces.

Every request needs profile, which is either PayPalNVP\ApiSignature, or PayPalNVP\ApiCertificate. Most of the users use ApiSignature.

$profile = new ApiSignature('username', 'password', 'signature');

Request are sent (and responses set) using PayPalNVP\PayPalNVP object. Which takes profile and environment as arguments. Environment has only static constructors and acts as an enum.

$paypal = new PayPalNVP($profile, Environment::SANDBOX());

The rest of the code depends on what request you want to make. Set express checkout would look like this:

/* items with prices */
$items = array();
$items[] = PaymentItem::getRequest('10');
$items[] = PaymentItem::getRequest('14');

/* payment */
$payment = Payment::getRequest($items);

/* set express checkout operation */
$setEC = SetExpressCheckout::newInstance($payment, "http://your_success_url", "http://your_cancel_url");

/* request is sent and response set on $setEC */
$paypal->setResponse($setEC);

/* now you can call getter for response */
$setECResponse = $setEC->getResponse();

/* or if you prefer array of all name value pairs */
$nvpArray = $setECResponse->getResponse();

/* to check if there are any errors with the submission */
$errors = $setECResponse->getErrors();

All operations are very similar, they use main paypal object. You need to create an instance of a request (PayPalNVP/Request package) and response is set using setResponse method on PayPalNVP. All requests have getResponse() method which returns appropriate response.

paypal's People

Contributors

pete911 avatar rdeeb avatar

Watchers

 avatar

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.