PHP code example of behzadbabaei / omnipay-revolut

1. Go to this page and download the library: Download behzadbabaei/omnipay-revolut library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

behzadbabaei / omnipay-revolut example snippets


    use Omnipay\Omnipay;


    $gateway = Omnipay::create('Revolut');
    $gateway->setAccessToken('Access-Token');
    $gateway->setLanguage('EN'); // Language
    $gateway->setAccountId('Merchant-Accounti-Id');
    $gateway->setAmount(31.90); // Amount to charge
    $gateway->setTransactionId(XXXX); // Transaction ID from your system



         $purchase = $gateway->purchase();
         $purchase->setAmount(12.12);
         $purchase->setCurrency("USD");
         $purchase->setCaptureMode('AUTOMATIC');
         $purchase->setMerchantOrderReference('123121');
         $purchase->setEmail('[email protected]');
         $purchase->setDescription('order test');
         $purchase->setSettlementCurrency('GBP');
         $purchase->setCustomerId(1212);
         $result = $purchase->send()->getData();



         $result1 = $gateway->purchase([
              'amount'      => 12.12,
              'currency'    => 'USD',
              'captureMode' => 'AUTOMATIC',
              'merchantOrderReference' => 123121,
              'email' => '[email protected]',
              'description' => 'order test',
              'settlementCurrency' => 'GBP',
              'customerId' => 1212,
         ])->send()->getData();



        $capture = $gateway->capture();
        $capture->setAmount(31.90);
        $capture->setOrderId(1);
        $result = $capture->send()->getData();



       $result = $gateway->capture([
            'amount'  => 31.90,
            'orderId' => 1
        ])->send()->getData();



        $complete = $gateway->completePurchase();
        $complete->setAmount(31.90);
        $complete->setOrderId(1);
        $complete->setPaymentMethod(12121);
        $result1 = $complete->send()->getData();



        $result = $gateway->completePurchase([
            'orderId'       => 1,
            'paymentMethod' => 1
        ])->send()->getData();



        $refund = $gateway->refund();
        $refund->setAmount(31.90);
        $refund->setCurrency('USD');
        $refund->setOrderId(1);
        $refund->setMerchantOrderReference(1);
        $refund->setDescription("Test Description");
        $result1 = $refund->send()->getData();



         $result = $gateway->refund([
            'amount'                 => 31.90,
            'currency'               => 'USD',
            'orderId'                => 1,
            'merchantOrderReference' => 1000,
            'description'            => 'Test Description',
        ])->send()->getData();



        $cancel = $gateway->cancel();
        $cancel->setOrderId(1);
        $result1 = $cancel->send()->getData();



       $result = $gateway->cancel([
            'orderId'                => 1,
        ])->send()->getData();



        $fetch = $gateway->fetchTransaction();
        $fetch->setOrderId(1);
        $result1 = $fetch->send()->getData();



        $result = $gateway->fetchTransaction([
            'orderId'                => 1,
        ])->send()->getData();