Download the PHP package blessdarah/php-campay without Composer
On this page you can find all versions of the php package blessdarah/php-campay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download blessdarah/php-campay
More information about blessdarah/php-campay
Files in blessdarah/php-campay
Package php-campay
Short Description PHP package wrapper for campay momo integration
License MIT
Informations about the package php-campay
PHP Campay
This is a php wrapper for the campay API that enables a seemless integration of momo with PHP and Campay.
Requirements
This package works as from [email protected] and above. Ensure that you have the latest version of php
installed.
How to install this package
To install this package, run:
Usage
The package automatically manages your tokens for all transactions with campay.
Configuration
This packages uses the dotenv package and thus if you're not using something like laravel which automatically loads
env variables, you can set it up like this:
- Create a
.envfile in the root of your project if you don't already have one -
Copy your application
usernameandpasswordfrom your campay dashboard and add them like this: - In your
index.phpfile or your root application entry point, you have to load up thedotenvpackage
If you're not using composer, you can ignore the above steps and set up your .env vars using the php global $_ENV to setup your campay
configurations in the location you want as follows:
Configure campay base url
Remark: You should make sure that you don't expose your config variables online as it will be a potential security issue for your application
Collect payment
Withdraw funds
For withdrawal, we use the withdraw function
The above response contains the info and the reference for your transaction that will enable you check its status using the getTransactionStatus function
Check transaction status
For checking transaction status after using the collect or the withdraw functions,
you can pass the resulting reference key in order to check your transaction status
Get your application balance
Get transaction history with an interval
By default, your transaction history will return all your app's transactions for the past 7 days or past week
If you want the dates to be specific, you can pass your start and end dates like so:
Generate payment link
As per the campay documentation, you can generate a payment link or url that can be utilized for payments. Here's how you do it: