This page explains how to install and configure Chargeable API with Symfony.
Install packages with composer:
$ composer require damax/chargeable-api # symfony/security-bundle - Make sure security component is installed.
You need to choose appropriate wallet implementation:
$ # For Redis
$ composer require predis/predis snc/redis-bundle
$ # For MongoDB
$ composer require mongodb/mongodb
With introduction of symfony/flex you don't have to worry about enabling relevant bundles, but make sure below is present in your configuration.
// Symfony v4.0 example, but v3.x is also supported.
Damax\ChargeableApi\Bridge\Symfony\Bundle\DamaxChargeableApiBundle::class => ['all' => true],
// For Redis
Snc\RedisBundle\SncRedisBundle::class => ['all' => true],
By default all routes are processed for payment. You can configure endpoints for paid APIs with below:
damax_chargeable_api:
listener:
matcher: ^/api/services/ # Regex
As all paid endpoints require authentication make sure it is covered by Security firewall.
Read next about library concepts or skip right to configuration.