easypaystack


Nameeasypaystack JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/i-wizard/easypaystack
SummaryAn easy to use python sdk for interacting with paystack
upload_time2023-10-28 23:50:57
maintainer
docs_urlNone
authorDavid Njoagwuani
requires_python
license
keywords python paystack easypaystack payment fintech transaction
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Overview
This package is aimed at helping developers interact with the paystack api easily and quickly too👌.

# Installation
Create and activate your virtual environment.
```
pip install easypaystack
```
You can also add this dependency to your requirements file.

```
pip freeze > requirements.txt
```

# Usage
Alright let's get down to business

Every call made will return a python dictionary containing a status code(2xx, 4xx)  and a **data** object.

**NOTE** whenever you import any class from the easypaystack sdk, always instantiate it with your secret key else it will raise a "MissinAuthKeyError"
*Remember to never include your **secret key** ❌ in your code, instead use environment variables like the example below*.
```py
from decouple import config

secret_key = config("PAYSTACK_SECRET")
paystack = PaystackVerification(secret_key)
```

## PAYMENTS
### Initiate Payment
Initiate a payment. This method initiates a pending transaction on paystack.
Its is advisable to also create a pending transaction using this generated reference because you'll need it to verify this transaction after it's completed on the brower.
```py
from easypaystack.payment import Payment

paystack = Payment(secret_key)
response = paystack.initiate_payment(email="david@gmail.com", kobo_amount=5000, reference="uniquers453")
```
### Verify Payment
Verify a payment. Use the reference generated during the transaction
initiation to verify this payment
```py
from easypaystack.verification import PaystackVerification

paystack = PaystackVerification(secret_key)
response = paystack.verify_payment(reference=payment_reference)
```

### Charge Authorization
This method is used in recurring payments like subscriptions or
monthly repayment.
The user's card must have been tokenized prior to using this method call.
You only tokenize a card once. 
To tokenize a card you need to use it for at least one payment transaction with minimum amount of about 100 naira then save the authorization code gotten from the payment verification response.
Charge Authorization is a one step process, this means once you call this method the user is automatically debited, you don't need the user's input to perform this.
The email address used here must be the same address used during the card tokenization
```py
from easypaystack.payment import Payment

paystack = Payment(secret_key)
response = paystack.charge_authorization(authorization_code="authorization_code", email="david@gmail.com", kobo_amount=5000, reference="uniquers453")
```

## TRANSFERS
### Create Recipient
In order to do a transfer with paystack you need to first create a the transfer recipient.
```py
from easypaystack.transfers import Transfer

paystack = Transfer(secret_key)
response = paystack.create_recipient(name="John Doe", account_number="07*******", bank_code="035")
```

### Get All Transfer Recipient
```py
from easypaystack.transfers import Transfer

paystack = Transfer(secret_key)
response = paystack.get_transfer_recipients(perPage=50, page=1)
```
### Get Single Transfer Recipient
```py
from easypaystack.transfers import Transfer

paystack = Transfer(secret_key)
response = paystack.get_single_transfer_recipient(recipient_code='')
```

### Update Transfer Recipient
```py
from easypaystack.transfers import Transfer

paystack = Transfer(secret_key)
response = paystack.update_transfer_recipient(recipient_code='', name="", email="", description="this param is optional")
```
### Update Transfer Recipient
```py
from easypaystack.transfers import Transfer

paystack = Transfer(secret_key)
response = paystack.delete_transfer_recipient(recipient_code='')
```

### Initiate Transfer

```py
response = paystack.initiate_transfer(recipient_code="", amount=9000, narration="")
```
Amount must be an instance of **int** or **float**, else a "TypeError" will be raised.

**Note**: Ensure you disable OTP from the Preferences tab on the Paystack Dashoard if you want your transfer to go instantly without the need to authorize it with an OTP.

### Verify a Transfer

```py
from easypaystack.verification import PaystackVerification

paystack = PaystackVerification(secret_key)
response = paystack.verify_transfer(reference)
```
### Get All Transfer
```py
from easypaystack.transfers import Transfer

paystack = Transfer(secret_key)
response = paystack.get_transfers(perPage=50, page=1)
```

## UTILS
#### Resolve Account Number
```py
from easypaystack.verification import PaystackVerification
```
```py
paystack = PaystackVerification(secret_key)
response = paystack.resolve_account(account_number, bank_code)
```
### Check Account balance
```py
from easypaystack.transfers import Transfer

paystack = Transfer(secret_key)
response = paystack.get_balance()
```
### Resolve Card BIN(Bank Identification Number)
```py
from easypaystack.verification import PaystackVerification

paystack = PaystackVerification(secret_key)
response = paystack.resolve_card_bin(six_digit='first_six_digit')
```

### List All Banks
```py
from easypaystack.getters import Getters

paystack = Getters(secret_key)
response = paystack.get_banks(country="nigeria", currency="NGN")
```

####Remarks
Thank you for using easypaystack, if this package has helped you, you can give it a star⭐️ on github. Should you encounter any difficulty, you can open a github issue on this repo https://github.com/i-wizard/easypaystack.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/i-wizard/easypaystack",
    "name": "easypaystack",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,paystack,easypaystack,payment,fintech,transaction",
    "author": "David Njoagwuani",
    "author_email": "njoagwuanidavid@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/64/ce/ae2ae5d0d03a15f3721569229805826ca982f2d7805477da33b87339c601/easypaystack-1.1.0.tar.gz",
    "platform": null,
    "description": "# Overview\nThis package is aimed at helping developers interact with the paystack api easily and quickly too\ud83d\udc4c.\n\n# Installation\nCreate and activate your virtual environment.\n```\npip install easypaystack\n```\nYou can also add this dependency to your requirements file.\n\n```\npip freeze > requirements.txt\n```\n\n# Usage\nAlright let's get down to business\n\nEvery call made will return a python dictionary containing a status code(2xx, 4xx)  and a **data** object.\n\n**NOTE** whenever you import any class from the easypaystack sdk, always instantiate it with your secret key else it will raise a \"MissinAuthKeyError\"\n*Remember to never include your **secret key** \u274c in your code, instead use environment variables like the example below*.\n```py\nfrom decouple import config\n\nsecret_key = config(\"PAYSTACK_SECRET\")\npaystack = PaystackVerification(secret_key)\n```\n\n## PAYMENTS\n### Initiate Payment\nInitiate a payment. This method initiates a pending transaction on paystack.\nIts is advisable to also create a pending transaction using this generated reference because you'll need it to verify this transaction after it's completed on the brower.\n```py\nfrom easypaystack.payment import Payment\n\npaystack = Payment(secret_key)\nresponse = paystack.initiate_payment(email=\"david@gmail.com\", kobo_amount=5000, reference=\"uniquers453\")\n```\n### Verify Payment\nVerify a payment. Use the reference generated during the transaction\ninitiation to verify this payment\n```py\nfrom easypaystack.verification import PaystackVerification\n\npaystack = PaystackVerification(secret_key)\nresponse = paystack.verify_payment(reference=payment_reference)\n```\n\n### Charge Authorization\nThis method is used in recurring payments like subscriptions or\nmonthly repayment.\nThe user's card must have been tokenized prior to using this method call.\nYou only tokenize a card once. \nTo tokenize a card you need to use it for at least one payment transaction with minimum amount of about 100 naira then save the authorization code gotten from the payment verification response.\nCharge Authorization is a one step process, this means once you call this method the user is automatically debited, you don't need the user's input to perform this.\nThe email address used here must be the same address used during the card tokenization\n```py\nfrom easypaystack.payment import Payment\n\npaystack = Payment(secret_key)\nresponse = paystack.charge_authorization(authorization_code=\"authorization_code\", email=\"david@gmail.com\", kobo_amount=5000, reference=\"uniquers453\")\n```\n\n## TRANSFERS\n### Create Recipient\nIn order to do a transfer with paystack you need to first create a the transfer recipient.\n```py\nfrom easypaystack.transfers import Transfer\n\npaystack = Transfer(secret_key)\nresponse = paystack.create_recipient(name=\"John Doe\", account_number=\"07*******\", bank_code=\"035\")\n```\n\n### Get All Transfer Recipient\n```py\nfrom easypaystack.transfers import Transfer\n\npaystack = Transfer(secret_key)\nresponse = paystack.get_transfer_recipients(perPage=50, page=1)\n```\n### Get Single Transfer Recipient\n```py\nfrom easypaystack.transfers import Transfer\n\npaystack = Transfer(secret_key)\nresponse = paystack.get_single_transfer_recipient(recipient_code='')\n```\n\n### Update Transfer Recipient\n```py\nfrom easypaystack.transfers import Transfer\n\npaystack = Transfer(secret_key)\nresponse = paystack.update_transfer_recipient(recipient_code='', name=\"\", email=\"\", description=\"this param is optional\")\n```\n### Update Transfer Recipient\n```py\nfrom easypaystack.transfers import Transfer\n\npaystack = Transfer(secret_key)\nresponse = paystack.delete_transfer_recipient(recipient_code='')\n```\n\n### Initiate Transfer\n\n```py\nresponse = paystack.initiate_transfer(recipient_code=\"\", amount=9000, narration=\"\")\n```\nAmount must be an instance of **int** or **float**, else a \"TypeError\" will be raised.\n\n**Note**: Ensure you disable OTP from the Preferences tab on the Paystack Dashoard if you want your transfer to go instantly without the need to authorize it with an OTP.\n\n### Verify a Transfer\n\n```py\nfrom easypaystack.verification import PaystackVerification\n\npaystack = PaystackVerification(secret_key)\nresponse = paystack.verify_transfer(reference)\n```\n### Get All Transfer\n```py\nfrom easypaystack.transfers import Transfer\n\npaystack = Transfer(secret_key)\nresponse = paystack.get_transfers(perPage=50, page=1)\n```\n\n## UTILS\n#### Resolve Account Number\n```py\nfrom easypaystack.verification import PaystackVerification\n```\n```py\npaystack = PaystackVerification(secret_key)\nresponse = paystack.resolve_account(account_number, bank_code)\n```\n### Check Account balance\n```py\nfrom easypaystack.transfers import Transfer\n\npaystack = Transfer(secret_key)\nresponse = paystack.get_balance()\n```\n### Resolve Card BIN(Bank Identification Number)\n```py\nfrom easypaystack.verification import PaystackVerification\n\npaystack = PaystackVerification(secret_key)\nresponse = paystack.resolve_card_bin(six_digit='first_six_digit')\n```\n\n### List All Banks\n```py\nfrom easypaystack.getters import Getters\n\npaystack = Getters(secret_key)\nresponse = paystack.get_banks(country=\"nigeria\", currency=\"NGN\")\n```\n\n####Remarks\nThank you for using easypaystack, if this package has helped you, you can give it a star\u2b50\ufe0f on github. Should you encounter any difficulty, you can open a github issue on this repo https://github.com/i-wizard/easypaystack.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "An easy to use python sdk for interacting with paystack",
    "version": "1.1.0",
    "project_urls": {
        "Homepage": "https://github.com/i-wizard/easypaystack"
    },
    "split_keywords": [
        "python",
        "paystack",
        "easypaystack",
        "payment",
        "fintech",
        "transaction"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5202a5f47f4f18b3c714406c8f6454b19968856b12ffa90bac7bff4dc436942f",
                "md5": "6f07f550b258e58e53c68379b270e0a3",
                "sha256": "c126cb6646e077f8163138744f090da7fc15aedf6ee757accedaac62179c0d6f"
            },
            "downloads": -1,
            "filename": "easypaystack-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6f07f550b258e58e53c68379b270e0a3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9927,
            "upload_time": "2023-10-28T23:50:56",
            "upload_time_iso_8601": "2023-10-28T23:50:56.195573Z",
            "url": "https://files.pythonhosted.org/packages/52/02/a5f47f4f18b3c714406c8f6454b19968856b12ffa90bac7bff4dc436942f/easypaystack-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "64ceae2ae5d0d03a15f3721569229805826ca982f2d7805477da33b87339c601",
                "md5": "cff338f376b7ee65d56237b6b9a0c508",
                "sha256": "829be2dd82b7a7c7ed66d3ea9e149d74fe5323fe503f3596b76b96837eb49d91"
            },
            "downloads": -1,
            "filename": "easypaystack-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cff338f376b7ee65d56237b6b9a0c508",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9473,
            "upload_time": "2023-10-28T23:50:57",
            "upload_time_iso_8601": "2023-10-28T23:50:57.926030Z",
            "url": "https://files.pythonhosted.org/packages/64/ce/ae2ae5d0d03a15f3721569229805826ca982f2d7805477da33b87339c601/easypaystack-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-28 23:50:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "i-wizard",
    "github_project": "easypaystack",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "easypaystack"
}
        
Elapsed time: 0.13485s