2017 © Pedro Peláez
 

library boa-compra

Unofficial BoaCompra billing PHP library

image

benoth/boa-compra

Unofficial BoaCompra billing PHP library

  • Wednesday, May 18, 2016
  • by Benoth
  • Repository
  • 1 Watchers
  • 1 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Unofficial BoaCompra billing PHP library

Software License Build Status Coverage Status Quality Score SensioLabsInsight, (*1)

This package is compliant with PSR-1, PSR-2 and PSR-4. If you notice compliance oversights, please send a patch via pull request., (*2)

Requirements

The following versions of PHP are supported:, (*3)

  • PHP 5.4
  • PHP 5.5
  • PHP 5.6
  • PHP 7
  • HHVM

The following extensions are also required:, (*4)

  • curl
  • mbstring

Usage

Create a payment

``` php $vsi = new VirtualStoreIdentification($yourStoreId, $yourSecretKey);, (*5)

try { $endUser = new EndUser('me@example.com'); $endUser->setName('John Doe') // ... ->setLanguage('en_US');, (*6)

$payment = new Payment(
    $vsi,
    $endUser,
    $yourReturnUrl,
    $yourNotifyUrl,
    $yourCurrencyIso,
    $yourOrderId,
    $orderDescription,
    $amount // without dot or comma (ie: 500 for $5.00)
);
$payment->setTestMode(1)
        ->setProjectId(1)
        ->setPaymentId(1);

} catch (\Exception $e) { // Log or anything ... }, (*7)

$form = new PaymentFormGenerator($payment);, (*8)

// Then in your HTML code, just call : $form->render();, (*9)


### Validate BoaCompra notification ``` php try { // $payment is your previously set Payment object $notif = new PaymentNotification( $payment, $_POST['store_id'], $_POST['transaction_id'], $_POST['order_id'], $_POST['amount'], $_POST['currency_code'], $_POST['payment_id'], $_SERVER['REMOTE_ADDR'] ); $postback = new PaymentPostBack($notif); $postback->validatePayment(); return 'Ok !'; } catch (\Exception $e) { return 'Error validating the payment : '.$e->getMessage(); }

Check the status of a payment

``` php try { $notif = new PaymentNotification( $payment, $storeId, $transactionId, $orderId, $amount, $currencyCode, $paymentId ); $status = new PaymentCheckStatus($notif); $status->validatePayment(); return 'Ok !'; } catch (\Exception $e) { return 'Error validating the payment : '.$e->getMessage(); }, (*10)


## API The API documentation is available on [Github Pages](http://benoth.github.io/boa-compra/api/Benoth/BoaCompra.html) ## Testing ``` bash $ vendor/bin/phpunit

License

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

The Versions

18/05 2016

dev-master

9999999-dev

Unofficial BoaCompra billing PHP library

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-mbstring *
  • ext-curl *

 

The Development Requires

by Luc Vancrayelynghe

25/09 2015

1.0.3

1.0.3.0

Unofficial BoaCompra billing PHP library

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-mbstring *
  • ext-curl *

 

The Development Requires

by Luc Vancrayelynghe

02/09 2015

1.0.2

1.0.2.0

Unofficial BoaCompra billing PHP library

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-mbstring *
  • ext-curl *

 

The Development Requires

by Luc Vancrayelynghe

28/08 2015

1.0.1

1.0.1.0

Unofficial BoaCompra billing PHP library

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-mbstring *
  • ext-curl *

 

The Development Requires

by Luc Vancrayelynghe

28/08 2015

1.0.0

1.0.0.0

Unofficial BoaCompra billing PHP library

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-mbstring *
  • ext-curl *

 

The Development Requires

by Luc Vancrayelynghe