Ejemplo n.º 1
0
Archivo: sdk.php Proyecto: jorgeauh/a
 function __construct($isCashPayment = false, $credentials = array())
 {
     PayU::$language = SupportedLanguages::ES;
     //Seleccione el idioma.
     if (sizeof($credentials) > 0) {
         if (isset($credentials['accountID'])) {
             $this->setAccountID($credentials['accountID']);
         }
         if (isset($credentials['apiKey'])) {
             $this->setApiKey($credentials['apiKey']);
         }
         if (isset($credentials['apiLogin'])) {
             $this->setApiLogin($credentials['apiLogin']);
         }
         if (isset($credentials['merchantId'])) {
             $this->setMerchantId($credentials['merchantId']);
         }
     }
     // URL de Pagos
     Environment::setPaymentsCustomUrl("https://api.payulatam.com/payments-api/4.0/service.cgi");
     // URL de Consultas
     Environment::setReportsCustomUrl("https://api.payulatam.com/reports-api/4.0/service.cgi");
     // URL de Suscripciones para Pagos Recurrentes
     Environment::setSubscriptionsCustomUrl("https://api.payulatam.com/payments-api/rest/v4.3/");
     //Informacion para conexion de SDK
     PayU::$apiKey = $this->getApiKey();
     PayU::$apiLogin = $this->getApiLogin();
     PayU::$merchantId = $this->getMerchantId();
 }
Ejemplo n.º 2
0
 * @author nick
 * @since 2015/12/09
 * 
 */
require_once 'payulib/PayU.php';
$startTime = date('Y-m-d H:i:s');
PayU::$apiKey = "6u39nqhq8ftd0hlvnjfs66eh8c";
PayU::$merchantId = "500238";
PayU::$apiLogin = "******";
PayU::$language = SupportedLanguages::ES;
PayU::$isTest = false;
Environment::setPaymentsCustomUrl("https://stg.api.payulatam.com/payments-api/4.0/service.cgi");
// Queries URL
Environment::setReportsCustomUrl("https://stg.api.payulatam.com/reports-api/4.0/service.cgi");
// Subscriptions for recurring payments URL
Environment::setSubscriptionsCustomUrl("https://stg.api.payulatam.com/payments-api/rest/v4.3/");
//---------------get order by order_test.php--------------------------
$filename = 'createOrderId.php';
$handle = fopen($filename, "r");
$order_id = fread($handle, filesize($filename));
fclose($handle);
$netOrder = $order_id + 1;
file_put_contents($filename, $netOrder);
//orderid = orderid + 1 in order_test.php
//---------------get order by order_test.php--------------------------
$reference = "comprame_test_" . $order_id;
$parameters = array(PayUParameters::ACCOUNT_ID => "500538", PayUParameters::REFERENCE_CODE => $reference, PayUParameters::DESCRIPTION => $reference, PayUParameters::VALUE => "20000", PayUParameters::CURRENCY => "COP", PayUParameters::BUYER_STREET => "calle 100", PayUParameters::BUYER_STREET_2 => "5555487", PayUParameters::BUYER_CITY => "Medellin", PayUParameters::BUYER_STATE => "Antioquia", PayUParameters::BUYER_COUNTRY => "CO", PayUParameters::BUYER_PHONE => "7563126", PayUParameters::BUYER_EMAIL => "*****@*****.**", PayUParameters::PAYER_NAME => "11111111111111111", PayUParameters::PAYER_DNI => "5415668464654", PayUParameters::PAYMENT_METHOD => PaymentMethods::BANK_REFERENCED, PayUParameters::COUNTRY => PayUCountries::CO, PayUParameters::EXPIRATION_DATE => date("Y-m-d\\TH:i:s", strtotime("+7 days")), PayUParameters::IP_ADDRESS => "127.0.0.1", PayUParameters::PAYER_COOKIE => "pt1t38347bs6jc9ruv2ecpv7o2", PayUParameters::USER_AGENT => "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0");
$response = PayUPayments::doAuthorizationAndCapture($parameters);
if ($response) {
    echo "orderId:" . $response->transactionResponse->orderId . "<br>";
    echo "transactionId:" . $response->transactionResponse->transactionId . "<br>";
Ejemplo n.º 3
0
 private function orderVerify($value)
 {
     $response = new stdClass();
     if (empty($value)) {
         $response->status = "Empty Value";
         $response->status_code = 201;
     } else {
         $response->status_code = 202;
     }
     require_once 'plugin/payu_sdk/PayU.php';
     Environment::setPaymentsCustomUrl("https://api.payulatam.com/payments-api/4.0/service.cgi");
     Environment::setReportsCustomUrl("https://api.payulatam.com/reports-api/4.0/service.cgi");
     Environment::setSubscriptionsCustomUrl("https://api.payulatam.com/payments-api/rest/v4.3/");
     $commerce = $this->getDataCommerce();
     PayU::$apiKey = $commerce->data['APIKEY'];
     // apiKey.
     PayU::$apiLogin = $commerce->data['APILOGIN'];
     // apiLogin.
     PayU::$merchantId = $commerce->data['MERCHANTID'];
     // Id de Comercio.
     PayU::$language = SupportedLanguages::ES;
     //Seleccione el idioma.
     PayU::$isTest = true;
     //Dejarlo True cuando sean pruebas.
     $transaction = new stdClass();
     // Código de referencia de la orden.
     $parameters = array(PayUParameters::REFERENCE_CODE => $value);
     $response_payu = PayUReports::getOrderDetailByReferenceCode($parameters);
     foreach ($response_payu as $order) {
         $order->accountId;
         $order->status;
         $order->referenceCode;
         $order->additionalValues->TX_VALUE->value;
         $order->additionalValues->TX_TAX->value;
         if ($order->buyer) {
             $order->buyer->emailAddress;
             $order->buyer->fullName;
         }
         $transactions = $order->transactions;
         foreach ($transactions as $transaction) {
             $transaction->type;
             $transaction->transactionResponse->state;
             $transaction->transactionResponse->paymentNetworkResponseCode;
             $transaction->transactionResponse->trazabilityCode;
             $transaction->transactionResponse->responseCode;
             if ($transaction->payer) {
                 $transaction->payer->fullName;
                 $transaction->payer->emailAddress;
             }
         }
     }
     $result = $this->updateDataCommerceByReference($value, $transaction);
     $response->answer = $transaction;
     $response->status_code = 200;
     $response->status = $result->status;
     return $response;
 }