socialgest / laravel-instapago by SocialGest

Simple library for Instapago API in Laravel 5.*
52,071
8
2
Package Data
Maintainer Username: SocialGest
Maintainer Contact: joseenrique@socialgest.net (José Martorano)
Package Create Date: 2016-10-27
Package Last Update: 2017-09-12
Language: PHP
License: MIT
Last Refreshed: 2024-05-04 15:11:00
Package Statistics
Total Downloads: 52,071
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 8
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Php Instapago

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 :copyright: 2016