Metadata-Version: 2.4
Name: dischub
Version: 2.1.4
Summary: A Python SDK to initiate online payment to the Dischub API
Home-page: https://dischub.co.zw/home/payment/gateway
Author: DiscHub
Author-email: 
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

## Dischub Python SDK

## Overview

The Dischub Python SDK allows developers to easily integrate with the Dischub API for online payment processing. This SDK provides a simple interface for creating payments via the Dischub API.

## Installation

You can install the Dischub SDK using pip:

```bash
pip install dischub
```

## Usage

Copy and paste code below as a function called "payment" in your functions' file

```bash
from dischub import Dischub

def payment():
    data = {
        "api_key" : "your-api-key",
        "order_id" : "your-purchase-order-id-or-number",
        "sender": "your-client's-phone-number",
        "recipient": "your-dischub-business-account-email-address",
        "amount": 100,
        "currency": "USD",
        }
    payment_instance = Dischub()
    response = payment_instance.create_payment(data)
    print(response)
payment()
```

## Success Response

If your integration is done so well, you will get the below response

```bash
{'status': 'success', 'message': 'payment initiated', 'response_code': 201}
```

## Missing Keys Response

if you miss one or more keys in the data dictionary, you will get below response

```bash
{'status': 'error', 'message': 'missing or invalid required keys', 'response_code': 400}
```

## Invalid Currency Response

if you upload currency type other than 'USD' and 'ZWG' on the currency key in the data dictionary, you will get below response

```bash
{'status': 'error', 'message': 'Invalid or unsupported currency', 'response_code': 400}
```

## Authorization Response

if use invalid api_key or you Dischub business account email on the api_key or reciepient keys respectively, you will get the below response

```bash
{'status': 'error', 'message': 'authorization failed', 'response_code': 400}
```

## Invalid Sender's Phone Number Response

If sender's phone number is invalid, you will get the below response

```bash
{'status': 'error', 'message': 'invalid sender phone number format', 'response_code': 400}
```

## Invalid Amount Range Response

If amount is out of expected range, you will get the below response

```bash
{'status': 'error', 'message': 'amount must be greater than 0 and less than 481', 'response_code': 400}
```

## Invalid order_id Data Type Response

If order_id not in string format, you will get the below response

```bash
{'status': 'error', 'message': 'order_id must be posted as string', 'response_code': 400}
```

## Duplication Of order_id Response

If same order_id is repeated, you will get the below response

```bash
{'status': 'error', 'message': 'duplication of order_id detected, create a new unique order_id again', 'response_code': 400}
```

## Invalid order_id Character Length Response

If order_id is more than 30 characters, you will get the below response

```bash
{'status': 'error', 'message': 'order_id should be 30 characters or less', 'response_code': 400}
```

## Completing Payment

The sdk will auto redirects you to the Dischub payment page for you to complete the pending payment

