Accepting Payconiq payments with the use of the QR code.
To use the Payconiq API client, the following things are required:
- Payconiq Merchant Id and API key
- PHP >= 5.6
- PHP cURL extension
The best way to install the Payconiq API client is to require it with Composer.
$ composer require eventsquare/payconiq
You may also git checkout or download all the files, and include the Payconiq API client manually.
We use the following parameters in the examples below:
$merchantId = 'abc'; // The merchant ID registered with Payconiq.
$apiKey = 'apiKey 123456'; // Used to secure request between merchant backend and Payconiq backend.
$amount = 1000; // Transaction amount in cents
$currency = 'EUR'; // Currency
$callbackUrl = 'http://yoursite.com/postback'; // Callback where Payconiq needs to POST confirmation status
To learn more about how, when and what Payconiq will POST to your callbackUrl, please refer to the developer documentation right here.
use Payconiq\Client;
$payconiq = new Client($merchantId, $apiKey);
// Create a new payment
$payment = $payconiq->createPayment($amount, $currency, $reference, $callbackUrl);
// Assemble QR code content
$qrcode = $payment->_links->qrcode->href;
use Payconiq\Client;
$payconiq = new Client($merchantId, $accessToken);
// Retrieve a payment
$payment = $payconiq->retrievePayment($paymentId);
We have provided a service provider to use this class with Laravel > 5.1.
Add the following line to the Framework Service Providers in config/app.php
Payconiq\Support\Laravel\PayconiqServiceProvider::class,
Add the following entry to the aliases
'Payconiq' => Payconiq\Support\Laravel\PayconiqFacade::class,
Publish the Payconiq config file with the artisan command and fill in your credentials in the config/payconiq.php config file.
php artisan vendor:publish
use Payconiq;
// Create a new payment
$payment = Payconiq::createPayment($amount, $currency, $reference, $callbackUrl);
// Assemble QR code content
$qrcode = $payment->_links->qrcode->href;
use Payconiq;
// Retrieve a payment
$payment = Payconiq::retrievePayment($payment);