PHP code example of blogui91 / srpago-php
1. Go to this page and download the library: Download blogui91/srpago-php 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/ */
blogui91 / srpago-php example snippets
//Required
ce '/vendor/srpago-php/init.php';
SrPago::setLiveMode(false);
SrPago::setApiKey('999999seere4-6e52-449d-83d0-898294843222');
SrPago::setApiSecret('Absjrj432002$$.4322');
/// Parámetros de cobro
$chargeParams = array(
"amount"=>9.0,
"description" => "demo de cargo directo con token", //OPTIONAL DESCRIPTION
"reference"=> "AB98XXCVBD",//OPTIONAL REFERENCE ID
"ip"=> "189.203.45.58",//OPTIONAL REMOTE IP
//"latitude"=> "-9.11111111",//OPTIONAL LATITUDE
//"longitude"=> "9.999999",//OPTIONAL LONGITUDE
//"installments"=>3, //OPTIONAL Montly installments 3,6,9,12
"source"=>"tok_5966f0cdd3697"
);
//Include Metadata
$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;
$chargesService = new \SrPago\Charges();
$charge = $chargesService->create($chargeParams);
echo $charge;
bash
composer