Skip to content

wayforpay/php-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WayForPay PHP SDK Packagist PHP version

License Packagist

Latest Stable Version GitHub Release Date

Packagist PHP version Code size

GitHub stars GitHub issues

PHP SDK for payment system WayForPay.

Table Of Contents

WayForPay documentation

Installing

The recommended way to install SDK is through Composer.

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, run the Composer command to install the latest stable version:

php composer.phar require wayforpay/php-sdk

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

How to use

All examples require composer install before using after cloning from GitHub.

Wizard

Purchase Form

See purchase.php.

Run PHP built-in server

$ php -S localhost:8000

Then open http://localhost:8000/examples/purchase.php in browser.

Purchase Widget

See purchase-widget.php.

Run PHP built-in server

$ php -S localhost:8000

Then open http://localhost:8000/examples/purchase-widget.php in browser.

Transactions List

See transaction-list.php.

$ php examples/transaction-list.php 
Reason Code: 1100
2019-07-01 07:02:44     PURCHASE        Declined                9024 UAH
2019-07-01 06:48:27     PURCHASE        Expired                 50000 UAH
2019-07-01 07:04:10     PURCHASE        Declined                9024 UAH
2019-07-01 07:14:14     CHARGE          Approved                0.01 UAH
2019-07-01 07:13:31     PURCHASE        Declined                9024 UAH
2019-07-01 07:14:38     CHARGE          Approved                0.01 UAH
2019-07-01 07:13:31     PURCHASE        Declined                9024 UAH
2019-07-01 07:15:23     CHARGE          Declined                0.01 UAH
2019-07-01 07:17:39     REFUND          Refunded                0.01 UAH
2019-07-01 07:17:41     REFUND          Refunded                0.01 UAH
2019-07-01 07:17:44     CHARGE          Approved                0.01 UAH
2019-07-01 07:17:48     REFUND          Refunded                0.01 UAH
2019-07-01 07:19:14     CHARGE          Approved                0.01 UAH
2019-07-01 07:04:11     PURCHASE        Expired                 9024 UAH
2019-07-01 07:19:42     PURCHASE        Declined                9024 UAH
2019-07-01 07:23:08     CHARGE          Approved                0.01 UAH
2019-07-01 07:24:25     CHARGE          Approved                0.01 UAH
2019-07-01 07:19:41     PURCHASE        Declined                9024 UAH
2019-07-01 07:32:39     REFUND          Refunded                0.01 UAH
2019-07-01 07:32:41     REFUND          Refunded                0.01 UAH
2019-07-01 07:34:37     PURCHASE        Declined                9024 UAH
2019-07-01 07:35:46     CHARGE          WaitingAuthComplete     39 UAH
2019-07-01 07:34:38     PURCHASE        Declined                9024 UAH
2019-07-01 07:36:01     REFUND          Voided                  39 UAH
2019-07-01 07:36:41     CHARGE          WaitingAuthComplete     95 UAH
2019-07-01 07:36:42     REFUND          Refunded                0.01 UAH
2019-07-01 07:37:01     REFUND          Voided                  95 UAH
2019-07-01 07:39:52     PURCHASE        Declined                9024 UAH
2019-07-01 07:39:52     PURCHASE        Declined                9024 UAH
2019-07-01 07:40:33     REFUND          Refunded                0.01 UAH
2019-07-01 07:40:35     REFUND          Refunded                0.01 UAH
2019-07-01 07:25:52     PURCHASE        Expired                 1.99 USD
2019-07-01 07:42:58     CHARGE          Approved                0.01 UAH
2019-07-01 07:59:27     REFUND          Refunded                0.01 UAH

Response will be instance of TransactionListResponse. Transactions can be retrieved via getTransactionList method.

Charge

See charge.php.

$ php examples/charge.php 
Status: InProcessing

Response will be instance of ChargeResponse. Transaction can be retrieved via getTransaction method.

Complete 3DS

$ php examples/complete-3ds.php 
Status: Approved

Response will be instance of Complete3DSResponse. Transaction can be retrieved via getTransaction method.

Check

$ php examples/check.php 
Reason Code: 1100
Order status: Refunded

Response will be instance of CheckResponse. Order can be retrieved via getOrder method.

Refund

$ php examples/refund.php 
Reason Code: 1100
Order status: Refunded

Response will be instance of RufundResponse.

Service URL

You can set service URL in wizard via

$wizard->setServiceUrl('http://localhost:8000/examples/serviceUrl.php')

After payment processing WayForPay send payment data to specified URL. You can parse and check data like in example.

See serviceUrl.php.

⚠️⚠️⚠️ WARNING ⚠️⚠️⚠️

Service URL must be accessible via Internet. WayForPay can't send data to local machine!

Return URL

You can set service URL in wizard via

$wizard->setReturnUrl('http://localhost:8000/examples/returnUrl.php')

After payment processing WayForPay send payment data to specified URL. You can parse and check data like in example.

See returnUrl.php.

TODO

  • Methods
    • SETTLE
    • P2P_CREDIT
    • P2_PHONE

Contributing

See contributing note