webpayby/webpayby-payment-json-sdk

There is no license information available for the latest version (1.0.2) of this package.

SDK for simple making payment request to Webpay

1.0.2 2023-08-23 10:31 UTC

This package is auto-updated.

Last update: 2025-05-23 14:34:11 UTC


README

Installation

To use the SDK

composer require webpayby/webpayby-payment-json-sdk    

Usage

  • Simple request
        $merchantId = 'YOUR_MERCHANT_ID';
        $secretKey = 'YOUR_SECRET_KEY';
        
        $payment = new Payment($merchantId);
        
        $payment
            ->setTest(1)
            ->setCurrencyId(Currency::BYN)
            ->setLanguageId(Language::EN)
            ->setOrderNum(uniqid(time()))
            ->setInvoiceItem('Item1', 4.5)
            ->setInvoiceItem('Item2', 2, 2)
            ->setTotal(8.5)
            ->setReturnUrl('http://example.com/success')
            ->setCancelReturnUrl('http://example.com/cancel')
            ->setNotifyUrl('http://example.com/notify');
        
        
        $gate = new Gateway($secretKey, RequestPoint::SANDBOX_PAYMENT);
        $response = $gate->sendRequest($payment);

        $redirectUrl = $response['redirectUrl'] ?? '';