Skip to content

ampeco/omnipay-bankart

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
api
 
 
src
 
 
 
 
 
 
 
 

omnipay-bankart

Omnipay plugin for bankart

Installation

composer require ampeco/omnipay-bankart

Getting started

Create the gateway

$gateway = Omnipay::create('\Ampeco\OmnipayBankart\Gateway');
$gateway->initialize([
    'username'           => 'Your API username',
    'password'           => 'Your API password',
    'apiKey'             => 'Your API key',
    'sharedSecret'       => 'Your API shared secret',
]);

Add a new credit card

$response = $gateway->createCard([
        'transaction_id' => uniqid('', true),
        'description' => 'Description',
        'return_url' => 'https://your-return-url',
        'notify_url' => 'https://your-notify-url',
        'customer' => [
            'first_name' => 'John',
            'last_name' => 'Doe',
            'identification' => 1,
            'email' => 'john@example.com',
            'billingAddress1' => 'None',
            'billingCity' => 'Unknown',
            'billingCountry' => 'NA',
            'billingPostcode' => '0000',
        ]
])->send();

if (!$response->isSuccessful()) {
    abort(422, $response->getMessage());
}

// You must redirect the client to:
echo $response->getRedirectUrl();
echo $response->getTransactionReference(); // The transaction ID assigned by the bank

Check if the client completed the card registration

$transactionReference = '1234567890'; // Fetched from above - $response->getTransactionReference()

$result = $gateway->fetchTransaction([
    'transactionReference' => $transactionReference,
])->send();

if (!$result->isSuccessful()){
    abort(422, $result->getMessage());
}

Charge the saved credit card reference

$transactionReference = '1234567890'; // saved from above - $transactionReference;
$response = $gateway->purchase([
    'cardReference'     => $transactionReference,
    'amount'            => 3,
    'currency'          => 'EUR',
    'description'       => 'Purchase #1234',
])->send();

if ($response->isSuccessful()) {
    echo $response->getTransactionReference();
    
} else {
    abort(422, $response->getMessage());
}

About

Bankart Omnipay Plugin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages