diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3391e43 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,12 @@ +* text=auto + +*.md diff=markdown +*.php diff=php + +/.github export-ignore +/tests export-ignore +.editorconfig export-ignore +.gitattributes export-ignore +.gitignore export-ignore +CHANGELOG.md export-ignore +phpunit.xml export-ignore \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2b0fc6c..c9619a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -test.php \ No newline at end of file +test.php +/vendor/ diff --git a/Examples/Airtel/ReadMe.md b/Examples/Airtel/ReadMe.md deleted file mode 100644 index 06a08a0..0000000 --- a/Examples/Airtel/ReadMe.md +++ /dev/null @@ -1,175 +0,0 @@ -# MoneyUnify - -How to Collect and Send Money Using MoneyUnify with - Airtel Merchant account - > *AIRTEL* to *Airtel*, Instant mobile Money collections and disbursements **in over 15 African countries** with the flexibility of settling funds to your bank or mobile money account. - - -Begin by creating your developer account on the Official [Airtel Developer portal](https://developers.airtel.africa/home). Thereafter, configure your keys on the [MoneyUnify Dashboard](https://dashboard.moneyunify.com) and move on to collecting or disbursing as guided below. - -## Collecting online Mobile Payments - [ Airtel Money - example] -> Use your favourite stack to collect money via USSD from customers in over 15 African countries - -- **API Collection URL** ***https://api.moneyunify.com/airtel/request_payment*** - *POST* - - - - - - - - - - - - - - -
JavascriptLaravel
- How to collect money through airtel using USSD in JavaScript - - How to collect money through airtel using USSD in Laravel -
- - -## Airtel is Available in over 15 African countries - > 2% - 2.5% transaction fees - - [x] Collect mobile Money payments from *Airtel* networks - - [x] API Disbursments are coming soon - - -### Supported Countries on the Airtel mobile Money USSD provider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CountryCountry CodeCurrencyCurrency Code
UGANDAUGUgandan shillingUGX
NIGERIANGNigerian nairaNGN
TANZANIATZTanzanian shillingTZS
KENYAKEKenyan shillingKES
RWANDARWRwandan francRWF
ZAMBIAZMZambian kwachaZMW
GABONGACFA franc BEACCFA
NIGERNECFA franc BCEAOXOF
CONGO-BRAZZAVILLECGCFA franc BCEAXAF
DR CONGOCDCongolese francCDF
DR CONGOCDUnited States dollarUSD
CHADTDCFA franc BEACXAF
SEYCHELLESSCSeychelles rupeeSCR
MADAGASCARMGMalagasy ariaryMGA
MALAWIMWMalawian kwachaMWK
- - - -
- -# This project was built/tested with - -- PHP 8 - -# Author - -👤 **Blessed Jason Mwanza** - [Buy me A Coffee](https://www.buymeacoffee.com/mwanzabj) - -- Portfolio : [https://blessedjasonmwanza.tech](https://blessedjasonmwanza.tech) - -- LinkedIn: [Connect with me on LinkedIn](https://www.linkedin.com/in/blessedjasonmwanza) - -- Github : [@blessedjasonmwanza](https://github.com/blessedjasonmwanza) - -- Twitter : [Follow me @mwanzabj](https://twitter.com/mwanzabj) - -- Youtube : [Youtube](https://www.youtube.com/@blessedjasonmwanza) - -# 🤝 Contributing - -Contributions, issues, and feature requests are welcome! - -Feel free to check the [issues page](https://github.com/blessedjasonmwanza/MoneyUnify/issues). - -# Show your support - -Give a ⭐️ if you like this project! - diff --git a/Examples/Airtel/collect/Airtel_request_payment_javascript.png.png b/Examples/Airtel/collect/Airtel_request_payment_javascript.png.png deleted file mode 100644 index 39440fc..0000000 Binary files a/Examples/Airtel/collect/Airtel_request_payment_javascript.png.png and /dev/null differ diff --git a/Examples/Airtel/collect/Airtel_request_payment_laravel.png b/Examples/Airtel/collect/Airtel_request_payment_laravel.png deleted file mode 100644 index 502fb41..0000000 Binary files a/Examples/Airtel/collect/Airtel_request_payment_laravel.png and /dev/null differ diff --git a/Examples/Moneyunify/ReadMe.md b/Examples/Moneyunify/ReadMe.md deleted file mode 100644 index e477ba8..0000000 --- a/Examples/Moneyunify/ReadMe.md +++ /dev/null @@ -1,294 +0,0 @@ - -# [MoneyUnify](https://github.com/blessedjasonmwanza/MoneyUnify) - -## How to Receive Payments in Zambia through Mobile Money - -Receive instant mobile money collections in Zambia through all 3 mobile networks; AIRTEL, MTN, and ZAMTEL. `moneyunify` endpoint is recommended for businesses operating within Zambia, providing the flexibility of settling funds to your bank or mobile money account. - -## Setup - -- Create an account on [MoneyUnify](https://dashboard.moneyunify.com) and use the obtained keys to create your MoneyUnify ID (muid). -- No need for KYC. -- Customer support available via - 📞 [WhatsApp](https://wa.me/+260971943638) - -### Visit https://documenter.getpostman.com/view/11980646/2s9YsJBXZT for a comprehensive and easy-to-use documentation. - ---- - -## Collecting Online Mobile Payments [Example] - -Use your favorite programming language to collect money via USSD from customers in Zambia. -- **API Collection URL**: `https://api.moneyunify.com/moneyunify/request_payment` - use **POST** method - > Before any transaction fees A ZMW 1 (`amount + 1`) charge is added on every collection /request to pay request by MNO. - -### PHP Curl Example - Request Payment from Customer - -```php - 'YOUR_MONEY_UNIFY_ID', - 'phone_number' => 'CUSTOMER_PHONE_NUMBER', // 10 digits customer phone number, e.g., 09700000 - 'transaction_details' => 'Test order', - 'amount' => '1', // Amount to deduct, e.g., 5.50 or 2 - 'email' => 'mwanzabj@gmail.com', - 'first_name' => 'Blessed Jason', - 'last_name' => 'Mwanza', -); - -$curl = curl_init(); -curl_setopt($curl, CURLOPT_URL, 'https://api.moneyunify.com/moneyunify/request_payment'); -curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); -curl_setopt($curl, CURLOPT_POST, true); -curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($body)); - -$response = curl_exec($curl); - -if ($response === false) { - echo 'cURL Error: ' . curl_error($curl); -} else { - echo $response; -} - -curl_close($curl); -``` - ---- - -## Success Message Example - -If the transaction request is successful, you'll receive a response like this: - - - -```json -// always returns a json object -{ - "message": "Transaction was successful", - "data": { - "amount": 1, - "currency": "ZMW", - "customerFirstName": "Blessed Jason", - "customerLastName": "Mwanza", - "customerMobileWallet": "0971943638", - "merchantReference": "0971943638_1693599460", - "reference": "eyJ0aWQiOjI5ODg4ODQsImVudiI6InAifQ", - "responseCode": 200, - "status": "TXN_AUTH_SUCCESSFUL", - "transactionAmount": 1 - }, - "isError": false -} -``` - ---- - -## Error Message Example - -If the transaction request fails, you'll receive a response like this: - -```json -{ - "isError": true, - "message": "request not authorized", - "console": { - "responseCode": 403 - } -} -``` - - ---- - -## Settle Funds to Mobile Wallet [Example] - -Use your favorite programming language to Settle Funds to your mobile wallet. - -

WARNINGS ⚠️⚠️

- - - ⚠️ Settlements **are None Reversible**! **keep your muid and email private!** - - ⚠️ This endpoint will move all your funds into the destination phone number use it with extra care - - -### PHP Curl Example - Settle funds to mobile money wallet - -- **TRANSACTION SETTLEMENT URL**: `https://api.moneyunify.com/moneyunify/settle` - use **POST** method - -```php - "YOUR_MUID", - "email" => "user@site.domain", // your email associated with moneyunify - "first_name" => "Blesson", //receiving account holder first name - "last_name" => "Mwanza", //receiving account holder last name - "transaction_details" => "Settle all money to mobile wallet", - "phone_number" => "096xxxxxxx", // 10 digits MTN receiving/settlement phone number -); - -curl_setopt_array($curl, array( - CURLOPT_URL => "https://api.moneyunify.com/moneyunify/settle", - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => "", - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 30, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => "POST", - CURLOPT_POSTFIELDS => http_build_query($body), -)); - -$response = curl_exec($curl); -$err = curl_error($curl); - -curl_close($curl); - -if ($err) { - echo "cURL Error #:" . $err; -} else { - echo $response; -} -``` - ---- - -## Settlement Response Example - -Check the status of the transaction: - -```json -{ - "message": "Settlement successful!", - "data": { - "reference": "eyJ0aWQiOjI5ODc3MzEsImVudiI6InAifQ", - "status": "TXN_SUCCESSFUL" - }, - "isError": false -} -``` - - - - - ---- - -## Verifying Transactions [Example] - -Use your favorite programming language to verify transaction statuses. - -- **TRANSACTION VERIFICATION URL**: `https://api.moneyunify.com/moneyunify/verify_transaction` - use **POST** method - -### PHP Curl Example - Verify Transaction Status - -```php - 'YOUR_MONEY_UNIFY_ID_HERE', - 'reference' => 'ayC0aWQiOoI5ODMxNjEsImVudiI6InAifQ', -); - -curl_setopt_array($curl, array( - CURLOPT_URL => "https://api.moneyunify.com/moneyunify/verify_transaction", - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => "", - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 30, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => "POST", - CURLOPT_POSTFIELDS => http_build_query($body), -)); - -$response = curl_exec($curl); -$err = curl_error($curl); - -curl_close($curl); - -if ($err) { - echo "cURL Error #:" . $err; -} else { - echo $response; -} -``` - ---- - -## Verification Response Example - -Check the status of the transaction: - -```json -{ - "message": "Transaction was successful", - "data": { - "amount": 0.97, - "currency": "ZMW", - "customerFirstName": "Blessed Jason", - "customerLastName": "Mwanza", - "customerMobileWallet": "0971943638", - "feeAmount": 0.03, - "feePercentage": 3, - "merchantReference": "0971943638_139938267", - "message": "Transaction was successful", - "reference": "eyJ0aWciOjI3adDMxNTksImVudiI6InAifQ", - "responseCode": 200, - "status": "TXN_AUTH_SUCCESSFUL", - "transactionAmount": 1 - }, - "isError": false -} -``` - ---- - -## Response Status Description - -Here are the response statuses returned when requesting payment or verifying transactions: - -| Status | Description | -|----------------------|-------------------------------------------------------| -| TXN_AUTH_PENDING | Transaction awaiting authorization. | -| TXN_PENDING | Transaction still processing. | -| TXN_AUTH_SUCCESSFUL | Successfully authorized transaction. | -| TXN_AUTH_UNSUCCESSFUL| Transaction authorization failed. | -| TXN_SUCCESSFUL | Transaction successfully processed. | -| TXN_FAILED | Transaction failed. | -| TXN_PROCESSING | Transaction submitted for processing. | - ---- - -> Please `NOTE` - Transactions delay to be approved and return `Pending`. You'll need to always keep your transaction response reference keys and use the verify endpoint to verify the status before moving your customers to the next steps of the purchase journey. - -## This Project was Built/Tested with - -- PHP 8 - -## Author - -👤 **Blessed Jason Mwanza** - -- Portfolio: [https://blessedjasonmwanza.tech](https://blessedjasonmwanza.tech) -- LinkedIn: [Connect on LinkedIn](https://www.linkedin.com/in/blessedjasonmwanza) -- Github: [@blessedjasonmwanza](https://github.com/blessedjasonmwanza) -- Twitter: [Follow @mwanzabj](https://twitter.com/mwanzabj) -- YouTube: [YouTube Channel](https://www.youtube.com/@blessedjasonmwanza) - ---- - -## 🤝 Contributing - -Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/blessedjasonmwanza/MoneyUnify/issues). - -## Show Your Support - -If you find this project helpful, give it a ⭐️! diff --git a/Examples/Mtn/ReadMe.md b/Examples/Mtn/ReadMe.md deleted file mode 100644 index 25b12eb..0000000 --- a/Examples/Mtn/ReadMe.md +++ /dev/null @@ -1,192 +0,0 @@ -# [MoneyUnify](https://github.com/blessedjasonmwanza/MoneyUnify) - -## How to Collect Payments Using MoneyUnify with MTN MoMo Merchant account - -How to Collect and Send Money Using MoneyUnify with - Airtel Merchant account - > *MTN* to *MTN*, Instant mobile Money collections and disbursements **in over 12 African countries** with the flexibility of settling funds to your bank or mobile money account. - - -## SETUP - -- Login to your MTN MoMo account [here](https://momodeveloper.mtn.com/signin?ReturnUrl=%2F). -- Follow all instructions [here](https://momodeveloper.mtn.com/api-documentation/getting-started/) on how to subscribe to the collection API if you have not yet done so -- Go to [Profile](https://momodeveloper.mtn.com/developer) tab to order to obtain both your public/Secondary and private/Primary keys - - - - Create your account on [MoneyUnify](https://dashboard.moneyunify.com) and use your above obtained keys to create your muid (MoneyUnify ID) - This applies if you have not yet created your MoneyUnify Account. If you already have one, just login, you will find your MUI ID om your dashboard. - -
- -## Collecting online Mobile Payments [example] -> Use your favorite stack or programming language to collect money via USSD from customers in Zambia - -- **API Collection URL** ***https://api.moneyunify.com/sparco/request_payment*** - *POST* - -### PHP Curl Example - Request payment from customer -```PHP - - 'YOUR_MONEY_UNIFY_ID_HERE', //get it from your money unify dashboard https://dashboard.moneyunify.com/ - 'mode' => 'sandbox', // live for production and sandbox when testing the API - 'phone_number' => 'customer_phone_number', // Customer mobile money phone number where funds are to be deducted. - 'transaction_details' => 'Dell Laptop 3400', //Description of transaction / product being purchased - 'amount' => '2500' // valid number amount e.g 2.45 or 2345 or 23213.04. 2500 is just an example -]; - -curl_setopt_array($curl, [ - CURLOPT_URL => "https://api.moneyunify.com/mtn/request_payment", - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => "", - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 30, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => "POST", - CURLOPT_POSTFIELDS => $data, -]); - -// Trigger payment -$response = curl_exec($curl); -$err = curl_error($curl); - -curl_close($curl); - -if ($err) { - echo "cURL Error #:" . $err; -} else { - echo $response; -} - -// see API responses below image examples for your eased debugging - -``` - -**You love learning using videos?** - > We have API documentation videos [here](https://www.youtube.com/@blessedjasonmwanza) - - - - - - - - - - - - - - - -
PythonLaravel
- - - -
- - - - - - - - - - - - - - - -
JavaScript using (fetch)PHP Curl
- - - -
- - -
- - - -## SUCCESS Message Examples - -> If transaction request is successful, you will get a response like this one. -```json -{ - "message": "Request successful!", - "data": { - "headers": { - "Content-Type": "application/json", - "X-Reference-Id": "ca9cd07d-0f16-4b61-bac7-dc01c09bcba6", - "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSMjU2In0.eyJjbGllbnRJZCI6IaRkOTEzZDdkLTlmMTYtNGI2MS1iYWM3LWRjMDFjNjliY2JhNiIsImV4cGlyZXMiOiIyMDIzLTA3LTI1VDE5OjU4OjMxLjk2OCIsInNlc3Npb25JZCI6ImIxOGFjMzEzLTQwMGItNDkzZS1iZGRmLWNiOGE0MzFlMzJjZCJ9.Q_L0Y0PstuBbgc2lxefTcRsB9rMywdjMsbKj2y3pfFB7qvUFdaxqsPX6EzV0qXtywHaErSObEd0-TvoLvGehKQbx4kyS-7UfI6AdQm2CRQXVj7ZBFiMXNReQA0uSQeOV-IFGPiS79rqMfKpxuPaJcN7gCxkYJ7nYUlGco-BvJBYeDPRQVpu7feHGMtB4BEh0oPrC4bZf3AN7IGnpehUt38uUoi7YFGsIYrpxZ-T5SJOMQlEklP-tHVWVZyimyon2tK7WFJ6tz_w4HkVnxAvrsjEp307chgDXsdrl7lmr1ElKzOShDG7uPWvzJQf8I7dnKJwgXPt7of07gYfFfvB8fg", - "X-Target-Environment": "sandbox", - "Ocp-Apim-Subscription-Key": "ed25112b0b624abdbc5f0063f31c21fe" - } - }, - "isError": false -} -``` - -## Error Message examples - -If transaction request has failed, you will get a response like this one. For debugging purposes, kindly refer to the [official MoMo Developer site](https://momodeveloper.mtn.com/api-documentation/common-error/). - -```json -{ - "message": "Request payment Failed. Please try again: ", - "console": { - "debug": { - "status_code": 400, - "headers": [ - "Content-Type: application/json", - "X-Reference-Id: 0d59da5c-8f7d-4a00-bab0-bae2334c8019", - "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSMjU2In0.eyJjbGllbnRJZCI6IjBkNTlkYTVjLThmN2QtNGEwMC1iYWIwLWJhZTIzMzRjODAxOSIsImV4cGlyZXMiOiIyMDIzLTA3LTI2VDIxOjM5OjMyLjY4OCIsInNlc3Npb25JZCI6ImI2NWU2ODhiLTQ5NDItNGU5NS1hNGQ1LWFjYzVmOWIxNjg4OCJ9.AZ9pIpkqfmp-1qTcSw6ei_3teixZjHV-eaU9-DQ6vzZnj9rOA75MCqQnOQrvNUESvb3V0k7GOx-NXix6gYzzDdEaetCx42Ix757rqeh71DeVXatkMA8ZXTSSco-7ZRjDUlTC1lFqIccq5_hJzvWzpmzS7suAkX-dxMOvkfycoZ9A9AIvqUHBwzc0xGXmJsWgMxTXjeZy7ZDw_Ryxa9bMS447OwhqmV6xmiNrU5aU1JWWh6xA3hBarY4gHAqpLo8GHP6dcqzTaU373vmVgpCo-5s6bzQgchGW9DziWYuJpppwlwaV2eI21G_jksRjTQ_HZi-ftYzfxmTcFg1B4TkK-g", - "X-Target-Environment: sandbox", - "Ocp-Apim-Subscription-Key: 3925012b0b624abdbc5f0063f27c215e" - ], - "body": "{\"amount\":\"2500\",\"currency\":\"EUR\",\"externalId\":\"16904039737268\",\"payer\":{\"partyIdType\":\"MSISDN\",\"partyId\":\"\"},\"payerMessage\":\"Payment: Dell Laptop 3400\",\"payeeNote\":\"Dell Laptop 3400\"}", - "response": "" - } - }, - "isError": true -} -``` - -
- - -
- -# This project was built/tested with - -- PHP 8 - -# Author - -👤 **Blessed Jason Mwanza** - [Buy me A Coffee](https://www.buymeacoffee.com/mwanzabj) - -- Portfolio : [https://blessedjasonmwanza.tech](https://blessedjasonmwanza.tech) - -- LinkedIn: [Connect with me on LinkedIn](https://www.linkedin.com/in/blessedjasonmwanza) - -- Github : [@blessedjasonmwanza](https://github.com/blessedjasonmwanza) - -- Twitter : [Follow me @mwanzabj](https://twitter.com/mwanzabj) - -- Youtube : [Youtube](https://www.youtube.com/@blessedjasonmwanza) - -# 🤝 Contributing - -Contributions, issues, and feature requests are welcome! - -Feel free to check the [issues page](https://github.com/blessedjasonmwanza/MoneyUnify/issues). - -# Show your support - -Give a ⭐️ if you like this project! - diff --git a/Examples/Mtn/collect/Curl-php.png b/Examples/Mtn/collect/Curl-php.png deleted file mode 100644 index 838a3cd..0000000 Binary files a/Examples/Mtn/collect/Curl-php.png and /dev/null differ diff --git a/Examples/Mtn/collect/JavaScript.png b/Examples/Mtn/collect/JavaScript.png deleted file mode 100644 index 5da7740..0000000 Binary files a/Examples/Mtn/collect/JavaScript.png and /dev/null differ diff --git a/Examples/Mtn/collect/Laravel.png b/Examples/Mtn/collect/Laravel.png deleted file mode 100644 index 6296004..0000000 Binary files a/Examples/Mtn/collect/Laravel.png and /dev/null differ diff --git a/Examples/Mtn/collect/Python.png b/Examples/Mtn/collect/Python.png deleted file mode 100644 index 1ed48ee..0000000 Binary files a/Examples/Mtn/collect/Python.png and /dev/null differ diff --git a/Examples/Sparco/ReadMe.md b/Examples/Sparco/ReadMe.md deleted file mode 100644 index 79a7c61..0000000 --- a/Examples/Sparco/ReadMe.md +++ /dev/null @@ -1,258 +0,0 @@ -# [MoneyUnify](https://github.com/blessedjasonmwanza/MoneyUnify) - - -Before you proceed, we recommend you use [Moneyunify endpoint](../Moneyunify/ReadMe.md) instead. Unless, you have an approved account with Sparco gateway. - -## How to Collect and Send Money Using MoneyUnify with a Sparco Merchant account - - > *AIRTEL*, *MTN*, & *ZAMTEL* Instant mobile Money collections and disbursements **in Zambia** with the flexibility of settling funds to your bank or mobile money account. - - -## SETUP - -- Login to your Sparco account [here](https://gateway.sparco.io/) then, go to ```Settings``` tab in order to obtain both your public and private/secret keys - - - - Create your account on [MoneyUnify](https://dashboard.moneyunify.com) and use your above-obtained keys to create your muid (MoneyUnify ID) - -
- -## Collecting online Mobile Payments [example] -> Use your favorite stack to collect money via USSD from customers in Zambia - -- **API Collection URL** ***https://api.moneyunify.com/sparco/request_payment*** - *POST* - -### PHP Curl Example - Request payment from customer -```PHP - - 'YOUR_MONEY_UNIFY_ID_HERE', //get it from your money unify dashboard https://dashboard.moneyunify.com/ - 'first_name' => 'Customer_first_name', - 'last_name' => 'Customer_last_name', - 'email' => 'Customer_email', - 'phone_number' => 'customer_phone_number', // Customer mobile money phone number where funds are to be deducted. e.g 260971943638 - 'transaction_details' => 'Dell Laptop 3400', //Description of transaction / product being purchased - 'amount' => '2500' // valid number amount e.g 2.45 or 2345 or 23213.04. 2500 is just an example -]; - -curl_setopt_array($curl, [ - CURLOPT_URL => "https://api.moneyunify.com/sparco/request_payment", - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => "", - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 30, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => "POST", - CURLOPT_POSTFIELDS => $data, - CURLOPT_HTTPHEADER => [ - "Accept: */*", - "Content-Type: application/x-www-form-urlencoded" - ], -]); - -// Trigger payment -$response = curl_exec($curl); -$err = curl_error($curl); - -curl_close($curl); - -if ($err) { - echo "cURL Error #:" . $err; -} else { - echo $response; -} - -// see API responses below image examples for your eased debugging - -``` - -**You love learning using videos?** - > We have API documentation videos [here](https://www.youtube.com/watch?v=FSiqu8u0SjE&list=PLfHq8ygfMtd7pvjYNQUuZAaxLAxg6hSN8&pp=gAQBiAQB) - - - - - - - - - - - - - - - -
JqueryLaravel
- - - -
- - - - - - - - - - - - - - - -
Vanilla JS using (Axios)JavaScript using (fetch)
- - - -
- - -
- - - -## SUCCESS Message Examples - -> If the transaction request is successful, you will get responses like these. -```json -{ - // wating for user to enter pin - "message": "Transaction pending authorization.", - "data": { - "amount": 1.93, - "currency": "ZMW", - "customerFirstName": "john", - "customerLastName": "doe", - "customerMobileWallet": "0971943638", - "feeAmount": 0.07, - "feePercentage": 3.5, - "merchantReference": "0970xx_1191149585", - "reference": "eyJ0aWQqweqdwqdrwerwwe2NzgsImVudiI6InAifQ", - "responseCode": 200, - "status": "TXN_AUTH_PENDING", - "transactionAmount": 2 - }, - "isError": false -} -// user approved transaction -{ - "message": "Transaction pending authorization.", - "data": { - "amount": 1.93, - "currency": "ZMW", - "customerFirstName": "john", - "customerLastName": "doe", - "customerMobileWallet": "0971943638", - "feeAmount": 0.07, - "feePercentage": 3.5, - "merchantReference": "0970xx_1191149585", - "reference": "eyJ0aWQqweqdwqdrwerwwe2NzgsImVudiI6InAifQ", - "responseCode": 200, - "status": "TXN_AUTH_PENDING", - "transactionAmount": 2 - }, - "isError": false -} -``` - -## Error Message examples - -If a transaction request has failed, you will get responses like these. - -```json -{ - "isError": true, - "message": "request not authorized", - "console": - { - "responseCode": 403 - } -} - -//or - -{ - "message": "Invalid phone number", - "console": { - "muid": "YOUR_MONEY_UNIFY ID", - "phone_number": "097943638", - "transaction_details": "Test order", - "amount": "2", - "email": "mwanzabj@gmail.com", - "first_name": "BLessed jason", - "last_name": "Mwanza" - }, - "isError": true -} -``` - -
- - -## Sending, Crediting / sending money to mobile networks[example] -> Use your favourite stack to Transfer your collections to Zamtel or MTN Mobile networks in Zambia - -> Funds / Money in your merchant account can also be settled directly to your bank account - -API works the same as collections above include required parameters. What changes is the endpoint url. use the one below instead, for disbursements; -- **API Disbursement URL** ***https://api.moneyunify.com/sparco/send_money*** - *POST* - - - - - - - - - - - - - - - -
JqueryLaravel
- - - -
- - -
- -# This project was built/tested with - -- PHP 8 - -# Author - -👤 **Blessed Jason Mwanza** - [Buy me A Coffee](https://www.buymeacoffee.com/mwanzabj) - -- Portfolio : [https://blessedjasonmwanza.tech](https://blessedjasonmwanza.tech) - -- LinkedIn: [Connect with me on LinkedIn](https://www.linkedin.com/in/blessedjasonmwanza) - -- Github : [@blessedjasonmwanza](https://github.com/blessedjasonmwanza) - -- Twitter : [Follow me @mwanzabj](https://twitter.com/mwanzabj) - -- Youtube : [Youtube](https://www.youtube.com/@blessedjasonmwanza) - -# 🤝 Contributing - -Contributions, issues, and feature requests are welcome! - -Feel free to check the [issues page](https://github.com/blessedjasonmwanza/MoneyUnify/issues). - -# Show your support - -Give a ⭐️ if you like this project! - diff --git a/Examples/Sparco/collect/JQuery.png b/Examples/Sparco/collect/JQuery.png deleted file mode 100644 index 9da0ff0..0000000 Binary files a/Examples/Sparco/collect/JQuery.png and /dev/null differ diff --git a/Examples/Sparco/collect/JS fetch.png b/Examples/Sparco/collect/JS fetch.png deleted file mode 100644 index 755192f..0000000 Binary files a/Examples/Sparco/collect/JS fetch.png and /dev/null differ diff --git a/Examples/Sparco/collect/Laravel.png b/Examples/Sparco/collect/Laravel.png deleted file mode 100644 index 24c4054..0000000 Binary files a/Examples/Sparco/collect/Laravel.png and /dev/null differ diff --git a/Examples/Sparco/collect/js axios.png b/Examples/Sparco/collect/js axios.png deleted file mode 100644 index 8339c16..0000000 Binary files a/Examples/Sparco/collect/js axios.png and /dev/null differ diff --git a/Examples/Sparco/disburse/send_money_jquery.png b/Examples/Sparco/disburse/send_money_jquery.png deleted file mode 100644 index d914e64..0000000 Binary files a/Examples/Sparco/disburse/send_money_jquery.png and /dev/null differ diff --git a/Examples/Sparco/disburse/send_money_laravel.png b/Examples/Sparco/disburse/send_money_laravel.png deleted file mode 100644 index dd17e42..0000000 Binary files a/Examples/Sparco/disburse/send_money_laravel.png and /dev/null differ diff --git a/collectMoneyExample.png b/collectMoneyExample.png deleted file mode 100644 index ed5648a..0000000 Binary files a/collectMoneyExample.png and /dev/null differ diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..d4ea0d8 --- /dev/null +++ b/composer.json @@ -0,0 +1,24 @@ +{ + "name": "blessedjasonmwanza/moneyunify", + "description": "Payments API with primary focus on Mobile Money USSD payments.", + "type": "library", + "autoload": { + "psr-4": { + "Blessedjasonmwanza\\MoneyUnify\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Blessedjasonmwanza\\MoneyUnify\\": "tests/" + } + }, + "authors": [ + { "role": "Developer", + "name": "Blessed Jason Mwanza", + "homepage": "https://github.com/blessedjasonmwanza" + } + ], + "require": { + "php": "^7.0" + } +} diff --git a/src/.dump b/src/.dump new file mode 100644 index 0000000..e69de29 diff --git a/tests/.dump b/tests/.dump new file mode 100644 index 0000000..e69de29