PHP code example of leonardcodep / pagoefectivoperu-php
1. Go to this page and download the library: Download leonardcodep/pagoefectivoperu-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/ */
leonardcodep / pagoefectivoperu-php example snippets
// Usando Composer (o puedes incluir las dependencias manualmente)
y {
$pagoEfectivo = new Pagoefectivo\PagoEfectivo(array('isProduction'=>false,'secretKey' => "Ysy+khByjae6/XaK2HHTEsqa8xrujy02DblRtPbw"));
$autorizacion = $pagoEfectivo->Authorizations->create(
array(
"accessKey" => "MTFmZjlmZTE5YjE2MTEz",
"idService" => "1035",
)
);
if($autorizacion->code == "100" ){
echo $autorizacion->data->token;
}
} catch (Exception $e) {
echo json_encode($e->getMessage());
}
// Usando Composer (o puedes incluir las dependencias manualmente)
$pagoCIP = new Pagoefectivo\PagoEfectivo(array('isProduction'=>false,'bearer' => ""));
$pagoResult = $pagoCIP->CipPagoEfectivo->create(
array(
"currency" => "PEN", // PEN (soles) OR USD (Dólares)
"amount" => 160.35, // El Monto de la operación. El separador es un "." 16 dígitos numéricos 2 dígitos decimales
"transactionCode" => 1345, // EL ID DE TU PEDIDO DE TU SISTEMA
// "dateExpiry" => 10, // default 50
// "paymentConcept" => "Venta de zapatillas", //(OPCIONAL)
// "additionalData" => "Venta por verano", //(OPCIONAL)
// "adminEmail" => "[email protected] ", //(OPCIONAL)
"userEmail" => "[email protected] ",
// "userId" => "12", // ID DE USUARIO DE TU SISTEMA (OPCIONAL)
// "userName" => "Leonardo ", //(OPCIONAL)
// "userLastName" => "Manuel Alvarez", //(OPCIONAL)
// "userUbigeo" => "150115", // Ubigeo de la operación (INEI), ejemplo:150115 (Lima-Lima-La Victoria).
// "userCountry" => "Perú", //País del usuario. (OPCIONAL)
// "userDocumentType" => "DNI", // OR DNI (Documento nacional de identidad) , PAR (Partida), PAS (Pasaporte), LMI (Libreta militar) y NAN (Otro) (OPCIONAL)
// "userDocumentNumbe" => "75241285", //(OPCIONAL)
// "userPhone" => "987456321", //(OPCIONAL)
// "userCodeCountry" => "+51", //(OPCIONAL)
)
);
$resultJSON = json_encode($pagoResult);
echo $resultJSON;
} catch (Exception $e) {
echo json_encode($e->getMessage());
}
$pagoEfectivo = new Pagoefectivo\PagoEfectivo(array('isProduction'=>false,'secretKey' => "Ysy+khByjae6/XaK2HHTEsqa8xrujy02DblRtPbw"));
$autorizacion = $pagoEfectivo->Authorizations->create(
array(
"accessKey" => "MTFmZjlmZTE5YjE2MTEz",
"idService" => "1035",
)
);
// REALIZANDO PAGO
if($autorizacion->code == "100" ){
// echo $autorizacion->data->token;
$pagoCIP = new Pagoefectivo\PagoEfectivo(array('isProduction'=>false,'bearer' => $autorizacion->data->token));
$pagoResult = $pagoCIP->CipPagoEfectivo->create(
array(
"currency" => "PEN",
"amount" => "160.35",
"transactionCode" => "1345",
"dateExpiry" => 50,
"userEmail" => "[email protected] ",
// "userDocumentType" => "DNI",
// "userDocumentNumbe" => "75852565",
// "userCountry" => "Perú",
// "paymentConcept" => "Por venta de celular lenovo"
)
);
}
// $myJSON = json_encode($autorizacion);
$myJSON = json_encode($pagoResult);
echo $myJSON;
} catch (Exception $e) {
echo json_encode($e->getMessage());
}
json
{
"nardcodep/pagoefectivoperu-php": "dev-master"
}
}