Code Monkey home page Code Monkey logo

swish-php's Introduction

Swish-PHP

Swish-PHP is a small wrapper for the swish merchant api. See https://www.getswish.se/handel/ for more information.

Dependencies

  • php 5.5.9 or newer with curl & openssl
  • composer

Installation

git clone https://github.com/helmutschneider/swish-php.git
composer install

Usage

Swish documentation as of 2016-01-23: https://www.getswish.se/content/uploads/2015/06/Guide-Certifikatsadministration_160118.pdf

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 recommended. You will also need a client certificate and corresponding private key so the Swish server can identify you.

$guzzle = new \GuzzleHttp\Client();

// this is the production url - change if you want to use the test server
$baseUrl = 'https://swicpc.bankgirot.se/swish-cpcapi/api/v1';

// these options are forwarded to guzzle and may differ depending on your OS. Consult the guzzle documentation for
// more infomation: http://docs.guzzlephp.org/en/latest/request-options.html
$options = [
    'verify' => './swish-root.crt',
    'cert' => './client-cert.crt',
    'ssl_key' => ['./key.pem', 'key-password'],
];
$client = new \HelmutSchneider\Swish\Client($guzzle, $baseUrl, $options);

Notes

The bundled php & curl on OSX do not work well with the Swish api. This is probably because they were compiled with SecureTransport and not OpenSSL.

Run the tests

vendor/bin/codecept run

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.