El ejemplo esta para realizar la prueba de integraci贸n en ambiente SANDBOX, si deseamos integrar a transacciones en vivo debemos de utilizar las url de producci贸n.
//Creaci贸n de productos:
$products[] = Array('Producto 1', '100', '', '1', '10.00', '10.00');
$products[] = Array('Producto 2', '102', '', '2', '5.00', '10.00');
// Configuraci贸n de campos personalizados
$base_api = "https://sandboxpayments.qpaypro.com/checkout/register_transaction_store";
$http_origin = "https://sandbox.qpaypro.com/";
//Estructura de par谩metros al servicio
$requestSend =
[
"x_login" => 'visanetgt_qpay',
"x_api_key" => '88888888888',
"x_amount" => '24.00',
"x_currency_code" => 'GTQ',
"x_first_name" => 'Usuario',
"x_last_name" => 'Prueba',
"x_phone" => '24963214',
"x_ship_to_address" => 'Ship address',
"x_ship_to_city" => 'Ship City',
"x_ship_to_country" => 'Guatemala',
"x_ship_to_state" => '0',
"x_ship_to_zip" => '1010',
"x_ship_to_phone" =>'11223344',
"x_description" => "Order number: 123",
"x_url_success" => '',
"x_url_error" => '',
"x_url_cancel" =>'URL_de_procedencia',
"http_origin" =>"tuempresa.com",
"x_company" => '',
"x_address" => 'Address',
"x_city" => 'City',
"x_country" => 'Guatemala',
"x_state" => '0',
"x_zip" => '1201',
"products" => json_encode($products),
"x_freight" => '3.00',
"taxes" => '1.00',
"x_email" => 'usuarioprueba@gmail.com',
"x_type" => "AUTH_ONLY",
"x_method" => "CC",
"x_invoice_num" => '123',
"x_visacuotas" => 'si',
"x_relay_url" => 'RUTA_A_DONDE_DEBE_VOLVER_AL_FINALIZAR_PAGO',
"origen"=>"PLUGIN",
"store_type" => "LOCAL"
];
//Llamada al servicio
$headerArray = array(
'Content-Type: application/json;charset=UTF-8'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $base_api);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestSend);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$resp = curl_exec($ch);
$info = curl_getinfo($ch);
//Resultado 'TOKEN GENERADO'
var_dump($resp);
die;
//Ingresar o redireccionar al siguiente URL
https://sandbox.qpaypro.com/payment/store?token=TOKEN_GENERADO