PHPackages                             first-iraqi-bank/fib-php-payment-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. first-iraqi-bank/fib-php-payment-sdk

ActiveLibrary[Payment Processing](/categories/payments)

first-iraqi-bank/fib-php-payment-sdk
====================================

SDK for integrating with the FIB payment system, enabling user authentication and payment transactions.

0.2.0(1y ago)316[2 PRs](https://github.com/First-Iraqi-Bank/fib-php-payment-sdk/pulls)MITPHPPHP ^7.4 || ^8.0CI passing

Since Jul 22Pushed 4d ago2 watchersCompare

[ Source](https://github.com/First-Iraqi-Bank/fib-php-payment-sdk)[ Packagist](https://packagist.org/packages/first-iraqi-bank/fib-php-payment-sdk)[ RSS](/packages/first-iraqi-bank-fib-php-payment-sdk/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (7)Versions (10)Used By (0)

FIB 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.

FIB Payment SDK
===============

[](#fib-payment-sdk-1)

**Table of Contents**

- [Features](#features)
- [Installation](#installation)
    - [Composer Installation](#composer-installation)
    - [Alternative Installation (Without Composer)](#alternative-installation-without-composer)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Creating a Payment](#creating-a-payment)
    - [Checking Payment Status](#checking-payment-status)
    - [Refunding a Payment](#refunding-a-payment)
    - [Cancelling a Payment](#cancelling-a-payment)
    - [Handling Payment Callbacks](#handling-payment-callbacks)
- [FIB Payment Documentation](#fib-payment-documentation)
- [Testing](#testing)
- [Contributing](#contributing)
- [License](#license)
- [Support](#support)
- [Acknowledgments](#acknowledgments)
- [Versioning](#versioning)
- [FAQ](#faq)

Features
--------

[](#features)

- **Payment Transactions**: Enable users to make payments securely through the FIB payment system, handling transactions effortlessly within your application.
- **Refund Processing**: Process refunds securely through the FIB payment system, managing transactions efficiently within your application.
- **Payment Status Checking**: Check the status of payments to ensure accurate transaction tracking.
- **Payment Cancellation**: Cancel payments securely through the FIB payment system, providing flexibility and control over payment transactions.

Installation
------------

[](#installation)

To integrate the SDK into your project, install it via Composer:

```
composer require First-Iraqi-Bank/fib-php-payment-sdk
```

Alternative Installation (Without Composer)
-------------------------------------------

[](#alternative-installation-without-composer)

If your project prefers not to use Composer for dependency management, you can manually include the FIB Payment SDK by following these steps:

- Clone the Repository: Clone the FIB Payment SDK repository directly into your project directory or any preferred location:

```
 git clone https://github.com/First-Iraqi-Bank/fib-php-payment-sdk.git
```

- Include in Your Project: Copy or move the cloned fib-php-payment-sdk directory into your project structure. You can place it wherever it suits your project best.
- Autoloading (if applicable): If your project uses autoloading, ensure that the src directory of the SDK is included in your autoloader configuration. For example, if using PSR-4 autoloading, you might add the following to your composer.json or equivalent autoloading setup:

```
{
    "autoload": {
        "psr-4": {
            "FIB\\PaymentSDK\\": "path/to/fib-php-payment-sdk/src"
        }
    }
}
```

- Usage: After including the SDK in your project, you can use its classes and functionalities directly in your PHP files.

### Notes

[](#notes)

- Ensure that the SDK repository URL () is correct and accessible.
- Manually managing dependencies may require additional effort to keep the SDK updated with the latest changes and fixes.
- Consider using Composer for managing dependencies whenever possible, as it simplifies dependency management and ensures compatibility with other packages.

### Configuration

[](#configuration)

To configure the SDK, you need to set the following environment variables:

- `FIB_API_KEY`: Your FIB payment API key.
- `FIB_API_SECRET`: Your FIB payment API secret.
- `FIB_BASE_URL`: The base URL for the FIB payment API (default: ).
- `FIB_GRANT_TYPE`: The grant type for authentication with the FIB payment API (default: client\_credentials).
- `FIB_REFUNDABLE_FOR`: The period for which transactions can be refunded (default: P7D, which stands for 7 days).
- `FIB_CURRENCY`: The currency used for transactions with the FIB payment system (default: IQD).
- `FIB_CALLBACK_URL`: The callback URL for handling payment notifications from the FIB payment system.
- `FIB_ACCOUNT`: The FIB payment account identifier.

Make sure to set these environment variables appropriately in your application's environment configuration.

### Usage of the SDK

[](#usage-of-the-sdk)

Below is a basic example of how to use the SDK:

#### Ensure Dependencies are Installed:

[](#ensure-dependencies-are-installed)

Make sure you have installed all required dependencies using Composer:

```
      composer install
```

#### Set Up Environment Variables:

[](#set-up-environment-variables)

Create a .env file in the root directory of your project and configure the necessary environment variables. Refer to the .env.example file for the required variables.

#### Create a Payment Example Usage

[](#create-a-payment-example-usage)

- To create a payment, use the createPayment method. This method will return the payment details which you can store in a database or cache for later use in other functionalities like callback URL handling, checking payment status, cancelling payment, and refunding payment.

```
