<?php
require_once 'PayU.php';
//RUTA DOCUMENTACION http://desarrolladores.payulatam.com/integracion-sdk/
//RUTA DOCUMENTACION http://desarrolladores.payulatam.com/sdk-pagos/
////RUTA DOCUMENTACION http://desarrolladores.payulatam.com/sdk-pruebas-pago/
//CONFIGURACION A PAYULATAN
PayU::$apiKey = "6l02o88i116pcrcvtkcad9odvf"; //Ingrese aquí su propio apiKey. //LIGOTOURS
PayU::$apiLogin = "8f964f4b286ca52"; //Ingrese aquí su propio apiLogin. //LIGOTOURS
PayU::$merchantId = "524148"; //Ingrese aquí su Id de Comercio.
PayU::$language = SupportedLanguages::ES; //Seleccione el idioma.
PayU::$isTest = false; //Dejarlo True cuando sean pruebas.
Environment::setPaymentsCustomUrl("https://stgapi.payulatam.com/payments-api/4.0/service.cgi");
//TARJETAS DE CREDITO
$reference = "payment_test_00000001";
$value = "10000";
$parameters = array(
//Ingrese aquí el identificador de la cuenta.
PayUParameters::ACCOUNT_ID => "500538",
//Ingrese aquí el código de referencia.
PayUParameters::REFERENCE_CODE => $reference,
//Ingrese aquí la descripción.
PayUParameters::DESCRIPTION => "payment test",
// -- Valores --
//Ingrese aquí el valor.
PayUParameters::VALUE => $value,
//Ingrese aquí la moneda.
PayUParameters::CURRENCY => "COP",
// -- Comprador
//Ingrese aquí el nombre del comprador.
PayUParameters::BUYER_NAME => "First name and second buyer name",
//Ingrese aquí el email del comprador.
PayUParameters::BUYER_EMAIL => "buyer...@test.com",
//Ingrese aquí el teléfono de contacto del comprador.
PayUParameters::BUYER_CONTACT_PHONE => "7563126",
//Ingrese aquí el documento de contacto del comprador.
PayUParameters::BUYER_DNI => "5415668464654",
//Ingrese aquí la dirección del comprador.
PayUParameters::BUYER_STREET => "calle 100",
PayUParameters::BUYER_STREET_2 => "5555487",
PayUParameters::BUYER_CITY => "Medellin",
PayUParameters::BUYER_STATE => "Antioquia",
PayUParameters::BUYER_COUNTRY => "CO",
PayUParameters::BUYER_POSTAL_CODE => "000000",
PayUParameters::BUYER_PHONE => "7563126",
// -- pagador --
//Ingrese aquí el nombre del pagador.
PayUParameters::PAYER_NAME => "First name and second payer name",
//Ingrese aquí el email del pagador.
PayUParameters::PAYER_EMAIL => "payer...@test.com",
//Ingrese aquí el teléfono de contacto del pagador.
PayUParameters::PAYER_CONTACT_PHONE => "7563126",
//Ingrese aquí el documento de contacto del pagador.
PayUParameters::PAYER_DNI => "5415668464654",
//Ingrese aquí la dirección del pagador.
PayUParameters::PAYER_STREET => "calle 93",
PayUParameters::PAYER_STREET_2 => "125544",
PayUParameters::PAYER_CITY => "Bogota",
PayUParameters::PAYER_STATE => "Bogota",
PayUParameters::PAYER_COUNTRY => "CO",
PayUParameters::PAYER_POSTAL_CODE => "000000",
PayUParameters::PAYER_PHONE => "7563126",
// -- Datos de la tarjeta de crédito --
//Ingrese aquí el número de la tarjeta de crédito
PayUParameters::CREDIT_CARD_NUMBER => "4097440000000004",
//Ingrese aquí la fecha de vencimiento de la tarjeta de crédito
PayUParameters::CREDIT_CARD_EXPIRATION_DATE => "2014/12",
//Ingrese aquí el código de seguridad de la tarjeta de crédito
PayUParameters::CREDIT_CARD_SECURITY_CODE=> "321",
//Ingrese aquí el nombre de la tarjeta de crédito
//PaymentMethods::VISA||PaymentMethods::MASTERCARD||PaymentMethods::AMEX||PaymentMethods::DINERS
PayUParameters::PAYMENT_METHOD => PaymentMethods::VISA,
//Ingrese aquí el número de cuotas.
PayUParameters::INSTALLMENTS_NUMBER => "1",
//Ingrese aquí el nombre del pais.
PayUParameters::COUNTRY => PayUCountries::CO,
//Session id del device.
PayUParameters::DEVICE_SESSION_ID => "vghs6tvkcle931686k1900o6e1",
//IP del pagadador
PayUParameters::IP_ADDRESS => "127.0.0.1",
//Cookie de la sesión actual.
PayUParameters::PAYER_COOKIE=>"pt1t38347bs6jc9ruv2ecpv7o2",
//Cookie de la sesión actual.
PayUParameters::USER_AGENT=>"Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0"
);
$response = PayUPayments::doAuthorizationAndCapture($parameters);
//imprimir..
var_dump($response);
if ($response) {
$response->transactionResponse->orderId;
$response->transactionResponse->transactionId;
$response->transactionResponse->state;
if ($response->transactionResponse->state=="PENDING") {
$response->transactionResponse->pendingReason;
}
$response->transactionResponse->paymentNetworkResponseCode;
$response->transactionResponse->paymentNetworkResponseErrorMessage;
$response->transactionResponse->trazabilityCode;
$response->transactionResponse->responseCode;
$response->transactionResponse->responseMessage;
}
?>