PHP code example of tepuilabs / laravel-instapago
1. Go to this page and download the library: Download tepuilabs/laravel-instapago library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tepuilabs / laravel-instapago example snippets
return [
'key_id' => env('INSTAPAGO_KEY_ID'),
'public_key_id' => env('INSTAPAGO_PUBLIC_KEY_ID'),
];
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
}
bash
php artisan vendor:publish --tag="laravel-instapago-config"