https://github.com/foris-master/orange-money-sdk
orange-money-sdk
https://github.com/foris-master/orange-money-sdk
api composer mobile money orange php sdk
Last synced: 8 months ago
JSON representation
orange-money-sdk
- Host: GitHub
- URL: https://github.com/foris-master/orange-money-sdk
- Owner: Foris-master
- License: mit
- Created: 2018-04-19T21:34:52.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-07-12T02:59:52.000Z (almost 3 years ago)
- Last Synced: 2025-08-30T18:14:53.212Z (10 months ago)
- Topics: api, composer, mobile, money, orange, php, sdk
- Language: PHP
- Size: 13.7 KB
- Stars: 15
- Watchers: 2
- Forks: 17
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Orange Money Sdk
[](https://github.com/thephpleague/orange-money-sdk/releases)
[](LICENSE.md)
[](https://travis-ci.org/thephpleague/orange-money-sdk)
[](https://scrutinizer-ci.com/g/thephpleague/orange-money-sdk/code-structure)
[](https://scrutinizer-ci.com/g/thephpleague/orange-money-sdk)
[](https://packagist.org/packages/league/orange-money-sdk)
**Note:** `orange-money-sdk`.
This is a php sdk for orange operator mobile money api.
## Install
Via Composer
``` bash
$ composer require foris-master/orange-money-sdk
```
## Confing
```
Set AUTH_HEADER, MERCHANT_KEY,RETURN_URL,CANCEL_URL,NOTIF_URL enviroment variable ( .env file if using dotenv),
you get all related to you console at https://developer.orange.com/
```
## Usage
``` php
use Foris\OmSdk\OmSdk;
$om = new OmSdk();
// QuickStart
/**
* You need to set AUTH_HEADER, MERCHANT_KEY,RETURN_URL,CANCEL_URL,NOTIF_URL
* enviroment variable ( .env file if using dotenv)
*/
$om->webPayment(['amount'=>100]);
// Full Options
$opt=[
"merchant_key"=> '********',
"currency"=> "OUV",
"order_id"=> $id,
"amount"=> 0,
"return_url"=> 'http://www.you-site.com/callback/return',
"cancel_url"=> 'http://www.you-site.com/callback/cancel',
"notif_url"=>'http://www.you-site.com/callback/notif',
"lang"=> "fr"
];
$om->webPayment($opt);
```
## API
### Get token
``` php
use Foris\OmSdk\OmSdk;
$om = new OmSdk();
$rep= $om->getToken();
var_dump($rep);
// var_dump result
[
"token_type"=> 'Bearer',
"access_token"=> "0213GH123l12kj312k",
"expires_in"=> "7776000",
];
```
### Web Payment
``` php
use Foris\OmSdk\OmSdk;
$om = new OmSdk();
$opt = [
"merchant_key"=> '********',
"currency"=> "OUV",
"order_id"=> $id,
"amount"=> 0,
"return_url"=> 'http://www.you-site.com/callback/return',
"cancel_url"=> 'http://www.you-site.com/callback/cancel',
"notif_url"=>'http://www.you-site.com/callback/notif',
"lang"=> "fr"
];
$rep= $om->webPayment($opt);
var_dump($rep);
// var_dump result
[
"status"=> 201,
"message"=> "OK",
"pay_token"=> "87a9f2f8ebca97sdfdsbb49795f77981f5be1face7b6a543c8a1304d81e4299fd",
"payment_url"=>"https://webpayment-sb.orange-money.com/payment/pay_token/87a9f2f8ebca97sdfdsbb49795f77981f5be1face7b6a543c8a1304d81e4299fd"
"notif_token"=> "793d6157d9c7d52ae3920dc596956206"
];
```
#### Note
webPayment method automatically call getToken and set it in request header.
### Transaction Status
``` php
use Foris\OmSdk\OmSdk;
$om = new OmSdk();
$rep= $om->checkTransactionStatus($orderId,$amount,$pay_token);
var_dump($rep);
// var_dump result
[
"status" => "SUCCESS",
"order_id" => "MY_ORDER_ID_08082105_0023457",
"txnid" => "MP150709.1341.A00073"
];
```
#### Note
The status could take one of the following values: INITIATED; PENDING; EXPIRED; SUCCESS; FAILED
- INITIATED waiting for user entry
- PENDING user has clicked on “Confirmer”, transaction is in progress on Orange side
- EXPIRED user has clicked on “Confirmer” too late (after token’s validity)
- SUCCESS payment is done
- FAILED payment has failed
## Production
```
For production your need to set your target country code in COUNTRY enviroment variable ( .env file if using dotenv)
example : COUNTRY=cm
```
## Testing
``` bash
$ phpunit
```
## Contributing
Please see [CONTRIBUTING](https://github.com/thephpleague/:package_name/blob/master/CONTRIBUTING.md) for details.
## Credits
- [foris-master](https://github.com/foris-master)
- [All Contributors](https://github.com/thephpleague/:package_name/contributors)
- [Orange dev team](https://developer.orange.com/apis/om-webpay/)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.