prgTW
9/22/2015 - 12:32 PM

tr-payu-alu-error

tr-payu-alu-error

<?xml version="1.0"?>
<EPAYMENT>
  <REFNO>8063391</REFNO>
  <ALIAS></ALIAS>
  <STATUS>FAILED</STATUS>
  <RETURN_CODE>GWERROR_05</RETURN_CODE>
  <RETURN_MESSAGE>Authorization declined</RETURN_MESSAGE>
  <DATE>2015-09-22 15:32:29</DATE>
  <AMOUNT>300</AMOUNT>
  <CURRENCY>TRY</CURRENCY>
  <INSTALLMENTS_NO>1</INSTALLMENTS_NO>
  <CARD_PROGRAM_NAME>PARAF</CARD_PROGRAM_NAME>
  <ORDER_REF>56014a588a5f5</ORDER_REF>
  <AUTH_CODE></AUTH_CODE>
  <RRN>526515030748</RRN>
  <ERRORMESSAGE>Gecersiz Transaction.</ERRORMESSAGE>
  <PROCRETURNCODE>12</PROCRETURNCODE>
  <PAN>4111-xxxx-xxxx-1111</PAN>
  <EXPYEAR>16</EXPYEAR>
  <EXPMONTH>12</EXPMONTH>
  <CLIENTID>500100000</CLIENTID>
  <HOSTREFNUM>526515030748</HOSTREFNUM>
  <OID>8063391</OID>
  <RESPONSE>Declined</RESPONSE>
  <TRANSID>15265PgcH16862</TRANSID>
  <HASH>69c77b1ca096d10d218ac2d106c71590</HASH>
</EPAYMENT>
<?php

$cfg = new MerchantConfig('OPU_TEST', 'SECRET_KEY', 'TR');

/**
 * Create user with params:
 *
 * User IP - User's IP address
 * Card Number Input Time - Time it took the user to enter credit card number in seconds
 * User Time  - Time of user computer - optional
 *
 */
$user = new User('127.0.0.1');

/**
 * Create new order
 */
$order = new Order();

/**
 * Setup the order params
 *
 * Full params available in the documentation
 */
$order->withBackRef('http://path/to/your/returnUrlScript')
		->withOrderRef(uniqid())
		->withCurrency('TRY')
		->withOrderDate(gmdate('Y-m-d H:i:s'))
		->withOrderTimeout(1000)
		->withPayMethod('CCVISAMC');

/**
 * Create new product
 */
$product = new Product();

/**
 * Setup the product params
 *
 * Full params available in the documentation
 */
$product->withCode('PCODE01')
		->withName('PNAME01')
		->withPrice(100.0)
		->withVAT(24.0)
		->withQuantity(1);

/**
 * Add the product to the order
 */
$order->addProduct($product);

/**
 * Create another product
 */
$product = new Product();

/**
 * Setup the product params
 *
 * Full params available in the documentation
 */
$product->withCode('PCODE02')
		->withName('PNAME02')
		->withPrice(200.0)
		->withVAT(24.0)
		->withQuantity(1);

/**
 * Add the second product to the same order
 */
$order->addProduct($product);

/**
 * Create new billing address
 */
$billing = new Billing();

/**
 * Setup the billing address params
 *
 * Full params available in the documentation
 */
$billing->withAddressLine1('Address1')
		->withAddressLine2('Address2')
		->withCity('City')
		->withCountryCode('TR')
		->withEmail('john.doe@mail.com')
		->withFirstName('FirstName')
		->withLastName('LastName')
		->withPhoneNumber('40123456789')
		->withIdentityCardNumber('111222');

/**
 * Create new delivery address
 *
 * If you want to have the same delivery as billing, skip these two steps
 * and pass the Billing $billing object to the request twice
 */
$delivery = new Delivery();

/**
 * Setup the delivery address params
 *
 * Full params available in the documentation
 */
$delivery->withAddressLine1('Address1')
		->withAddressLine2('Address2')
		->withCity('City')
		->withCountryCode('TR')
		->withEmail('john.doe@mail.com')
		->withFirstName('FirstName')
		->withLastName('LastName')
		->withPhoneNumber('40123456789');

/**
 * Create new Card with params:
 *
 * Credit Card Number
 * Credit Card Expiration Month
 * Credit Card Expiration Year
 * Credit Card CVV (Security Code)
 * Credit Card Owner
 */
$card = new Card('4111111111111111', '12', 2016, 123, 'Card Owner Name');

/**
 * Create new Request with params:
 *
 * Config object
 * Order object
 * Billing object
 * Delivery (or Billing object again, if you want to have the delivery address the same as the billing address)
 * User object
 */
$request = new Request($cfg, $order, $billing, $delivery, $user);

/**
 * Add the Credit Card to the Request
 */
$request->setCard($card);

/**
 * Create new API Client, passing the Config object as parameter
 */
$client = new Client($cfg);

/**
 * Sends the Request to ALU and returns a Response
 *
 * See documentation for Response params
 */
$response = $client->pay($request);