PHPackages                             liedekef/payconiq-api-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. liedekef/payconiq-api-php

ActiveLibrary[API Development](/categories/api)

liedekef/payconiq-api-php
=========================

Payconiq API client for PHP

v4.1.2(3mo ago)0201PHPPHP &gt;=5.6

Since Jun 29Pushed 3mo agoCompare

[ Source](https://github.com/liedekef/payconiq-api-php)[ Packagist](https://packagist.org/packages/liedekef/payconiq-api-php)[ RSS](/packages/liedekef-payconiq-api-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)DependenciesVersions (19)Used By (0)

Payconiq API client for PHP
===========================

[](#payconiq-api-client-for-php)

Accepting [Payconiq](https://www.payconiq.be/) payments with the use of the QR code.
API documentation can be found [here](https://docs.payconiq.be/apis/merchant-payment.openapi).

Requirements
------------

[](#requirements)

To use the Payconiq API client, the following things are required:

- Payconiq Merchant Id and API key
- PHP &gt;= 8.3
- PHP cURL extension

Installation
------------

[](#installation)

The best way to install the Payconiq API client is to require it with [Composer](http://getcomposer.org/doc/00-intro.md).

```
$ composer require liedekef/payconiq-api-php

```

You may also git checkout or [download all the files](https://github.com/EventSquare/payconiq-api-php/archive/master.zip), and include the Payconiq API client manually.

Parameters
----------

[](#parameters)

We use the following parameters in the examples below:

```
$apiKey = 'apiKey 123456'; // Used to secure request between merchant backend and Payconiq backend.
$merchantId = 'merchantid'; // payconiq merchantid (not really used, unless to verify more in notification callback)
$amount = 1000; // Transaction amount in cents
$currency = 'EUR'; // Currency
$reference = "my internal payment reference"; // an internal reference (e.g. a booking id)
      // the reference is given in the callback, allowing you to know what local payment is being handled
$callbackUrl = 'http://yoursite.com/postback'; // Callback where Payconiq needs to POST confirmation status
$returnUrl = 'http://yoursite.com/returnpage'; // Optional. the page a buyer is returned to after payment. You'll need to check
     // the payment status there
```

To learn more about how, when and what Payconiq will POST to your callbackUrl, please refer to the developer documentation [right here](https://dev.payconiq.com/online-payments-dock).

Installation
------------

[](#installation-1)

```
// Include the Client.php file
require_once '/path/to/Payconiq/Client.php';

use Payconiq\Client;
```

Initialization
--------------

[](#initialization)

### Basic Setup

[](#basic-setup)

```
// Production environment (default)
$client = new Client('your-api-key-here');

// Test environment
$client = new Client('your-test-api-key', Client::ENVIRONMENT_TEST);

// Or configure after instantiation
$client = new Client();
$client->setApiKey('your-api-key-here')
       ->setEndpointTest(); // Switch to test environment
```

### Custom Endpoints

[](#custom-endpoints)

```
$client->setEndpoints(
    'https://custom.api.endpoint/v3',
    'https://custom.jwks.endpoint/'
);
```

Core Methods
------------

[](#core-methods)

### 1. Create a Payment

[](#1-create-a-payment)

```
/**
 * @param float $amount Payment amount in cents (e.g., 1000 = €10.00)
 * @param string $currency Currency code (default: 'EUR')
 * @param string $description Payment description (optional, max 140 chars)
 * @param string $reference External reference (optional, max 35 chars)
 * @param string $bulkId Bulk ID for payouts (optional)
 * @param string $callbackUrl Webhook callback URL (optional)
 * @param string $returnUrl Return URL after payment (optional)
 * @return object Payment object with paymentId
 * @throws CreatePaymentFailedException
 */
$payment = $client->createPayment(
    1000,                   // €10.00
    'EUR',                  // Currency
    'Order #12345',         // Description
    'REF-12345',            // Your reference
    '',                     // Bulk ID
    'https://your-site.com/webhook',
    'https://your-site.com/return'
);

// Response contains:
// - $payment->paymentId
// - $payment->_links->checkout->href (payment URL for customer)
```

### 2. Retrieve Payment Details

[](#2-retrieve-payment-details)

```
/**
 * @param string $paymentId Payconiq payment ID
 * @return object Payment details
 * @throws RetrievePaymentFailedException
 */
$payment = $client->retrievePayment('PAYMENT_ID_HERE');

// Response contains:
// - $payment->paymentId
// - $payment->amount
// - $payment->currency
// - $payment->status (e.g., 'SUCCEEDED', 'PENDING')
// - $payment->_links->refund->href (if refundable)
```

### 3. Get Payment(s) by Reference

[](#3-get-payments-by-reference)

```
/**
 * @param string $reference Your external reference
 * @param string $fromDate Start date (format: YYYY-MM-ddTHH:mm:ss.SSSZ, default: yesterday)
 * @param string $toDate End date (format: YYYY-MM-ddTHH:mm:ss.SSSZ, default: now)
 * @return array List of successful payments with matching reference
 * @throws GetPaymentsListFailedException
 */
$payments = $client->getPaymentsListByReference('REF-12345');

// Returns array of payment objects
```

To immediately get the payment with the matching reference (since normally there's only one):

```
/**
 * @param string $reference Your external reference
 * @param string $fromDate Start date (format: YYYY-MM-ddTHH:mm:ss.SSSZ, default: yesterday)
 * @param string $toDate End date (format: YYYY-MM-ddTHH:mm:ss.SSSZ, default: now)
 * @return object Successful payment with matching reference
 * @throws GetPaymentsListFailedException
 */
$payments = $client->getPaymentByReference('REF-12345');
```

### 4. Get Payments by Date Range

[](#4-get-payments-by-date-range)

```
/**
 * @param string $fromDate Start date (format: YYYY-MM-ddTHH:mm:ss.SSSZ, default: yesterday)
 * @param string $toDate End date (format: YYYY-MM-ddTHH:mm:ss.SSSZ, default: now)
 * @param int $size Page size (default: 50)
 * @return array List of successful payments in date range
 * @throws GetPaymentsListFailedException
 */
$payments = $client->getPaymentsListByDateRange(
    '2024-01-01T00:00:00.000Z',
    '2024-01-31T23:59:59.999Z',
    100
);
```

### 5. Refund a Payment

[](#5-refund-a-payment)

```
/**
 * @param string $paymentId Payconiq payment ID
 * @param float $amount Refund amount in cents
 * @param string $currency Currency (default: 'EUR')
 * @param string $description Refund description (optional)
 * @param string $idempotencyKey Optional idempotency key (UUIDv4)
 * @param string $refundUrl Optional custom refund URL
 * @return object Refund response
 * @throws RefundFailedException
 */
$refund = $client->refundPayment(
    'PAYMENT_ID_HERE',
    500,                    // Refund €5.00
    'EUR',
    'Partial refund for order #12345',
    null,                   // Auto-generated UUID if null
    null                    // Auto-detected from payment
);
```

### 6. Get Refund IBAN

[](#6-get-refund-iban)

```
/**
 * @param string $paymentId Payconiq payment ID
 * @return string IBAN for refunds
 * @throws GetRefundIbanFailedException
 */
$iban = $client->getRefundIban('PAYMENT_ID_HERE');
```

Webhook Signature Verification
------------------------------

[](#webhook-signature-verification)

### 1. Verify Webhook Signature

[](#1-verify-webhook-signature)

```
/**
 * @param string $payload Raw request body (php://input)
 * @param array $headers HTTP headers (getallheaders())
 * @return bool True if signature is valid
 * @throws \Exception on verification failure
 */
$isValid = $client->verifyWebhookSignature(
    file_get_contents('php://input'),
    getallheaders()
);

if ($isValid) {
    // Process webhook
    $data = json_decode(file_get_contents('php://input'), true);
    // Handle payment events
}
```

### 2. Webhook Handling Example

[](#2-webhook-handling-example)

```
// Complete webhook handler example
try {
    $payload = file_get_contents('php://input');
    $headers = getallheaders();

    if ($client->verifyWebhookSignature($payload, $headers)) {
        $data = json_decode($payload, true);

        switch ($data['status']) {
            case 'SUCCEEDED':
                // Update order as paid
                break;
            case 'FAILED':
                // Handle failed payment
                break;
            case 'REFUNDED':
                // Handle refund
                break;
        }

        http_response_code(200);
        echo 'OK';
    } else {
        http_response_code(401);
        echo 'Invalid signature';
    }
} catch (\Exception $e) {
    error_log('Webhook error: ' . $e->getMessage());
    http_response_code(400);
}
```

Error Handling
--------------

[](#error-handling)

### Exception Types

[](#exception-types)

- `CreatePaymentFailedException`
- `RetrievePaymentFailedException`
- `GetPaymentsListFailedException`
- `RefundFailedException`
- `GetRefundIbanFailedException`

### Exception Example

[](#exception-example)

```
try {
    $payment = $client->createPayment(1000, 'EUR');
} catch (CreatePaymentFailedException $e) {
    echo 'Payment creation failed: ' . $e->getMessage();
} catch (\Exception $e) {
    echo 'General error: ' . $e->getMessage();
}
```

Common Error Responses
----------------------

[](#common-error-responses)

```
// Check response for details
$response = $client->createPayment(1000, 'EUR');
if (isset($response->message)) {
    // API returned an error message
    echo 'Error: ' . $response->message;
}
```

Utility Methods
---------------

[](#utility-methods)

### Get Environment

[](#get-environment)

```
$environment = $client->getEnvironment(); // 'prod' or 'test'
```

### Set Cache Directory for JWKS Keys

[](#set-cache-directory-for-jwks-keys)

```
// If not set, the system tmp dir is used
$client->setCacheDir('/my/own/dir');
```

SEPA String Conversion
----------------------

[](#sepa-string-conversion)

All strings (descriptions, references) are automatically converted to SEPA-compliant format:

- Removes diacritics/accents
- Filters to allowed characters only
- Truncates to maximum lengths

Best Practices
--------------

[](#best-practices)

### 1. Idempotency for Refunds

[](#1-idempotency-for-refunds)

```
// Always use idempotency keys for refunds
$idempotencyKey = 'unique-refund-key-' . time();
$client->refundPayment($paymentId, $amount, 'EUR', '', $idempotencyKey);
```

### 2. Webhook Security

[](#2-webhook-security)

- Always verify webhook signatures
- Never process unverified webhooks
- Implement replay attack protection

### 3. Cache Management

[](#3-cache-management)

- JWKS keys are cached automatically
- Cache is refreshed on verification failures
- Cache refresh is done in a way to avoid hitting the jwks-servers too hard
- Cache directory can be set via method

---

**Note:** This client automatically handles SEPA compliance, JWKS caching, and signature verification according to Payconiq specifications.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance80

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 97.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~184 days

Recently: every ~7 days

Total

18

Last Release

108d ago

Major Versions

1.0.2 → 2.0.02019-11-28

2.0.1 → v3.0.02024-07-09

v3.0.0 → v4.0.02025-05-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/55534ed3ce6e8863ed7027455cfa940dfcc84e1c35c1e6996b1ef1dbae0b7945?d=identicon)[liedekef](/maintainers/liedekef)

---

Top Contributors

[![liedekef](https://avatars.githubusercontent.com/u/75667?v=4)](https://github.com/liedekef "liedekef (74 commits)")[![GlennEngelen](https://avatars.githubusercontent.com/u/7737619?v=4)](https://github.com/GlennEngelen "GlennEngelen (2 commits)")

### Embed Badge

![Health badge](/badges/liedekef-payconiq-api-php/health.svg)

```
[![Health](https://phpackages.com/badges/liedekef-payconiq-api-php/health.svg)](https://phpackages.com/packages/liedekef-payconiq-api-php)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
