kmj/paypalbridgebundle

Symfony2 Bundle creates a bridge for the PayPal REST SDK

Installs: 41 659

Dependents: 0

Suggesters: 0

Security: 0

Stars: 6

Watchers: 7

Forks: 9

Open Issues: 3

Type:symfony-bundle

dev-master 2014-10-08 01:32 UTC

This package is auto-updated.

Last update: 2024-04-12 18:08:37 UTC


README

Welcome to the KMJPayPalBridgeBundle. The goal of this bundle is to provide an easy way to integrate the Paypal SDK into a Symfony project.

  1. Installation

KMJPayPalBridgeBundle can conveniently be installed via Composer. Just add the following to your composer.json file:

// composer.json
{
    // ...
    require: {
        // ..
        "paypal/rest-api-sdk-php": "dev-master",
        "kmj/paypalbridgebundle": "dev-master"

    }
}

Then, you can install the new dependencies by running Composer's update command from the directory where your composer.json file is located:

    php composer.phar update

Now, Composer will automatically download all required files, and install them for you. All that is left to do is to update your AppKernel.php file, and register the new bundle:

// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new KMJ\PayPalBridgeBundle\KMJPayPalBridgeBundle(),
    // ...
);
  1. Usage

The KMJPayPalBridgeBundle is called as a standard service.

$this->get('paypal')

This returns a service that sets the paypal SDK with the proper ini settings. The service also contains a valid PayPal\Rest\ApiContext object that can be passed to other PayPal objects. This bundle also automatically swtiches the bundle based on the environment. The production environment is the only environment that gets the production endpoint for PayPal

  1. Configuration
kmj_pay_pal_bridge:
    environment: sandbox/production                      //The environment to make the calls to
    sandbox:
        clientId:                                           //Client Id provided from developer.paypal.com
        secret:                                             //Client Secret provided from developer.paypal.com
    production:
        clientId:                                           //Client Id provided from developer.paypal.com
        secret:                                             //Client Secret provided from developer.paypal.com
    logs:
        enabled: true                                   //Should logs be used
        filename: %kernel.root_dir%/logs/paypal.log     //the location for the log file
        level: fine                                     //level of log reporting
    http:
        timeout: 30                                     //The http timeout before an error is generated
        retry: true                                     //Should the request be tried again if timeout is reached