cardflow / cardflow-php
PHP library for interacting with the Cardflow API.
Requires
- php: ~7.4.0||~8.0.0||~8.1.0||~8.2.0
- ext-curl: *
- ext-json: *
- psr/http-message: ^1.0
Requires (Dev)
- dg/bypass-finals: ^1.2
- guzzlehttp/guzzle: ^7.0
- phpstan/phpstan: ^1.5.4
- phpunit/phpunit: ^9.3
- squizlabs/php_codesniffer: ^3.5
README
PHP library for interacting with the Cardflow API. This SDK is using the public Cardflow API and enables you to:
- Accept gift cards in your webshop
- Redeem and issue gift cards in your POS-system
Requirements
- PHP 7.4.0 and later
- A valid API Key, that can be generated in your Cardflow dashboard
Installation
The SDK is published on Packagist and can be installed using Composer.
composer require cardflow/cardflow-php
Getting Started
Before starting, it is recommended to read the documentation of the underlying Cardflow API where all possible options to include are described.
Initializing the client and performing an API call is done as follows.
$cardflow = new \Cardflow\Client\CardflowClient('eyJ0eXAi....'); $giftCard = $cardflow->giftCards->get('ABCDABCDABCDABCD');
Retrieve a Gift Card
$giftCard = $cardflow->giftCards->get('ABCDABCDABCDABCD');
Redeem a Gift Card
$transaction = $cardflow->giftCards->redeem( 'ABCDABCDABCDABCD', [ "amount" => 1250, "currency" => "EUR", "capture" => false ] );
Development
Clone the Git repository, so you have a local working copy.
git clone https://github.com/cardflow/cardflow-php
Install required (developing) dependencies using Composer.
composer install
Make sure you follow the PSR12 coding standards.
composer phpstan
& composer phpcs