1. Go to this page and download the library: Download gabrielchavezme/srpago 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/ */
gabrielchavezme / srpago example snippets
//Required
/// Librerías requeridas
ambiente
\SrPago\SrPago::setLiveMode(false);
\SrPago\SrPago::setApiKey('KEY');
\SrPago\SrPago::setApiSecret('SECRET');
/// Parámetros de cobro
$chargeParams = array(
"amount"=>10.0,
"description" => "demo de cargo directo con token tok_5ac666440e35f",
"reference"=> "AB98XXCVBD",
"ip"=> "189.203.45.58",//OPTIONAL REMOTE IP
"latitude"=> "-9.11111111",//OPTIONAL REMOTE IP
"longitude"=> "9.999999",//OPTIONAL REMOTE IP
//"installments"=>3, //OPTIONAL Montly installments 3,6,9,12
"source"=>"tok_dev_5b32c39085517" //TOKEN CARD REQUIRED
);
///Agrega información de metadata
/// see more information in “Metadata Object” section
$metadata = array(
"items"=>array(
"item" => array(
array(
"itemNumber"=> "193487654",
"itemDescription"=> "iPhone 6 32gb",
"itemPrice"=> "599.00",
"itemQuantity"=> "1",
"itemMeasurementUnit"=> "Pza",
"itemBrandName"=> "Apple",
"itemCategory"=> "Electronics",
"itemTax"=> "12.95"
),
)
)
);
$chargeParams['metadata'] = $metadata;
try {
/// Procesar cobro
$chargesService = new \SrPago\Charges();
$charge = $chargesService->create($chargeParams);
}catch(\SrPago\Error\SrPagoError $ex){
}
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.