PHP code example of k3rnel / omnipay-arca

1. Go to this page and download the library: Download k3rnel/omnipay-arca 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/ */

    

k3rnel / omnipay-arca example snippets


    use Omnipay\Omnipay;


    $gateway = Omnipay::create('Arca');
    $gateway->setUsername(env('ARCA_USERNAME'));
    $gateway->setPassword(env('ARCA_PASSWORD'));
    $gateway->setReturnUrl(env('ARCA_RETURN_URL')); // Return url, that should be point to your arca webhook route
    $gateway->setLanguage(\App::getLocale()); // Language
    $gateway->setAmount(10); // Amount to charge
    $gateway->setTransactionId(XXXX); // Transaction ID from your system



    $purchase = $gateway->purchase()->send();
    $purchase->redirect();



    $gateway = Omnipay::create('Arca');
    $gateway->setUsername(env('ARCA_USERNAME'));
    $gateway->setPassword(env('ARCA_PASSWORD'));
    
    $purchase = $gateway->completePurchase()->send();
    
    // Do the rest with $purchase and response with 'OK'
    if ($purchase->isSuccessful()) {
        
        // Your logic
        
    }
    
    return new Response('OK');