-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add docz and the respective configurations for the documentatio…
…n and add the documentation
- Loading branch information
1 parent
1c1558e
commit d2e6294
Showing
24 changed files
with
4,794 additions
and
145 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
name: Getting Started | ||
route: /docs | ||
--- | ||
|
||
## Overview | ||
|
||
PaymentsDS is a service that lets developers integrate their businesses/products with [M-Pesa](https://developer.mpesa.vm.co.mz/) API to facilitate transactions. | ||
|
||
## Quickstart | ||
|
||
These quickstart guides will teach you how to integrate PaymentsDS to your service. | ||
|
||
Choose your programming language below: | ||
|
||
- [Java](/docs-java-usage) | ||
- [JavaScript](/docs-javascript-usage) | ||
- [PHP](/docs-php-usage) | ||
- [Python](/docs-python-usage) | ||
- [Ruby](/docs-ruby-usage) | ||
|
||
## Features | ||
|
||
PaymentsDS can be used to: | ||
|
||
- Receive money from a mobile account to a business account | ||
- Send money from a business account to a mobile account | ||
- Send money from a business account to a another business account | ||
- Revert a transaction | ||
- Query the status of a transaction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
name: Installation | ||
menu: Java | ||
--- | ||
|
||
You can install the Ruby SDK using RubyGems or Bundler with the commands listed below: | ||
|
||
#### Using RubyGems | ||
|
||
```bash | ||
gem install paymentsds-mpesa | ||
``` | ||
|
||
#### Using Bundler | ||
|
||
```ruby | ||
#Gemfile | ||
gem 'paymentsds-mpesa' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
--- | ||
name: Usage | ||
menu: Java | ||
--- | ||
|
||
### Prerequisites | ||
|
||
To use PaymentsDS with the Ruby SDK you need to have: | ||
|
||
- [Ruby 2.5+](https://www.ruby-lang.org) | ||
- [RubyGems](https://rubygems.org) | ||
- [Bundler](https://bundler.io) | ||
|
||
### Receive money from a mobile account to a business account | ||
|
||
```ruby | ||
require 'paymentsds/mpesa' | ||
|
||
client = Paymentsds::MPesa::Client.new do |config| | ||
config.api_key = '<REPLACE>' # API Key | ||
config.public_key = '<REPLACE>' # Public Key | ||
config.service_provider_code = '<REPLACE>' # input_ServiceProviderCode | ||
end | ||
|
||
begin | ||
payment_data = { | ||
from: '841234567', # input_CustomerMSISDN | ||
reference: '11114', # input_ThirdPartyReference | ||
transaction: 'T12344CC', # input_TransactionReference | ||
amount: '10' # input_Amount | ||
} | ||
|
||
result = client.receive(payment_data) | ||
|
||
if result.success? | ||
puts result.data | ||
end | ||
rescue | ||
puts 'Operation failed' | ||
end | ||
``` | ||
|
||
### Send money from a business account to a mobile account | ||
|
||
```ruby | ||
require 'paymentsds/mpesa' | ||
|
||
client = Paymentsds::MPesa::Client.new do |config| | ||
config.api_key = '<REPLACE>' # API Key | ||
config.public_key = '<REPLACE>' # Public Key | ||
config.service_provider_code = '<REPLACE>' # input_ServiceProviderCode | ||
end | ||
|
||
begin | ||
payment_data = { | ||
to: '841234567', # input_CustomerMSISDN | ||
reference: '11114', # input_ThirdPartyReference | ||
transaction: 'T12344CC', # input_TransactionReference | ||
amount: '10' # input_Amount | ||
} | ||
|
||
result = client.send(payment_data) | ||
|
||
if result.success? | ||
puts result.data | ||
end | ||
rescue | ||
puts 'Operation failed' | ||
end | ||
``` | ||
|
||
### Send money from a business account to a another business account | ||
|
||
```ruby | ||
require 'paymentsds/mpesa' | ||
|
||
client = Paymentsds::MPesa::Client.new do |config| | ||
config.api_key = '<REPLACE>' # API Key | ||
config.public_key = '<REPLACE>' # Public Key | ||
config.service_provider_code = '<REPLACE>' # input_ServiceProviderCode | ||
end | ||
|
||
begin | ||
payment_data = { | ||
to: '979797', # input_ReceiverPartyCode | ||
reference: '11114', # input_ThirdPartyReference | ||
transaction: 'T12344CC', # input_TransactionReference | ||
amount: '10' # input_Amount | ||
} | ||
|
||
result = client.send(payment_data) | ||
|
||
if result.success? | ||
puts result.data | ||
end | ||
rescue | ||
puts 'Operation failed' | ||
end | ||
``` | ||
|
||
### Revert a transaction | ||
|
||
```ruby | ||
require 'paymentsds/mpesa' | ||
|
||
client = Paymentsds::MPesa::Client.new do |config| | ||
config.api_key = '<REPLACE>' # API Key | ||
config.public_key = '<REPLACE>' # Public Key | ||
config.service_provider_code = '<REPLACE>' # input_ServiceProviderCode | ||
config.initiator_identifier = '<REPLACE>' # input_InitiatorIdentifier, | ||
config.security_identifier = '<REPLACE>' # input_SecurityCredential | ||
end | ||
|
||
begin | ||
reversion_data = { | ||
reference: '11114', # input_ThirdPartyReference | ||
transaction: 'T12344CC', # input_TransactionReference | ||
amount: '10' # input_ReversalAmounts | ||
} | ||
|
||
result = client.reversion(payment_data) | ||
|
||
if result.success? | ||
# Handle success scenario | ||
end | ||
rescue | ||
# Handle failure scenario | ||
end | ||
``` | ||
|
||
### Query the status of a transaction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
name: Configuration | ||
menu: JavaScript | ||
--- | ||
|
||
The examples below show you how you can configure the PaymentsDS JavaScript SDK | ||
|
||
```javascript | ||
import { Client } from "@paymentsds/mpesa" | ||
|
||
const client = new Client({ | ||
apiKey: "<REPLACE>", // API Key | ||
publicKey: "<REPLACE>", // Public Key | ||
serviceProviderCode: "<REPLACE>", // input_ServiceProviderCode, | ||
initiatorIdentifier: "<REPLACE>", // input_InitiatorIdentifier, | ||
securityIdentifier: "<REPLACE>", // input_SecurityCredential | ||
timeout: "<REPLACE>", // time in seconds | ||
debugging: true, | ||
verifySSL: false, | ||
userAgent: "<REPLACE>", | ||
}) | ||
``` | ||
|
||
```javascript | ||
import { Client } from "@paymentsds/mpesa" | ||
|
||
const client = new Client({ | ||
accessToken: "<REPLACE>", // Precomputed access token | ||
serviceProviderCode: "<REPLACE>", // input_ServiceProviderCode, | ||
initiatorIdentifier: "<REPLACE>", // input_InitiatorIdentifier, | ||
securityIdentifier: "<REPLACE>", // input_SecurityCredential | ||
timeout: "<REPLACE>", // time in seconds | ||
debugging: true, | ||
verifySSL: false, | ||
userAgent: "<REPLACE>", | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
name: Installation | ||
menu: JavaScript | ||
--- | ||
|
||
You can install the JavaScript SDK using NPM or Yarn with the commands listed below: | ||
|
||
#### Using NPM | ||
|
||
```bash | ||
npm install --save @paymentsds/mpesa | ||
``` | ||
|
||
#### Using Yarn | ||
|
||
```bash | ||
yarn add @paymentsds/mpesa | ||
``` |
Oops, something went wrong.