Skip to content
This repository has been archived by the owner on Jan 4, 2020. It is now read-only.

Payment with Banking Billet

Samuel Fontebasso edited this page Oct 8, 2017 · 1 revision

Create Transaction

$gateway = Omnipay::create("Gerencianet");
$gateway->initialize(array(
    'clientId' => '{YOUR-CLIENT-ID}',
    'secret' => '{YOUR-SECRET}',
    'testMode' => true
));

$options = array(
    'items' => array(
        array(
            'name' => 'Item 1',
            'quantity' => 1,
            'price' => 10
        ),
        array(
            'name' => 'Item 2',
            'quantity' => 2,
            'price' => 20
        ),
    ),
);

$response = $gateway->authorize($options)->send();
$charge_id = $response->getTransactionReference();

Payment with Banking Billet

$customer = array(
    'name' => 'Gorbadoc Oldbuck',
    'cpf' => '94271564656',
    'phone_number' => '5144916523',
);

$paymentMethod = new \Omnipay\Gerencianet\Item\BankingBillet(
    array(
        'customer' => $customer,
        'expire_at' => '2018-12-12',
        'message' => 'Testing...',
        'discount_type' => \Omnipay\Gerencianet\Item\PaymentMethod::DISCOUNT_TYPE_PERCENTAGE,
        'discount_value' => 10,
        'configuration_fine' => 2,
        'configuration_interest' => 0.02,
    )
);

$response = $gateway->completeAuthorize(array(
    'transaction_reference' => $charge_id,
    'payment' => $paymentMethod
))->send();
Clone this wiki locally