PHPackages                             bllem/speck-paypal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. bllem/speck-paypal

ActiveLibrary[Payment Processing](/categories/payments)

bllem/speck-paypal
==================

A generic module for adding PayPal support to a ZF2 application.

0188PHP

Since Dec 3Pushed 7y ago1 watchersCompare

[ Source](https://github.com/bllem/SpeckPaypal)[ Packagist](https://packagist.org/packages/bllem/speck-paypal)[ RSS](/packages/bllem-speck-paypal/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

SpeckPaypal
===========

[](#speckpaypal)

A generic module for adding PayPal Payments support to a ZF2 application.

[![Build Status](https://camo.githubusercontent.com/b214847543b2f90f094def00bbd1f0c0803f82aa426a54ab34acedd0f09e6575/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f737065636b636f6d6d657263652f537065636b50617970616c2e706e67)](http://travis-ci.org/speckcommerce/SpeckPaypal)

Introduction
------------

[](#introduction)

SpeckPaypal is a module that can be utilized outside of Speck Commerce to accept payments via paypal. This module currently supports PayPal Payments Pro and Express Checkout API Operations.

Please see: [Paypal API Docs](https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_api_reference)

To integrate with this module you will want to sign up for a sandbox account on Paypal. See the developer website for instructions.

This module currently supports the following calls with API version 95.0:

- Callback
- DoAuthorization
- DoCapture
- DoDirectPayment
- DoExpressCheckoutPayment
- DoVoid
- GetBalance
- GetExpressCheckoutDetails
- GetTransactionDetails
- RefundTransaction
- SetExpressCheckout
- TransactionSearch
- UpdateRecurringPaymentsProfile
- ManageRecurringPaymentsProfileStatus
- CreateRecurringPaymentsProfile

Requirements
------------

[](#requirements)

The dependencies for SpeckCommerce are set up as Git submodules so you should not hav

- PHP 5.4+ (Note: This library should work with PHP 5.3.3+ however official support is no longer provided)
- [Zend Framework 2](https://github.com/zendframework/zf2) (latest master)

Contributors
------------

[](#contributors)

- \[Steve Rhoades\] () (IRC: srhoades) [![Build Status](https://camo.githubusercontent.com/f4c384501f1b6bd1c90a48d6f74da6258f2bdab2a03469ba48dfb3734dd65b46/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f737465766572686f616465732f537065636b50617970616c2e706e67)](http://travis-ci.org/steverhoades/SpeckPaypal)

Community
---------

[](#community)

Join us on the Freenode IRC network: #speckcommerce. Our numbers are few right now, but we're a dedicated small group working on this project full time.

Example Usage
-------------

[](#example-usage)

Create a Paypal Request Object:

```
//setup config object
$config = array(
    'username'      => 'your_username',
    'password'      => 'your_password',
    'signature'     => 'your_signature',
    'endpoint'      => 'https://api-3t.sandbox.paypal.com/nvp' //this is sandbox endpoint
)
$paypalConfig = new \SpeckPaypal\Element\Config($config);

//set up http client
$client = new \Zend\Http\Client;
$client->setMethod('POST');
$client->setAdapter(new \Zend\Http\Client\Adapter\Curl);
$paypalRequest = new \SpeckPaypal\Service\Request;
$paypalRequest->setClient($client);
$paypalRequest->setConfig($paypalConfig);
```

Direct Payment Example (by default the request is sent as "Sale" which is equivalent to Authorize Capture):

```
$paymentDetails = new \SpeckPaypal\Element\PaymentDetails(array(
    'amt' => '10.00'
));

$payment = new \SpeckPaypal\Request\DoDirectPayment(array('paymentDetails' => $paymentDetails));
$payment->setCardNumber('4744151425799438');
$payment->setExpirationDate('112017');
$payment->setFirstName('John');
$payment->setLastName('Canyon');
$payment->setIpAddress('255.255.255.255');
$payment->setCreditCardType('Visa');
$payment->setCvv2('345');

$address = new \SpeckPaypal\Element\Address;
$address->setStreet('27 Your Street');
$address->setStreet2('Apt 23');
$address->setCity('Some City');
$address->setState('California');
$address->setZip('92677');
$address->setCountryCode('US');
$payment->setAddress($address);

$response = $paypalRequest->send($payment);

echo $response->getTransactionId();
```

Express Checkout Example:

It's important to understand the flow of PayPal's express checkout before attempting to use this API. [![Paypal Express Checkout Flow](https://camo.githubusercontent.com/986ad840d0d1a0d5e57196c1e635178887c811d5d01b334ebe6cdac60bfebd1b/687474703a2f2f7777772e7374657068656e72686f616465732e636f6d2f636170732f3534613363372e706e67)](https://camo.githubusercontent.com/986ad840d0d1a0d5e57196c1e635178887c811d5d01b334ebe6cdac60bfebd1b/687474703a2f2f7777772e7374657068656e72686f616465732e636f6d2f636170732f3534613363372e706e67)

In order to redirect the user to PayPal we first need to get a token.

```
$paymentDetails = new \SpeckPaypal\Element\PaymentDetails(array(
    'amt' => '20.00'
));
$express = new \SpeckPaypal\Request\SetExpressCheckout(array('paymentDetails' => $paymentDetails));
$express->setReturnUrl('http://www.someurl.com/return');
$express->setCancelUrl('http://www.someurl.com/cancel');

$response = $paypalRequest->send($express);

echo $response->isSuccess();

$token = $response->getToken();
```

Once you have received the token you forward the user to the paypal servers including the token you received. Refer to the documentation for URL. Once the user has completed the checkout process at PayPal they will be redirected to the URL you provided in SetExpressCheckout. When the user lands on this page you will need to make a call back to PayPal including the Token to receive the buyers payment details. You will use the payerId which is included in the response to capture the payment via DoExpressCheckoutPayment.

```
$details = new \SpeckPaypal\Request\GetExpressCheckoutDetails(array('token' => $token));

$response = $paypalRequest->send($details);

$payerId = $response->getPayerId();
```

Now that you have the payerId you can capture the payment by calling DoExpressCheckoutPayment.

```
//To capture express payment
$captureExpress = new \SpeckPaypal\Request\DoExpressCheckoutPayment(array(
    'token'             => $token,
    'payerId'           => $payerId,
    'paymentDetails'    => $paymentDetails
));
$response = $paypalRequest->send($captureExpress);

echo $response->isSuccess();
```

Transaction Search Example:

```
$transactionSearch new \SpeckPaypal\Request\TransactionSearch();
$transactionSearch->setStartDate('2014-06-21T00:00:00Z');

$paypalRequest = $serviceManager->get('SpeckPaypal\Service\Request');
$response = $paypalRequest->send($transactionSearch);

var_dump($response->getResults());
```

TODO
----

[](#todo)

- better validation based on paypal requirements (currently validation is loose)
- refactor to relevant exception classes
- add support for ebay items, survey questions ... and other missing payments pro apis

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 76.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8177592?v=4)[Artem Kaplenko](/maintainers/bllem)[@bllem](https://github.com/bllem)

---

Top Contributors

[![steverhoades](https://avatars.githubusercontent.com/u/1146668?v=4)](https://github.com/steverhoades "steverhoades (51 commits)")[![Xerkus](https://avatars.githubusercontent.com/u/725842?v=4)](https://github.com/Xerkus "Xerkus (6 commits)")[![bllem](https://avatars.githubusercontent.com/u/8177592?v=4)](https://github.com/bllem "bllem (5 commits)")[![bibear](https://avatars.githubusercontent.com/u/385131?v=4)](https://github.com/bibear "bibear (2 commits)")[![fecka](https://avatars.githubusercontent.com/u/439274?v=4)](https://github.com/fecka "fecka (2 commits)")[![EvanDotPro](https://avatars.githubusercontent.com/u/5607?v=4)](https://github.com/EvanDotPro "EvanDotPro (1 commits)")

### Embed Badge

![Health badge](/badges/bllem-speck-paypal/health.svg)

```
[![Health](https://phpackages.com/badges/bllem-speck-paypal/health.svg)](https://phpackages.com/packages/bllem-speck-paypal)
```

###  Alternatives

[omnipay/coinbase

Coinbase driver for the Omnipay payment processing library

18570.2k1](/packages/omnipay-coinbase)[oxid-esales/amazon-pay-module

AmazonPay module for OXID

1824.3k](/packages/oxid-esales-amazon-pay-module)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
