descubraomundo / omnipay-pagarme

Pagar.Me driver for the Omnipay PHP payment processing library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is this package already v3 compatible?

bennyspindl opened this issue · comments

Hi guys, can I use Omnipay V3 interface ( like bellow ) with the v3.1 tagged code? That isn't clear to me.

<?php

use Omnipay\Omnipay;

// Setup payment gateway
$gateway = Omnipay::create('Stripe');
$gateway->setApiKey('abc123');

// Example form data
$formData = [
    'number' => '4242424242424242',
    'expiryMonth' => '6',
    'expiryYear' => '2016',
    'cvv' => '123'
];

// Send purchase request
$response = $gateway->purchase(
    [
        'amount' => '10.00',
        'currency' => 'USD',
        'card' => $formData
    ]
)->send();

// Process response
if ($response->isSuccessful()) {
    
    // Payment was successful
    print_r($response);

} elseif ($response->isRedirect()) {
    
    // Redirect to offsite payment gateway
    $response->redirect();

} else {

    // Payment failed
    echo $response->getMessage();
}