PHPackages                             twikey/twikey-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. twikey/twikey-api-php

ActiveLibrary[API Development](/categories/api)

twikey/twikey-api-php
=====================

Php client to interface with the Twikey api

v0.6.0(2y ago)5130.8k↓12.2%10[1 issues](https://github.com/twikey/twikey-api-php/issues)[1 PRs](https://github.com/twikey/twikey-api-php/pulls)MITPHPPHP ^7.4 || ^8.0CI failing

Since Jul 5Pushed 3mo ago2 watchersCompare

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

READMEChangelogDependencies (3)Versions (12)Used By (0)

 [![](https://camo.githubusercontent.com/1f108040d1c157fee709f70b84ca6250e5f562b3f8b3eeb45bb9b2786410f3a2/68747470733a2f2f63646e2e7477696b65792e636f6d2f696d672f6c6f676f2e706e67)](https://camo.githubusercontent.com/1f108040d1c157fee709f70b84ca6250e5f562b3f8b3eeb45bb9b2786410f3a2/68747470733a2f2f63646e2e7477696b65792e636f6d2f696d672f6c6f676f2e706e67)

Twikey API client for PHP
=========================

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

Want to allow your customers to pay in the most convenient way, then Twikey is right what you need.

Recurring or occasional payments via (Recurring) Credit Card, SEPA Direct Debit or any other payment method by bringing your own payment service provider or by leveraging your bank contract.

Twikey offers a simple and safe multichannel solution to negotiate and collect recurring (or even occasional) payments. Twikey has integrations with a lot of accounting and CRM packages. It is the first and only provider to operate on a European level for Direct Debit and can work directly with all major Belgian and Dutch Banks. However you can use the payment options of your favorite PSP to allow other customers to pay as well.

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

[](#requirements)

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

- Get yourself a [Twikey account](https://www.twikey.com).
- PHP &gt;= 5.6
- Up-to-date OpenSSL (or other SSL/TLS toolkit)

Composer Installation
---------------------

[](#composer-installation)

By far the easiest way to install the Twikey API client is to require it with [Composer](http://getcomposer.org/doc/00-intro.md).

```
$ composer require twikey/twikey-api-php

```

How to create anything
----------------------

[](#how-to-create-anything)

The api works the same way regardless if you want to create a mandate, a transaction, an invoice or even a paylink. the following steps should be implemented:

1. Use the Twikey API client to create or import your item.
2. Once available, our platform will send an asynchronous request to the configured webhook to allow the details to be retrieved. As there may be multiple items ready for you a "feed" endpoint is provided which acts like a queue that can be read until empty till the next time.
3. The customer returns, and should be satisfied to see that the action he took is completed.

Find our full documentation online on [api.twikey.com](https://api.twikey.com).

Getting started
---------------

[](#getting-started)

Initializing the Twikey API client using your preferred Http client (eg. [guzzle](https://docs.guzzlephp.org/en/stable/)) and configure your API key which you can find in the [Twikey merchant interface](https://www.twikey.com).

```
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use Twikey\Api;

$httpClient = new Client([
    'http_errors' => false,
    'debug' => false
]);

$twikey = new Twikey($httpClient,$APIKEY);
```

Documents
---------

[](#documents)

Invite a customer to sign a SEPA mandate using a specific behaviour template (ct) that allows you to configure the behaviour or flow that the customer will experience.

```
$invite = $twikey->document->create([
    "ct" => $ct
    "email" => "john@doe.com",
    "firstname" => "John",
    "lastname" => "Doe",
]);
```

*After creation, the link is available for signing and ideally you store the mandatenumber for future usage (eg. sending transactions).*

```
// store $invite->mndtId for this customer
header("Location: " . $invite->url);
```

### Query Mandates

[](#query-mandates)

Query mandates with various search parameters to find specific mandates.

```
// Query all mandates
$mandates = $twikey->document->query();

// Query mandates with specific parameters
$mandates = $twikey->document->query([
    'email' => 'john@doe.com',
    'state' => 'SIGNED',
    'customerNumber' => 'CUST123'
]);
```

### Feed

[](#feed)

```
$twikey->document->feed(new class implements DocumentCallback {
   function handleNew($update)
   {
       print("New " . $update->Mndt->MndtId . ' @ '. $update->EvtTime . "\n");
   }

   function handleUpdate($update)
   {
       $rsn = $update->AmdmntRsn->Rsn;
       print("Update: " . $update->Mndt->MndtId . ' -> '. $rsn . ' @ '. $update->EvtTime . "\n");
   }

   function handleCancel($update)
   {
       $rsn = $update->CxlRsn->Rsn;
       print("Cancel: " . $update->OrgnlMndtId . ' -> '. $rsn . ' @ '. $update->EvtTime . "\n");
   }
}
);
```

Transactions
------------

[](#transactions)

Send new transactions and act upon feedback from the bank.

```
$invite = $twikey->transaction->create([
   "mndtId" => "CORERECURRENTNL16318",
   "message" => "Test Message",
   "ref" => "Merchant Reference",
   "amount" => 10.00, // 10 euro
   "place" => "Here"
]);
```

### Feed

[](#feed-1)

```
$count = $twikey->transaction->feed(new class implements TransactionCallback{
   public function handle($transaction)
   {
       print("Transaction " . $transaction->id . ' @ '. $transaction->date . ' has '. $transaction->state . "\n");
   }
});
```

Webhook
-------

[](#webhook)

When wants to inform you about new updates about documents or payments a `webhookUrl` specified in your api settings be called.

```
$queryString = decode($_SERVER['QUERY_STRING']);
$signatureHeader = $_SERVER['HTTP_X_SIGNATURE'];

Twikey::validateWebhook($APIKEY, "abc=123&name=abc", $queryString, $signatureHeader);
```

API documentation
-----------------

[](#api-documentation)

If you wish to learn more about our API, please visit the [Twikey Api Page](https://api.twikey.com). API Documentation is available in English.

Want to help us make our API client even better?
------------------------------------------------

[](#want-to-help-us-make-our-api-client-even-better)

Want to help us make our API client even better? We take [pull requests](https://github.com/twikey/twikey-api-php/pulls).

Support
-------

[](#support)

Contact: [www.twikey.com](https://www.twikey.com)

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance50

Moderate activity, may be stable

Popularity41

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~102 days

Recently: every ~36 days

Total

11

Last Release

754d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e9b7762a8174b9760ff7cb6b3e2f38cbe9eac635a3df05b23eace5f6abbbe960?d=identicon)[twikey](/maintainers/twikey)

---

Top Contributors

[![koen-serry](https://avatars.githubusercontent.com/u/482723?v=4)](https://github.com/koen-serry "koen-serry (24 commits)")[![rvvincelli](https://avatars.githubusercontent.com/u/3406087?v=4)](https://github.com/rvvincelli "rvvincelli (5 commits)")[![Bonno](https://avatars.githubusercontent.com/u/4113230?v=4)](https://github.com/Bonno "Bonno (2 commits)")[![vanrijs](https://avatars.githubusercontent.com/u/4902478?v=4)](https://github.com/vanrijs "vanrijs (1 commits)")[![abojic](https://avatars.githubusercontent.com/u/14794924?v=4)](https://github.com/abojic "abojic (1 commits)")[![zainspresso](https://avatars.githubusercontent.com/u/24475693?v=4)](https://github.com/zainspresso "zainspresso (1 commits)")[![MinjuCo](https://avatars.githubusercontent.com/u/46010239?v=4)](https://github.com/MinjuCo "MinjuCo (1 commits)")[![twikey-sdk-bot](https://avatars.githubusercontent.com/u/258103336?v=4)](https://github.com/twikey-sdk-bot "twikey-sdk-bot (1 commits)")

---

Tags

apiservicerecurringpaymentpaymentsgatewayidealmolliesepasubscriptionscreditcardsofortdirect debitmistercashbancontactsofortbankingchargesCBCbanktransferbelfiusrefundskbctwikey-php-client

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60014.4M62](/packages/mollie-mollie-api-php)[mollie/magento2

Mollie Payment Module for Magento 2

1121.6M10](/packages/mollie-magento2)[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[mollie/magento

iDEAL, Creditcard, Bancontact/Mister Cash, SOFORT, Bank transfer, Bitcoin, PayPal &amp; paysafecard for Magento https://www.mollie.com/

397.9k](/packages/mollie-magento)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.7M1](/packages/mollie-oauth2-mollie-php)[mage2pro/stripe

Stripe integration with Magento 2

605.3k](/packages/mage2pro-stripe)

PHPackages © 2026

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