PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of ángel cruz   PHP Instapago   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Example script
Class: PHP Instapago
Process payments with the Instapago API
Author: By
Last change: update repo (#45)

* Fixed what needed fixing and squished some bugs. :bug:

* Fixed what needed fixing and squished some bugs. :bug:

* Fixed what needed fixing and squished some bugs. :bug:

* Fixed what needed fixing and squished some bugs. :bug:

* removing execution order from phpunit

https://github.com/pestphp/pest/issues/500
Date: 3 months ago
Size: 3,051 bytes
 

Contents

Class file image Download

<p align="center"> <img src="help/hYNsH6B.png">

</p> <p align="center">

Librería Instapago para PHP

</p> <p align="center">

<sup style="color: #d0d0d0;"><b>NOTA</b> Los logos son propiedad de Instapago y Banesco, respectivamente.</sup>

</p>

Latest Version on Packagist GitHub Workflow Status Total Downloads

instalación

Primero, composer

Luego:

$ composer require instapago/instapago
$ composer dumpautoload -o // opcional

como usar

>NOTA: Tomar en cuenta que esta nueva versión fue probada usando php8.X, no aseguro que funcione en algo menor a eso, en teoría debería pero no estoy seguro.

<?php

require 'vendor/autoload.php';

use \Instapago\Instapago\Api;
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{

  $api = new Api('<keyId>','<publicKeyId>');

  $respuesta = $api->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

}

Podemos revisar rápidamente si todo funciona correctamente escribiendo:

$ php -S localhost:8000

tests

composer test

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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