bamboopayment/bamboopayment-sdk

PHP SDK to interact with BambooPayment PCI API

v0.10.0 2021-12-23 17:01 UTC

README

Latest Version on Packagist Software License Build Status Coverage Status Total Downloads

System Requirements

You need PHP >= 7.4

Dependencies

The bindings require the following extensions in order to work properly:

  • json (This extension implements the » JavaScript Object Notation (JSON) data-interchange format.)
  • guzzle (Guzzle is a PHP HTTP client to send HTTP requests and to integrate with web services.)
  • generated-hydrator (GeneratedHydrator is a library about high performance transition of data from arrays to objects and from objects to arrays.)

If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.

Documentation

Full documentation: Spanish, English, Portuguese.

Installation

Composer

To install with Composer, simply run the following command:

composer require bamboopayment/bamboopayment-sdk

Or you can manually add the requirement to your composer.json file:

{
  "require" : {
    "bamboopayment/bamboopayment-sdk" : "0.1.*"
  }
}

Then install by running

composer.phar install

Manual installation

Obtain the latest version of BambooPayment SDK with:

git clone https://github.com/BambooPayment/sdk_php.git

Getting started

If you are using Composer use autoload functionality:

include "vendor/autoload.php";

Usage

Creating a customer

File with working example: examples/customers/create.php

To create an order using REST API in back-end you must provide an Array with customer data:

in your controller

    $bambooPaymentClient = new BambooPaymentClient(
        [
            'api_key' => PRIVATE_KEY,
            'testing' => true,
        ]
    );

    $customer = $bambooPaymentClient->customers->create(
        [
            'Email'          => 'testing@bamboopayment.com',
            'FirstName'      => 'PrimerNombre',
            'LastName'       => 'PrimerApellido',
            'DocNumber'      => 12345672,
            'DocumentTypeId' => 2,
            'PhoneNumber'    => '24022330',
            'BillingAddress' => [
                'AddressType'   => 1,
                'Country'       => 'UY',
                'State'         => 'Montevideo',
                'City'          => 'MONTEVIDEO',
                'AddressDetail' => '10000'
            ]
        ]
    );

Creating a purchase

File with working example: examples/purchases/create.php

To create an order using REST API in back-end you must provide an Array with purchase data:

in your controller

    $bambooPaymentClient = new BambooPaymentClient(
        [
            'api_key' => PRIVATE_KEY,
            'testing' => true,
        ]
    );

    $purchase = $bambooPaymentClient->purchases->create(
        [
            'TrxToken'     => 'OT__klLNXDDkgAvk1KXG-i6SIUxo-ACnvpjf4jiYpVJ8SzQ_',
            'Order'        => '12345678',
            'Amount'       => 100,
            'Installments' => 1,
            'Customer'     => [
                'Email'          => 'juanperez123@bamboopayment.com',
                'FirstName'      => 'Juan',
                'LastName'       => 'Perez',
                'PhoneNumber'    => '099123123',
                'DocNumber'      => '12345672',
                'DocumentTypeId' => 2,
                'BillingAddress' => [
                    'AddressType'   => 1,
                    'Country'       => 'Uruguay',
                    'State'         => 'Montevideo',
                    'City'          => 'MONTEVIDEO',
                    'AddressDetail' => 'Av. Sarmiento 2260'
                ]
            ],
            'DataUY'       => [
                'IsFinalConsumer' => 'true',
                'Invoice'         => '1000',
                'TaxableAmount'   => 100
            ],
            'Currency'     => 'UYU',
            'Capture'      => 'true'
        ]
    );

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes using the Angular Contributing Guide (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Run composer test to test your code (composer test)
  6. Create new Pull Request

Support

For support, email soportetec@bamboopayment.com

License

The MIT License (MIT). Please see License File for more information.