[![codecov](https://codecov.io/github/rawandahmad698/fib-python-payment-sdk/branch/main/graph/badge.svg?token=1GRCQ2FO0F)](https://codecov.io/github/rawandahmad698/fib-python-payment-sdk)
# FIB Payment SDK
The FIB Payment SDK provides seamless integration with the FIB payment system, empowering developers to streamline
payment transactions and facilitate secure refunds within their applications.
---
## Table of Contents
- [Features](#features)
- [Installation](#installation)
- [Using pip](#using-pip)
- [Alternative Installation (Without pip)](#alternative-installation-without-pip)
- [Configuration](#configuration)
- [Usage of the SDK](#usage-of-the-sdk)
- [Payment Integration Examples](#payment-integration-examples)
- [Documentation](#documentation)
- [Testing](#testing)
- [Contributing](#contributing)
- [License](#license)
- [Support](#support)
- [Acknowledgments](#acknowledgments)
- [Versioning](#versioning)
- [FAQ](#faq)
---
## Features
- **Payment Transactions**: Enable users to make payments securely through the FIB payment system.
- **Refund Processing**: Process refunds securely and efficiently.
- **Payment Status Checking**: Track the status of payments accurately.
- **Payment Cancellation**: Cancel payments securely and easily.
---
## Installation
Install the SDK using pip:
```bash
pip install fib-python-payment-sdk
```
### Alternative Installation (Without pip)
You can clone the repository and manually include the SDK in your project:
```bash
git clone https://github.com/First-Iraqi-Bank/fib-python-payment-sdk.git
```
Ensure to include the SDK directory in your Python path.
---
### Configuration
Set the following environment variables to configure the SDK:
- `FIB_API_KEY`: Your FIB payment API key.
- `FIB_API_SECRET`: Your FIB payment API secret.
- `FIB_BASE_URL`: Base URL for the FIB payment API.
- `FIB_GRANT_TYPE`: Authentication grant type (default: client_credentials).
- `FIB_REFUNDABLE_FOR`: Transaction refund period (default: P7D).
- `FIB_CURRENCY`: Transaction currency (default: IQD).
- `FIB_CALLBACK_URL`: Callback URL for handling payment notifications.
---
### Usage of the SDK
Below is a basic example of how to use the SDK to handle payment operations directly within your application.
#### Payment Operations Example
This example demonstrates how to perform common payment operations, including creating a payment, checking its status,
issuing a refund, and canceling a payment.
1. **Setup Environment Variables**:
Ensure you have loaded the necessary environment variables for the SDK.
```python
from dotenv import load_dotenv
import os
# Load environment variables from the .env file
load_dotenv()
```
2. **Full example**:
Below is a full example of how to use the SDK to handle payment operations:
```python
import asyncio
from fib_payments import FIBPaymentsClient, FIBConfig, APIError
async def main():
config = FIBConfig(
base_url="https://fib.dev.fib.iq",
client_id="your token",
client_secret="your secret"
)
# or config = FIBConfig()
async with FIBPaymentsClient(config) as client:
try:
# Create a payment
payment = await client.create_payment(100.00, description="Test payment")
payment_details = {
'fib_payment_id': payment['paymentId'],
'readable_code': payment['readableCode'],
'personal_app_link': payment['personalAppLink'],
'valid_until': payment['validUntil'],
}
print(f"Payment created: {payment_details}")
# Check payment status
status = await client.get_payment_status(payment['paymentId'])
print(f"Payment status: {status}")
# Refund the payment
refund = await client.refund_payment(payment['paymentId'])
print(f"Refund initiated: {refund}")
except APIError as e:
print(f"An API error occurred: {str(e)}")
```
---
### Documentation
For more detailed documentation, refer to
the [FIB Online Payment API Documentation](https://documenter.getpostman.com/view/18377702/UVCB93tc).
---
### Testing
Run the SDK tests using `unittest`:
```bash
python -m unittest discover -s tests -p 'test_*.py'
```
Run a specific test case:
```bash
python -m unittest tests.test_module.TestClassName
```
Run a specific test method:
```bash
python -m unittest tests.test_module.TestClassName.test_method_name
```
To run tests with custom formatting, use:
```bash
python test.py
```
---
### Contributing
Contributions are welcome! Please refer to the `CONTRIBUTING.md` for guidelines.
---
### License
This project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for details.
---
### Support
For support, contact support@fib-payment.com.
---
### Acknowledgments
Thanks to the FIB Payment development team and the `requests` library.
---
### Versioning
We follow [Semantic Versioning](https://semver.org/) for releases.
---
### FAQ
**Q: How do I get an API key for the FIB Payment system?**
A: Contact support@fib-payment.com to request an API key.
**Q: Can I use this SDK in production?**
A: Yes, but ensure it is correctly configured and tested for your environment.
Raw data
{
"_id": null,
"home_page": "https://the-gw.com/",
"name": "fib-python-payment-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.7",
"maintainer_email": null,
"keywords": "sdk, fib, payment, integration",
"author": "Gateway ICT",
"author_email": "info@the-gw.com",
"download_url": "https://files.pythonhosted.org/packages/a3/ba/a2595ab2791b8c4ceb60e66cdbf80e786ee0a8150d44cb5c76734f591799/fib-python-payment-sdk-0.1.10.tar.gz",
"platform": null,
"description": "[![codecov](https://codecov.io/github/rawandahmad698/fib-python-payment-sdk/branch/main/graph/badge.svg?token=1GRCQ2FO0F)](https://codecov.io/github/rawandahmad698/fib-python-payment-sdk)\n\n# FIB Payment SDK\n\nThe FIB Payment SDK provides seamless integration with the FIB payment system, empowering developers to streamline\npayment transactions and facilitate secure refunds within their applications.\n\n---\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n - [Using pip](#using-pip)\n - [Alternative Installation (Without pip)](#alternative-installation-without-pip)\n- [Configuration](#configuration)\n- [Usage of the SDK](#usage-of-the-sdk)\n - [Payment Integration Examples](#payment-integration-examples)\n- [Documentation](#documentation)\n- [Testing](#testing)\n- [Contributing](#contributing)\n- [License](#license)\n- [Support](#support)\n- [Acknowledgments](#acknowledgments)\n- [Versioning](#versioning)\n- [FAQ](#faq)\n\n---\n\n## Features\n\n- **Payment Transactions**: Enable users to make payments securely through the FIB payment system.\n- **Refund Processing**: Process refunds securely and efficiently.\n- **Payment Status Checking**: Track the status of payments accurately.\n- **Payment Cancellation**: Cancel payments securely and easily.\n\n---\n\n## Installation\n\nInstall the SDK using pip:\n\n```bash\npip install fib-python-payment-sdk\n```\n\n### Alternative Installation (Without pip)\n\nYou can clone the repository and manually include the SDK in your project:\n\n```bash\ngit clone https://github.com/First-Iraqi-Bank/fib-python-payment-sdk.git\n```\n\nEnsure to include the SDK directory in your Python path.\n\n---\n\n### Configuration\n\nSet the following environment variables to configure the SDK:\n\n- `FIB_API_KEY`: Your FIB payment API key.\n- `FIB_API_SECRET`: Your FIB payment API secret.\n- `FIB_BASE_URL`: Base URL for the FIB payment API.\n- `FIB_GRANT_TYPE`: Authentication grant type (default: client_credentials).\n- `FIB_REFUNDABLE_FOR`: Transaction refund period (default: P7D).\n- `FIB_CURRENCY`: Transaction currency (default: IQD).\n- `FIB_CALLBACK_URL`: Callback URL for handling payment notifications.\n\n---\n\n### Usage of the SDK\n\nBelow is a basic example of how to use the SDK to handle payment operations directly within your application.\n\n#### Payment Operations Example\n\nThis example demonstrates how to perform common payment operations, including creating a payment, checking its status,\nissuing a refund, and canceling a payment.\n\n1. **Setup Environment Variables**:\n Ensure you have loaded the necessary environment variables for the SDK.\n\n ```python\n from dotenv import load_dotenv\n import os\n\n # Load environment variables from the .env file\n load_dotenv()\n ```\n\n2. **Full example**:\n Below is a full example of how to use the SDK to handle payment operations:\n\n ```python\n import asyncio\n from fib_payments import FIBPaymentsClient, FIBConfig, APIError\n\n async def main():\n config = FIBConfig(\n base_url=\"https://fib.dev.fib.iq\",\n client_id=\"your token\",\n client_secret=\"your secret\"\n )\n\n # or config = FIBConfig()\n async with FIBPaymentsClient(config) as client:\n try:\n # Create a payment\n payment = await client.create_payment(100.00, description=\"Test payment\")\n payment_details = {\n 'fib_payment_id': payment['paymentId'],\n 'readable_code': payment['readableCode'],\n 'personal_app_link': payment['personalAppLink'],\n 'valid_until': payment['validUntil'],\n }\n print(f\"Payment created: {payment_details}\")\n\n # Check payment status\n status = await client.get_payment_status(payment['paymentId'])\n print(f\"Payment status: {status}\")\n\n # Refund the payment\n refund = await client.refund_payment(payment['paymentId'])\n print(f\"Refund initiated: {refund}\")\n\n except APIError as e:\n print(f\"An API error occurred: {str(e)}\")\n ```\n\n\n---\n\n### Documentation\n\nFor more detailed documentation, refer to\nthe [FIB Online Payment API Documentation](https://documenter.getpostman.com/view/18377702/UVCB93tc).\n\n---\n\n### Testing\n\nRun the SDK tests using `unittest`:\n\n```bash\npython -m unittest discover -s tests -p 'test_*.py'\n```\n\nRun a specific test case:\n\n```bash\npython -m unittest tests.test_module.TestClassName\n```\n\nRun a specific test method:\n\n```bash\npython -m unittest tests.test_module.TestClassName.test_method_name\n```\n\nTo run tests with custom formatting, use:\n\n```bash\npython test.py\n```\n\n---\n\n### Contributing\n\nContributions are welcome! Please refer to the `CONTRIBUTING.md` for guidelines.\n\n---\n\n### License\n\nThis project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for details.\n\n---\n\n### Support\n\nFor support, contact support@fib-payment.com.\n\n---\n\n### Acknowledgments\n\nThanks to the FIB Payment development team and the `requests` library.\n\n---\n\n### Versioning\n\nWe follow [Semantic Versioning](https://semver.org/) for releases.\n\n---\n\n### FAQ\n\n**Q: How do I get an API key for the FIB Payment system?**\n\nA: Contact support@fib-payment.com to request an API key.\n\n**Q: Can I use this SDK in production?**\n\nA: Yes, but ensure it is correctly configured and tested for your environment.\n\n\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "SDK for integrating with the FIB payment system, enabling user authentication and payment transactions.",
"version": "0.1.10",
"project_urls": {
"Homepage": "https://the-gw.com/"
},
"split_keywords": [
"sdk",
" fib",
" payment",
" integration"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c9832b3e22f5b0ce6cd5770fd4b121357b738ffeaf8d587797dcf081f58671d4",
"md5": "4264d1157916988a71373f03a877df63",
"sha256": "da8c02f051d46db80cbbb37c38cdf07131c3f2a6456c9e2b3712f40603448f06"
},
"downloads": -1,
"filename": "fib_python_payment_sdk-0.1.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4264d1157916988a71373f03a877df63",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.7",
"size": 8239,
"upload_time": "2024-11-24T08:40:41",
"upload_time_iso_8601": "2024-11-24T08:40:41.699110Z",
"url": "https://files.pythonhosted.org/packages/c9/83/2b3e22f5b0ce6cd5770fd4b121357b738ffeaf8d587797dcf081f58671d4/fib_python_payment_sdk-0.1.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a3baa2595ab2791b8c4ceb60e66cdbf80e786ee0a8150d44cb5c76734f591799",
"md5": "f58e87f19116f68daae31199b1fe95d7",
"sha256": "bf86a0ecfbe040532b355613a03b4863640eace8ff07d2f41ecab9039147ae94"
},
"downloads": -1,
"filename": "fib-python-payment-sdk-0.1.10.tar.gz",
"has_sig": false,
"md5_digest": "f58e87f19116f68daae31199b1fe95d7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.7",
"size": 10796,
"upload_time": "2024-11-24T08:40:43",
"upload_time_iso_8601": "2024-11-24T08:40:43.202512Z",
"url": "https://files.pythonhosted.org/packages/a3/ba/a2595ab2791b8c4ceb60e66cdbf80e786ee0a8150d44cb5c76734f591799/fib-python-payment-sdk-0.1.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-24 08:40:43",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "fib-python-payment-sdk"
}