Download the PHP package helmutschneider/swish-php without Composer
On this page you can find all versions of the php package helmutschneider/swish-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download helmutschneider/swish-php
More information about helmutschneider/swish-php
Files in helmutschneider/swish-php
Package swish-php
Short Description PHP-wrapper for the Swish api
License MIT
Informations about the package swish-php
Swish-PHP
Swish-PHP is a small wrapper for the swish merchant api. See https://www.getswish.se/handel/ for more information.
Dependencies
- php 7.3 or newer with curl & openssl
- composer
Upgrade notes
3.0.0
- The function
createPaymentRequest
now returns an object with the two propertiesid
andpaymentRequestToken
. In earlier versions the id was returned directly.
Installation via git
Installation via composer
Obtaining test certificates
As of 2024-09-22, a test certificate bundle (mss_test_2.0.zip) can be found by visiting: https://developer.swish.nu/documentation/environments#certificates
Begin by obtaining the SSL certificates required by Swish. The Swish server itself uses a self-signed root certificated so a CA-bundle to verify its origin is needed. You will also need a client certificate and corresponding private key so the Swish server can identify you.
As of 2024-09-22 the test certificates are called Swish_Merchant_TestCertificate_1234679304.key
, Swish Merchant Test Certificate 1231181189.pem
and Swish_TLS_RootCA.pem
.
You must concatenate Swish_Merchant_TestCertificate_1234679304.key
and Swish Merchant Test Certificate 1231181189.pem
together, otherwise they will not work with cURL.
This bundle is your client certificate.
Usage
The client closely mirrors the swish api:
When you have the SSL certificates ready you may instantiate the client:
Notes for OSX
The bundled PHP in OSX 10.12 and earlier is not compatible with the above approach of forwarding SSL certificates. You must obtain a PHP-version that is compiled with cURL linked against OpenSSL or similar.
Run the tests
To run the tests you need certificates for the Swish test server. Place the root certificate in tests/_data/root.pem
and
the client certificate in tests/_data/client.pem
.