PHPackages                             pils36/wayapay-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. pils36/wayapay-php

ActiveLibrary[API Development](/categories/api)

pils36/wayapay-php
==================

Helps make your Wayapay api calls with PHP.

v1.0.0(4y ago)112MITPHP

Since May 17Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Pils36/wayapay-php)[ Packagist](https://packagist.org/packages/pils36/wayapay-php)[ RSS](/packages/pils36-wayapay-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

wayapay-php
===========

[](#wayapay-php)

A PHP API wrapper for [Wayapay](https://wayapay.ng/).

[![Wayapay](img/wayapay.png?raw=true "Wayapay")](https://wayapay.ng/)

Requirements
------------

[](#requirements)

- Curl 7.34.0 or more recent (Unless using Guzzle)
- PHP 5.4.0 or more recent

Install
-------

[](#install)

### Via Composer

[](#via-composer)

```
    $ composer require pils36/wayapay-php
```

### Via download

[](#via-download)

Download a release version from the [releases page](https://github.com/Pils36/wayapay-php/releases). Extract, then:

```
    require 'path/to/src/autoload.php';
```

Usage
-----

[](#usage)

Do a redirect to the authorization URL received from calling the /transaction endpoint. This URL is valid for one time use, so ensure that you generate a new URL per transaction.

When the payment is successful, we will call your callback URL (as setup in your dashboard or while initializing the transaction) and return the reference sent in the first step as a query parameter.

If you use a test secret key, we will call your test callback url, otherwise, we'll call your live callback url.

### 0. Prerequisites

[](#0-prerequisites)

Confirm that your server can conclude a TLSv1.2 connection to Wayapay's servers. Most up-to-date software have this capability. Contact your service provider for guidance if you have any SSL errors. *Don't disable SSL peer verification!*

### 1. Prepare your parameters

[](#1-prepare-your-parameters)

`email`, `amount`, `description`, `wayaPublicKey` and `merchantId` are the most common compulsory parameters.

### 2. Initialize a transaction

[](#2-initialize-a-transaction)

Initialize a transaction by calling our API.

```
    require_once('./vendor/autoload.php');

    $wayapay = new \Pils36\Wayapay;

    try
    {

      $tranx = $wayapay->transaction->initialize([
        'amount'=>"128.00",     // string
        'description'=>"Order for something", // string
        'currency'=>566, // int
        'fee'=>1, // int
        'customer'=> ['name' => "Like Vincent", 'email' => "wakexow@mailinator.com", 'phoneNumber' => "+11948667447"], // array
        'merchantId'=>"MER_qZaVZ1645265780823HOaZW", // string
        'wayaPublicKey'=>"WAYAPUBK_TEST_0x3442f06c8fa6454e90c5b1a518758c70", // string
        'mode'=>"test" // string: \\test or live
      ]);
    } catch(\Pils36\Wayapay\Exception\ApiException $e){
      print_r($e->getResponseObject());
      die($e->getMessage());
    }

    // store transaction reference so we can query in case user never comes back
    // perhaps due to network issue
    saveLastTransactionId($tranx->data->tranId);

    // Get Authorization URL to make payment to the Wayapay payment gateway environment
    $uri = $wayapay->authorizationUrl('test');  // change to live for production

    // Use the authorization url to
    $authorization_url = $uri.$tranx->data->tranId;
```

When the user enters their card details, Wayapay will validate and charge the card. It will do all the below:

Redirect back to a callback\_url set when initializing the transaction or on your dashboard. Customers see a Transaction was successful message.

Before you give value to the customer, please make a server-side call to our verification endpoint to confirm the status and properties of the transaction.

### 3. Verify Transaction

[](#3-verify-transaction)

After we redirect to your callback url, please verify the transaction before giving value.

```
    $transactionId = isset($_GET['_tranId']) ? $_GET['_tranId'] : '';
    if(!$transactionId){
      die('No transaction id provided');
    }

    // initiate the Library's Wayapay Object
    $wayapay = new Pils36\Wayapay;
    try
    {
      // verify using the library
      $tranx = $wayapay->transaction->verify([
        '_tranId'=>$transactionId, // unique to transactions
        'mode'=>'test', // test or live
      ]);
    } catch(\Pils36\Wayapay\Exception\ApiException $e){
      print_r($e->getResponseObject());
      die($e->getMessage());
    }

    if ($tranx->status === true) {
      // transaction was successful...
      // please check other things like whether you already gave value for this transactions
      // if the email matches the customer who owns the product etc
      // Save your transaction information
    }
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
    $ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) and [CONDUCT](.github/CONDUCT.md) for details. Check our [todo list](TODO.md) for features already intended.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Pils36](https://github.com/Pils36)
- [All Contributors](../../contributors)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1460d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/80e2fcdd265aa0d1bbf53745bfe8ef1b1146562efd2541bb835e8fe0e5bdbc7f?d=identicon)[Pils36](/maintainers/Pils36)

---

Top Contributors

[![Pils36](https://avatars.githubusercontent.com/u/35952059?v=4)](https://github.com/Pils36 "Pils36 (20 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/pils36-wayapay-php/health.svg)

```
[![Health](https://phpackages.com/badges/pils36-wayapay-php/health.svg)](https://phpackages.com/packages/pils36-wayapay-php)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
