solidgate/ws-client

Php client for webhooks of SolidGate payment gateway

v1.0.1 2021-01-22 09:11 UTC

This package is auto-updated.

Last update: 2024-03-31 15:11:16 UTC


README

PHP version

SolidGate Websocket Client

This library provides client for receive SolidGate payment gateway webhooks.

Documentation

https://dev.solidgate.com/developers/documentation

Installation

With Composer

$ composer require solidgate/ws-client
{
    "require": {
        "solidgate/ws-client": "~1.0"
    }
}

Usage

<?php

use SolidGate\WebsocketClient\PrintWebhookHandler;
use SolidGate\WebsocketClient\WebhookReceiver;

$receiver = new WebhookReceiver(new PrintWebhookHandler());

$event = ''; // see full list events on https://solidgate.atlassian.net/
$merchant = ''; // pass your merchantId
$privateKey = ''; // pass your privateKey

try {
    $receiver->receive($event, $merchant, $privateKey);
} catch (\SolidGate\WebsocketClient\Exception\ConnectionException $connectionException) {
    var_dump($connectionException->getBody()); // handle connection errors (authentication/validation/... error)
}

Run example.php for test usage

php -f example.php