socialgest/laravel-instapago

Simple library for Instapago API in Laravel 5.*

2.1.0 2017-09-09 13:35 UTC

This package is not auto-updated.

Last update: 2024-05-17 16:40:17 UTC


README

Php Instapago

Library for Instapago in Laravel 5.* (Version 1.0.0)

Note The logos are owned by Instapago and Banesco, respectively..

GitHub issues GitHub forks GitHub license

Installation

To install, run the following command in your project directory

$ composer require socialgest/laravel-instapago

Then in config/app.php add the following to the providers array:

Socialgest\Instapago\InstapagoServiceProvider::class

Also, if you must (recommend you don't), add the Facade class to the aliases array in config/app.php as well:

'Instapago'    => Socialgest\Instapago\Facades\Instapago::class

But it'd be best to just inject the class, like so (this should be familiar):

use Socialgest\Instapago\Instapago;

Configuration

Set in .env

INSTAPAGO_KEY_ID = 74D4A278-C3F8-4D7A-9894-FA0571D7E023
INSTAPAGO_PUBLIC_KEY_ID = e9a5893e047b645fed12c82db877e05a

Example Usage

use Socialgest\Instapago\Instapago;

...

public function pay()
{
    $paymentData = [
        'amount' => '200',
        'description' => 'test',
        'cardHolder' => 'jon doe',
        'cardHolderId' => '11111111',
        'cardNumber' => '4111111111111111',
        'cvc' => '123',
        'expirationDate' => '12/2019',
        'IP' => '127.0.0.1',
    ];

    try{
            $instapago = new Instapago();
            $respuesta = $instapago->directPayment($paymentData);
            // hacer algo con la respuesta
    } catch(\Socialgest\Instapago\Instapago\Exceptions\InstapagoException $e){
        // manejar el error
    } catch(\Socialgest\Instapago\Instapago\Exceptions\TimeoutException $e){
        // manejar el error
    }     
}

Documentation

Documentation (EN)

Documentación (ES)

Key for test

* keyId = 74D4A278-C3F8-4D7A-9894-FA0571D7E023
* publicKeyId = e9a5893e047b645fed12c82db877e05a

License MIT ©️ 2016