rozetkapay/php-sdk

RozetkaPay php sdk

dev-main 2024-05-27 12:44 UTC

This package is not auto-updated.

Last update: 2024-06-02 07:41:34 UTC


README

68747470733a2f2f726f7a65746b617061792e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032332f30372f726f7a65746b612d7061792e737667

Payment service provider

A payment service provider (PSP) offers shops online services for accepting electronic payments by a variety of payment methods including credit card, bank-based payments such as direct debit, bank transfer, and real-time bank transfer based on online banking. Typically, they use a software as a service model and form a single payment gateway for their clients (merchants) to multiple payment methods. read more

Installation

Simple Start

require 'vendor/autoload.php';
//test
//\RozetkaPay\Configuration::setDev();

//or 
\RozetkaPay\Configuration::setBasicAuth("a6a29002-dc68-4918-bc5d-51a6094b14a8", 'XChz3J8qrr');

\RozetkaPay\Configuration::setResultUrl('https://localhost:8000/result');
\RozetkaPay\Configuration::setCallbackUrl('https://localhost:8000/callback');

//Creates an endpoint for Payment
$rpay = new \RozetkaPay\Api\Payment();

//Creates an instance with payment data
$dataRequest = new \RozetkaPay\Model\Payment\RequestCreatePay();

$dataRequest->amount = 100;
$dataRequest->external_id = 500209;

/**  @var \RozetkaPay\Model\Payment\Responses $data */
/**  @var \RozetkaPay\Model\ResponsesError $error */
list($data, $error) = $rpay->create($dataRequest);

if($data !== false){
    print $data->getCheckoutUrl();
}else{
    print_r($error);
}

Api

See Docs

Examples

To check it you can use build-in php server

cd ~/examples
php -S localhost:8000