bixi/client

A PHP client for Bixi payment processor.

Maintainers

👁 bixi

Package info

github.com/BixiHQ/php-client

pkg:composer/bixi/client

Statistics

Installs: 270

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.0 2025-06-19 21:27 UTC

Requires

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 0451998edbabab78d80408dd06760878f6dcdef6

  • Bixi Team <hi.woop@bixi.so>

paymentsmobile money transfer

This package is auto-updated.

Last update: 2026-06-19 23:59:19 UTC


README

Main Dev Coverage Version
👁 Main
👁 Main
👁 Coverage
👁 Version

This package provides a small client for interacting with the Bixi API to process payments and receive responses.

Features

  • Simple and intuitive client setup.
  • Comprehensive test coverage using Pest.

Requirements

  • PHP 8.3 or higher
  • Composer
  • GuzzleHTTP
  • Pest (for testing)

Installation

Install the package via Composer:

composer require bixi/client

Getting Started

Step 1: Initialize the Client

use Bixi\Client\Bixi;

$apiToken = 'Your-API-Token';
$bixi = new Bixi($apiToken);

Step 2: Making a Payment Request

try {
 $response = $bixi->pay([
 'memo' => 'credit',
 'accountNumber' => '+252600000000',
 'accountType' => 'mmt',
 'receiptId' => '123456',
 'amount' => 1.00,
 'description' => 'Payment for invoice No. 123456',
 ]);

 echo "Transaction Successful! Transaction ID: " . $response->getId() . PHP_EOL;
 print_r($response->toArray());
} catch (ClientException $e) {
 echo "Error: {$e->getMessage()}" . PHP_EOL;
 print_r($e->getErrors());
}

Step 3: Handling Responses

You can access different parts of the response using methods like getId(), getAttributes(), and getAttribute():

$data = $response->toArray(); // Convert response to an array
$id = $response->getId(); // Transaction ID
$attributes = $response->getAttributes(); // All attributes
$amount = $response->getAttribute('amount'); // Specific attribute

Step 4: Handling Exceptions

When an error occurs, a ClientException will be thrown with detailed error messages:

catch (ClientException $e) {
 foreach ($e->getErrors() as $error) {
 echo "Error Code: {$error['code']} - {$error['detail']}" . PHP_EOL;
 }
}

Testing

This package includes comprehensive test coverage using the Pest PHP testing framework. To run the tests, use the following command:

./vendor/bin/pest

License

This package is licensed under the MIT license. Please see the LICENSE file for more information.

Contributing

Contributions are welcome! Please feel free to open issues or submit pull requests.

Changelog

For the complete list of changes, please see the changelog file.

Contact

For support or inquiries, please contact the package maintainer at hi@bixi.so.