Ejemplo n.º 1
0
 *
 * 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 Card Token to the Request
 */
$request->setCardToken($cardToken);
/**
 * Create new API Client, passing the Config object as parameter
 */
$client = new Client($cfg);
/**
 * Will throw different Exceptions on errors
 */
try {
    /**
     * Sends the Request to ALU and returns a Response
     *
     * See documentation for Response params
     */
    $response = $client->pay($request);
    /**
     * In case of 3DS enrolled cards, PayU will return the URL_3DS that contains a unique url for each
     * transaction. The merchant must redirect the browser to this url to allow user to authenticate.
     * After the authentication process ends the user will be redirected to BACK_REF url
     * with payment result in a HTTP POST request
Ejemplo n.º 2
0
use PayU\Alu\Client;
use PayU\Alu\MerchantConfig;
use PayU\Alu\Exceptions\ConnectionException;
use PayU\Alu\Exceptions\ClientException;
/**
 * Create configuration with params:
 *
 * Merchant Code - Your PayU Merchant Code
 * Secret Key - Your PayU Secret Key
 * Platform - RO | RU | UA | TR | HU
 */
$cfg = new MerchantConfig('MERCHANT_CODE', 'SECRET_KEY', 'RO');
/**
 * Create new API Client, passing the Config object as parameter
 */
$client = new Client($cfg);
/**
 * Will throw different Exceptions on errors
 */
try {
    /**
     * Gets the Three DS return response and interprets its
     *
     * See documentation for Response params
     */
    $threeDSResponse = $client->handleThreeDSReturnResponse($_POST);
    if ($threeDSResponse->getStatus() == 'SUCCESS') {
        echo $threeDSResponse->getReturnMessage();
        die('Success. PAYU RefNo =' . $threeDSResponse->getRefno());
    } else {
        echo $threeDSResponse->getReturnMessage();