mezai / swish-php
Swish API-wrapper. Compatible with Laravel. Adds support for recurring.
v1.0.1
2026-08-21 14:04 UTC
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.0
- nesbot/carbon: ^2 || ^3
- ramsey/uuid: ^4.2
Requires (Dev)
- ergebnis/composer-normalize: ^2.43
- friendsofphp/php-cs-fixer: ^3.95
- orchestra/testbench: ^10.0 || ^11.0
- pestphp/pest: ^3.0 || ^4.0
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^11.5.3 || ^12.3
- squizlabs/php_codesniffer: ^3.5
Suggests
- illuminate/contracts: Required to use the Laravel integration (^12.0|^13.0).
- illuminate/support: Required to use the Laravel integration (^12.0|^13.0).
Replaces
- olssonm/swish-php: v1.0.1
This package is auto-updated.
Last update: 2026-08-21 14:07:29 UTC
README
Fork of https://github.com/olssonm/swish-php. Adds recurring functionality according to Swish api docs.
https://developer.swish.nu/api/recurring-payments/v1
In order to make a recurring payment you will first have to issue a consent. It supports create, retrieve and cancel flow.
use Olssonm\Swish\Consent; $consent = new Consent([ 'payer' => [ 'alias' => '46711111111', ], 'callbackUrl' => 'https://example.com/callback', ]); $response = $client->create($consent); $id = $response->consentId; // get a consent $response = $client->get(new Consent(['consentId' => $id])); //cancel a consent $response = $client->cancel(new Consent(['consentId' => $id]));
The recurring resource supports create and retrieve.
use Olssonm\Swish\Recurring; use Olssonm\Swish\Consent; $consent = $client->create(new Consent([ 'payer' => [ 'alias' => '46711111111', ], 'callbackUrl' => 'https://example.com/callback', ])); // Create a recurring payment $recurring = new Recurring([ 'amount' => [ 'value' => '10', 'currency' => 'SEK', ], 'consentId' => $consent->consentId, //consent has to be made before request 'message' => 'Test', 'payeePaymentReference' => '150928d55af234236812863a', 'callbackUrl' => 'https://swish.nu', ]); $response = $client->create($recurring); $id = $response->paymentId; // get a recurring payment $response = $client->get(new Recurring(['paymentId' => $id]));