fedapay-cli
v0.1.4
Published
A command-line tool for FedaPay
Downloads
9
Readme
fedapay-cli
A command-line tool for FedaPay
Install
$ npm install -g fedapay-cli
Update
$ fedapay update
Usage
$ npm install -g fedapay-cli
$ fedapay COMMAND
running command...
$ fedapay (-v|--version|version)
fedapay-cli/0.1.3 linux-x64 node-v14.3.0
$ fedapay --help [COMMAND]
USAGE
$ fedapay COMMAND
...
command-line tool for FedaPay
VERSION
fedapay-cli/0.1.0 linux-x64 node-v14.3.0
USAGE
$ fedapay [COMMAND]
TOPICS
customers Manage FedaPay customer ressources
events Here you can manage events
logs Manage FedaPay logs
payouts Manage FedaPay payout ressources
samples Samples integration built by FedaPay
transactions Manage FedaPay transaction ressources
COMMANDS
customers Manage FedaPay customer ressources
events Here you can manage events
help display help for fedapay
login Connect to Fedapay account
logout Logout of Fedapay account
logs Manage FedaPay logs
payouts Manage FedaPay payout ressources
profile Display current login information
samples Samples integration built by FedaPay
transactions Manage FedaPay transaction ressources
Get started
Login
To start, you need to connect your FedaPay account.
$ fedapay login
The output will look like this:
One you select your environment, you will be redirecting to the cli server page to login and select your account.
Now you are set.
Create a new transaction
$ fedapay transactions:create -d amount=2500 -d description="Sending money to mum" -d currency[iso]=XOF -d customer[email][email protected]
The output will look like this:
{
"klass": "v1/transaction",
"id": 16851,
"reference": "trx__hQ_1603111067446",
"amount": 2500,
"description": "Sending money to mum",
"callback_url": null,
"status": "pending",
"customer_id": 2568,
"currency_id": 1,
"mode": null,
"operation": "payment",
"metadata": {},
"commission": null,
"fees": null,
"fixed_commission": 0,
"amount_transferred": null,
"created_at": "2020-10-19T12:37:47.446Z",
"updated_at": "2020-10-19T12:37:47.446Z",
"approved_at": null,
"canceled_at": null,
"declined_at": null,
"refunded_at": null,
"transferred_at": null,
"deleted_at": null,
"last_error_code": null,
"custom_metadata": null,
"amount_debited": null
}
Retrieve a transaction
$ fedapay transactions:retrieve --id=16851
The output will look like this:
{
"klass": "v1/transaction",
"id": 16851,
"reference": "trx__hQ_1603111067446",
"amount": 2500,
"description": "Sending money to mum",
"callback_url": null,
"status": "pending",
"customer_id": 2568,
"currency_id": 1,
"mode": null,
"operation": "payment",
"metadata": {},
"commission": null,
"fees": null,
"fixed_commission": 0,
"amount_transferred": null,
"created_at": "2020-10-19T12:37:47.446Z",
"updated_at": "2020-10-19T12:37:47.446Z",
"approved_at": null,
"canceled_at": null,
"declined_at": null,
"refunded_at": null,
"transferred_at": null,
"deleted_at": null,
"last_error_code": null,
"custom_metadata": null,
"amount_debited": null
}
Generate a token and a payment URL
$ fedapay transactions:token --id=16851
The output will look like this:
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjE2ODUxLCJleHAiOjE2MDMxOTc3ODh9.961u7Gf5lr2LouyEGCnRN_uPP7Y4DUuRKL50M_WwVV4",
"url": "https://fpay.li/uxAga"
}
Retrive the last events
$ fedapay events:list
The output will look like this:
{
"events": [
{
"klass": "v1/event",
"id": "AXVA3Z99XcBqjxRq9dZr",
"type": "transaction.created",
"entity": "{\"id\":16851,\"transaction_key\":null,\"reference\":\"trx__hQ_1603111067446\",\"description\":\"Sending money to mum\",\"callback_url\":null,\"amount\":2500,\"items\":1,\"status\":\"pending\",\"currency_id\":1,\"customer_id\":2568,\"deleted_at\":null,\"created_at\":\"2020-10-19T12:37:47.446Z\",\"updated_at\":\"2020-10-19T12:37:47.446Z\",\"mode\":null,\"approved_at\":null,\"metadata\":{},\"canceled_at\":null,\"declined_at\":null,\"refunded_at\":null,\"transferred_at\":null,\"commission\":null,\"fees\":null,\"amount_transferred\":null,\"operation\":\"payment\",\"fixed_commission\":0,\"last_error_code\":null,\"last_error_message\":null,\"custom_metadata\":null,\"page_id\":null,\"amount_debited\":null,\"approved_partially_refunded_at\":null,\"transferred_partially_refunded_at\":null,\"lock_transfer\":false,\"receipt_url\":null}",
"object_id": 16851,
"account_id": 1370,
"created_at": "2020-10-19T12:37:47.480Z",
"updated_at": "2020-10-19T12:37:47.481Z",
"object": "transaction"
},
{
"klass": "v1/event",
"id": "AXVA1-NXXcBqjxRq9dXC",
"type": "customer.created",
"entity": "{\"id\":2568,\"firstname\":\"Jane\",\"lastname\":\"Doe\",\"email\":\"[email protected]\",\"account_id\":1370,\"deleted_at\":null,\"created_at\":\"2020-10-19T12:31:31.628Z\",\"updated_at\":\"2020-10-19T12:31:31.628Z\",\"phone_number_id\":11272}",
"object_id": 2568,
"account_id": 1370,
"created_at": "2020-10-19T12:31:31.634Z",
"updated_at": "2020-10-19T12:31:31.634Z",
"object": "customer"
}
]
}
Listen to FedaPay events
$ fedapay events --tail
Listen to FedaPay logs
$ fedapay logs --tail
Create a webhook and forward remote URL to a local URL
$ fedapay webhooks:listen --url=http://localhost:8080/webhooks
Available commands
fedapay login [parameters...]
fedapay logout
fedapay profile
fedapay customers:<operation> [parameters...]
fedapay transactions:<operation> [parameters...]
fedapay payouts:<operation> [parameters...]
fedapay events:<operation> [parameters...]
fedapay logs:<operation> [parameters...]
fedapay webhooks:<operation> [parameters...]
fedapay samples:<operation> [parameters...]