eventsquare / payconiq
Payconiq API client for PHP
This package is auto-updated.
Last update: 2024-10-28 21:51:04 UTC
README
Payconiq API client for PHP
Accepting Payconiq payments with the use of the QR code.
Requirements
To use the Payconiq API client, the following things are required:
- Payconiq Merchant Id and Access Token
- PHP >= 5.6
- PHP cURL extension
Installation
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.
Parameters
We use the following parameters in the examples below:
$merchant_id = ''; // The merchant ID registered with Payconiq. $access_token = ''; // 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.
Usage
Create a transaction
use Payconiq\Client; $payconiq = new Client($merchant_id, $access_token); // Create a new transaction $transaction_id = $payconiq->createTransaction($amount, $currency, $callbackUrl); // Assemble QR code content $qrcode = 'https://payconiq.com/pay/1/' . $transaction_id;
Retrieve a transaction
use Payconiq\Client; $payconiq = new Client($merchant_id, $access_token); // Retrieve a transaction $transaction = $payconiq->retrieveTransaction($transaction_id);
Laravel support
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
Create a transaction
use Payconiq; // Create a new transaction $transaction_id = Payconiq::createTransaction($amount, $currency, $callbackUrl); // Assemble QR code content $qrcode = 'https://payconiq.com/pay/1/' . $transaction_id;
Retrieve a transaction
use Payconiq; // Retrieve a transaction $transaction = Payconiq::retrieveTransaction($transaction_id);