PHPackages                             propa/beanstream - 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. [API Development](/categories/api)
4. /
5. propa/beanstream

ActiveLibrary[API Development](/categories/api)

propa/beanstream
================

Beanstream PHP API

v1.0(8y ago)212.6k45MITPHPPHP &gt;=5.3.0

Since Oct 26Pushed 8y ago3 watchersCompare

[ Source](https://github.com/kulbakin/beanstream)[ Packagist](https://packagist.org/packages/propa/beanstream)[ RSS](/packages/propa-beanstream/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Beanstream PHP API
==================

[](#beanstream-php-api)

Composer ready PHP wrapper for [Beanstream API](http://developer.beanstream.com/documentation/).

Installation
------------

[](#installation)

The recommended way to install the library is using [Composer](https://getcomposer.org).

```
{
    "require": {
        "propa/beanstream": "~1"
    }
}
```

Handling Exceptions
-------------------

[](#handling-exceptions)

If server returns an unexpected response or error, PHP API throws *\\Beanstream\\Exception*. Positive error codes correspond to Beanstream API errors, see [Take Payment Errors](http://developer.beanstream.com/documentation/take-payments/errors/), [Analyze Payment Errors](http://developer.beanstream.com/documentation/analyze-payments/errors/), [Tokenize Payments Errors](http://developer.beanstream.com/documentation/tokenize-payments/errors/). Negative codes correspond to [cURL errors](http://curl.haxx.se/libcurl/c/libcurl-errors.html)(original cURL error codes are positive, in *\\Beanstream\\Exception* those are just reversed). Exception with zero error code are PHP API specific, e.g. *The curl extension is required* or *Unexpected response format*.

Generally, any unsuccessful request, e.g. insufficient data or declined transaction, results in *\\Beanstream\\Exception*, thus *try..catch* is recommended for intercepting and handling them, see example below.

Your First Integration
----------------------

[](#your-first-integration)

The sample below is an equivalent of original [example](http://developer.beanstream.com/documentation/your-first-integration/)from Beanstream.

```
