Skip to content

TepuiLABS/laravel-instapago

Repository files navigation

Library for payments in VEF (Bsf.) in Venezuela.

Latest Version on Packagist Tests Total Downloads

Library for payments in VEF (Bsf.) in Venezuela.

Installation

You can install the package via composer:

composer require tepuilabs/laravel-instapago

You can publish the config file with:

php artisan vendor:publish --tag="laravel-instapago-config"

This is the contents of the published config file:

<?php

return [
    'key_id' => env('INSTAPAGO_KEY_ID'),
    'public_key_id' => env('INSTAPAGO_PUBLIC_KEY_ID'),
];

Usage

use \Instapago\Instapago\Exceptions\{
	InstapagoException,
	AuthException,
	BankRejectException,
	InvalidInputException,
	TimeoutException,
	ValidationException,
	GenericException,
};

$paymentData = [
    'amount' => '200',
    'description' => 'test',
    'card_holder' => 'jon doe',
    'card_holder_id' => '11111111',
    'card_number' => '4111111111111111',
    'cvc' => '123',
    'expiration' => '12/2020',
    'ip' => '127.0.0.1',
];

try{

    $response = LaravelInstapago::directPayment($paymentData);
    // hacer algo con $respuesta
}catch(InstapagoException $e){

  echo $e->getMessage(); // manejar el error

}catch(AuthException $e){

  echo $e->getMessage(); // manejar el error

}catch(BankRejectException $e){

  echo $e->getMessage(); // manejar el error

}catch(InvalidInputException $e){

  echo $e->getMessage(); // manejar el error

}catch(TimeoutException $e){

  echo $e->getMessage(); // manejar el error

}catch(ValidationException $e){

  echo $e->getMessage(); // manejar el error

}catch(GenericException $e){

  echo $e->getMessage(); // manejar el error

}

TODO: add more docs

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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