Skip to main content

A command line app for interacting with Paystack's API

Project description

paystack cli

Downloads Downloads Downloads

A command line app for interacting with Paystack's API. Built with Typer and Pypaystack2

a picture of the utility in use

Installation

Binaries of paystack cli be found here. Alternatively, Paystack cli can be installed from pypi with pip as shown below.

pip install paystack-cli

First time configurations

You're required to add your paystack integration secret key as your auth_key for the cli on first use as shown below

paystack config AUTH_KEY

This sets up your paystack cli for use in development mode if the test secret key is used. This auth_key can be removed with paystack reset. Run paystack --help to see available commands

Examples

Retrieve a single transaction from your integration

paystack txn get-txns --pagination 1

Running the command above should yield a result similar to the dump shown below

Response(
    status_code=200,
    status=True,
    message='Transactions retrieved',
    data=[
        {
            'id': 3785557723,
            'domain': 'test',
            'status': 'success',
            'reference': '2769088ddc23d52947c8e845f6a6bbdebd987f457e97f71c',
            'amount': 30000,
            'message': None,
            'gateway_response': 'Approved',
            'paid_at': '2024-05-11T10:00:29.000Z',
            'created_at': '2024-05-11T10:00:27.000Z',
            'channel': 'card',
            'currency': 'NGN',
            'ip_address': None,
            'metadata': {'invoice_action': 'create'},
            'log': None,
            'fees': 450,
            'fees_split': None,
            'customer': {'id': 47948280, 'first_name': 'Gbenga', 'last_name': 'Adeyi', 'email': 'coyotedevmail@gmail.com', 'phone': '', 'metadata': None, 'customer_code': 'CUS_73cb3biedlkbe4a', 'risk_action': 'default'},
            'authorization': {
                'authorization_code': 'AUTH_w1renosr9o',
                'bin': '408408',
                'last4': '4081',
                'exp_month': '12',
                'exp_year': '2030',
                'channel': 'card',
                'card_type': 'visa ',
                'bank': 'TEST BANK',
                'country_code': 'NG',
                'brand': 'visa',
                'reusable': True,
                'signature': 'SIG_JOdryeujwrsZryg0Lkrg',
                'account_name': None
            },
            'plan': {},
            'split': {},
            'subaccount': {},
            'order_id': None,
            'paidAt': '2024-05-11T10:00:29.000Z',
            'createdAt': '2024-05-11T10:00:27.000Z',
            'requested_amount': 30000,
            'source': {'source': 'merchant_api', 'type': 'api', 'identifier': None, 'entry_point': 'charge'},
            'connect': None,
            'pos_transaction_data': None
        }
    ]
)

By default, the results you get from the cli is a Response object which is a NamedTuple returned by Pypaystack2. To get a json result, use the --json flag.

paystack txn get-txns --pagination 1 --json

Running the command above should yield a result similar to the dump shown below

[{"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": 
"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": 
"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", 
"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": 
"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}]

Source code

https://github.com/gray-adeyi/paystack-cli

Videos

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paystack_cli-0.2.1.tar.gz (142.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paystack_cli-0.2.1-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

Details for the file paystack_cli-0.2.1.tar.gz.

File metadata

  • Download URL: paystack_cli-0.2.1.tar.gz
  • Upload date:
  • Size: 142.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.6

File hashes

Hashes for paystack_cli-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8173e0c2d7bf99e749541da15f3ade6c1f0c65cbc4e1756328f684deca2aba44
MD5 cbfd0c2f9e1122cf405a6e4d71241705
BLAKE2b-256 70ef27b5266feadd3cf1091cfa5dc366ea0fa1be1ee263de8212936597b52986

See more details on using hashes here.

File details

Details for the file paystack_cli-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for paystack_cli-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99676a51a6ffd16c472a0272ed18a7fce40de0d3fac6b30bb2cd8cbac2537335
MD5 6eaebe0d04b5cd3daf5a2fa71c9db88f
BLAKE2b-256 6244832d30ba0c4553114c1cb36627c4ac920c32b770782dd05dbc8844d57ec5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page