33A command line app for interacting with [ Paystack's] ( https://paystack.com/ ) API. Built with
44[ Typer] ( https://typer.tiangolo.com/ ) and [ Pypaystack2] ( https://gray-adeyi.github.io/pypaystack2/ )
55
6- ![ utility in use] ( ./paystack-cli.png )
6+ ![ a picture of the utility in use] ( ./paystack-cli.png )
77
88## Installation
99
10- Binaries of paystack cli be found [ here] ( https://github.com/gray-adeyi/paystack-cli/releases/tag/v0.1.4 ) .
10+ Binaries of paystack cli be found [ here] ( https://github.com/gray-adeyi/paystack-cli/releases/tag/v0.2.0 ) .
1111Alternatively, Paystack cli can be installed from pypi with pip as shown below.
1212
1313``` bash
@@ -16,7 +16,7 @@ pip install paystack-cli
1616
1717## First time configurations
1818
19- You're required to add your paystack auth_key on first use as shown below
19+ You're required to add your paystack integration secret key as your auth_key for the cli on first use as shown below
2020
2121``` bash
2222paystack config AUTH_KEY
@@ -25,6 +25,88 @@ paystack config AUTH_KEY
2525This sets up your paystack cli for use in development mode if the test secret key is used. This auth_key can be
2626removed with ` paystack reset ` . Run ` paystack --help ` to see available commands
2727
28+ ## Examples
29+
30+ ### Retrieve a single transaction from your integration
31+
32+ ``` bash
33+ paystack txn get-txns --pagination 1
34+ ```
35+
36+ Running the command above should yield a result similar to the dump shown below
37+
38+ ``` bash
39+ Response(
40+ status_code=200,
41+ status=True,
42+ message=' Transactions retrieved' ,
43+ data=[
44+ {
45+ ' id' : 3785557723,
46+ ' domain' : ' test' ,
47+ ' status' : ' success' ,
48+ ' reference' : ' 2769088ddc23d52947c8e845f6a6bbdebd987f457e97f71c' ,
49+ ' amount' : 30000,
50+ ' message' : None,
51+ ' gateway_response' : ' Approved' ,
52+ ' paid_at' : ' 2024-05-11T10:00:29.000Z' ,
53+ ' created_at' : ' 2024-05-11T10:00:27.000Z' ,
54+ ' channel' : ' card' ,
55+ ' currency' : ' NGN' ,
56+ ' ip_address' : None,
57+ ' metadata' : {' invoice_action' : ' create' },
58+ ' log' : None,
59+ ' fees' : 450,
60+ ' fees_split' : None,
61+ ' customer' : {' id' : 47948280, ' first_name' : ' Gbenga' , ' last_name' : ' Adeyi' , ' email' : ' coyotedevmail@gmail.com' , ' phone' : ' ' , ' metadata' : None, ' customer_code' : ' CUS_73cb3biedlkbe4a' , ' risk_action' : ' default' },
62+ ' authorization' : {
63+ ' authorization_code' : ' AUTH_w1renosr9o' ,
64+ ' bin' : ' 408408' ,
65+ ' last4' : ' 4081' ,
66+ ' exp_month' : ' 12' ,
67+ ' exp_year' : ' 2030' ,
68+ ' channel' : ' card' ,
69+ ' card_type' : ' visa ' ,
70+ ' bank' : ' TEST BANK' ,
71+ ' country_code' : ' NG' ,
72+ ' brand' : ' visa' ,
73+ ' reusable' : True,
74+ ' signature' : ' SIG_JOdryeujwrsZryg0Lkrg' ,
75+ ' account_name' : None
76+ },
77+ ' plan' : {},
78+ ' split' : {},
79+ ' subaccount' : {},
80+ ' order_id' : None,
81+ ' paidAt' : ' 2024-05-11T10:00:29.000Z' ,
82+ ' createdAt' : ' 2024-05-11T10:00:27.000Z' ,
83+ ' requested_amount' : 30000,
84+ ' source' : {' source' : ' merchant_api' , ' type' : ' api' , ' identifier' : None, ' entry_point' : ' charge' },
85+ ' connect' : None,
86+ ' pos_transaction_data' : None
87+ }
88+ ]
89+ )
90+ ```
91+
92+ By default, the results you get from the cli is a ` Response ` object which is a ` NamedTuple ` returned
93+ by [ Pypaystack2] ( https://gray-adeyi.github.io/pypaystack2/ ) . To get a json result, use the ` --data-only `
94+ flag.
95+
96+ ``` bash
97+ paystack txn get-txns --pagination 1 --data-only
98+ ```
99+
100+ Running the command above should yield a result similar to the dump shown below
101+
102+ ``` bash
103+ [{" id" : 3785557723, " domain" : " test" , " status" : " success" , " reference" : " 2769088ddc23d52947c8e845f6a6bbdebd987f457e97f71c" , " amount" : 30000, " message" : null, " gateway_response" : " Approved" , " paid_at" : " 2024-05-11T10:00:29.000Z" , " created_at" :
104+ " 2024-05-11T10:00:27.000Z" , " channel" : " card" , " currency" : " NGN" , " ip_address" : null, " metadata" : {" invoice_action" : " create" }, " log" : null, " fees" : 450, " fees_split" : null, " customer" : {" id" : 47948280, " first_name" : " John" , " last_name" : " Doe" , " email" :
105+ " johndoe@example.com" , " phone" : " " , " metadata" : null, " customer_code" : " CUS_73cb3biedlkbe4a" , " risk_action" : " default" }, " authorization" : {" authorization_code" : " AUTH_w1renosr9o" , " bin" : " 408408" , " last4" : " 4081" , " exp_month" : " 12" , " exp_year" : " 2030" ,
106+ " channel" : " card" , " card_type" : " visa " , " bank" : " TEST BANK" , " country_code" : " NG" , " brand" : " visa" , " reusable" : true, " signature" : " SIG_JOdryeujwrsZryg0Lkrg" , " account_name" : null}, " plan" : {}, " split" : {}, " subaccount" : {}, " order_id" : null, " paidAt" :
107+ " 2024-05-11T10:00:29.000Z" , " createdAt" : " 2024-05-11T10:00:27.000Z" , " requested_amount" : 30000, " source" : {" source" : " merchant_api" , " type" : " api" , " identifier" : null, " entry_point" : " charge" }, " connect" : null, " pos_transaction_data" : null}]
108+ ```
109+
28110## Source code
29111
30112[ https://github.com/gray-adeyi/paystack-cli ] ( https://github.com/gray-adeyi/paystack-cli )
0 commit comments