PHPackages                             xenon/portwallet-php-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. xenon/portwallet-php-sdk

ActiveLibrary[Payment Processing](/categories/payments)

xenon/portwallet-php-sdk
========================

PortWallet payment gateway PHP SDK for APIv2

1.0.1-alpha(3y ago)081apache-2.0PHPPHP ^7.2|^7.3|^7.4|8.\*

Since Aug 8Pushed 3y agoCompare

[ Source](https://github.com/arif98741/portwallet-php-sdk)[ Packagist](https://packagist.org/packages/xenon/portwallet-php-sdk)[ RSS](/packages/xenon-portwallet-php-sdk/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (2)Versions (2)Used By (0)

PortWallet PHP SDK APIv2. This is fork repository of
 ;
-----------------------------------------------------------------------------------------------

[](#portwallet-php-sdk-apiv2-this-is-fork-repository-of--httpsgithubcomportwalletphp-sdk)

I am just forking and added support for several php versions

### Installation

[](#installation)

```
composer require xenon/portwallet-php-sdk

```

### Usage

[](#usage)

This guideline will follow [PortWallet Payment GateWay v2.0](http://developer.portwallet.com/documentation-v2.php)

```
$portWallet = new \Xenon\PortWallet\PortWalletClient($apiKey, $apiSecret);

```

#### Create an invoice

[](#create-an-invoice)

Here, `$data` is the `order payload` which is an array

Sample data example

```
use Xenon\PortWallet\Exceptions\PortWalletClientException;
use Xenon\PortWallet\PortWallet;
use Xenon\PortWallet\PortWalletClient;

/**
 *
 * $appKey: application key you have to
 * generate form our sandbox panel
 *
 * $apiSecret: application secret key
 * you have to generate form
 * our sandbox panel
 *
 */
$apiKey = "your app key";
$apiSecret = "your secret key";

/**
 * mode switching default "sandbox"
 */
PortWallet::setApiMode("live");

N.B.: API mode should be set first before creating an instance of PortWalletClient

/**
 * initiate the PortWallet client
 */
$portWallet = new PortWalletClient($apiKey, $apiSecret);

/**
 * Your data
 */
$data = array(
    'order' => array(
        'amount' => 100.0,
        'currency' => 'BDT',
        'redirect_url' => 'http://www.yoursite.com/payment',
        'ipn_url' => 'http://www.yoursite.com/ipn',
        'reference' => 'ABC123',
        'validity' => 900,
    ),
    'product' => array(
        'name' => 'x Polo T-shirt',
        'description' => 'x Polo T-shirt with shipping and handling',
    ),
    'billing' => array(
        'customer' => array(
            'name' => 'Robbie Amell',
            'email' => 'test@example.com',
            'phone' => '801234567893',
            'address' => array(
                'street' => 'House 1, Road1, Gulshan 1',
                'city' => 'Dhaka',
                'state' => 'Dhaka',
                'zipcode' => 1212,
                'country' => 'BGD',
            ),
        ),
    ),
    'discount' => array(
        'enable' => 1,
        'codes' => array(
            0 => 'Bengal 1',
            1 => 'Bengal 2',
        ),
    ),
    'emi' => [
        'enable' => 1,
        'tenures' => [],
    ]
);

try {
    $invoice = $portWallet->invoice->create($data);
    $paymentUrl = $invoice->getPaymentUrl();
} catch (InvalidArgumentException $ex) {
    echo $ex->getMessage();
}catch (PortWalletException $ex) {
    echo $ex->getMessage();
}

header("location: {$paymentUrl}");

```

#### IPN validate

[](#ipn-validate)

```
// we will send you a http post request to your IPN url
$invoiceId = $_POST['invoice'];
$amount = $_POST['amount'];

$invoice = $portWallet->invoice->ipnValidate($invoiceId, $amount);

```

#### Make a refund request

[](#make-a-refund-request)

```
$data = array (
    'refund' =>
        array (
            'amount' => 50.00,
            'reference'=>'Refund1010'
        ),
    );

$response = $portPay->invoice->makeRefundRequest($invoiceId, $data);

```

#### Retrieve an invoice

[](#retrieve-an-invoice)

```
$invoice = $portWallet->invoice->retrieve($invoiceId); // $invoiceId = 85ED8B0D14611209

PortWallet\Invoice {#304 ▼
  +invoice_id: "85ED8B0D14611209"
  +reference: "ABC123"
  +order: {#296 ▶}
  +product: {#292 ▶}
  +billing: {#297 ▶}
  +shipping: {#300 ▶}
  +customs: array:3 [▶]
}

```

#### Create a recurring

[](#create-a-recurring)

```
$data = array (
       'order' =>
           array (
               'amount' => 100.0,
               'currency' => 'BDT',
               'redirect_url' => 'http://www.yoursite.com',
               'ipn_url' => 'http://www.yoursite.com/ipn',
               'reference' => 'ABC123',
           ),
       'product' =>
           array (
               'name' => 'Order #17339988',
               'description' => 'Bangobd Membership Individual (7-day trial: BDT 5) After trail period monthly BDT 100',
           ),
       'billing' =>
           array (
               'customer' =>
                   array (
                       'name' => 'John Doe Recurr',
                       'email' => 'recurr@portonics.com',
                       'phone' => '01717451349',
                       'address' =>
                           array (
                               'street' => 'House 1, Road1, Gulshan 1',
                               'city' => 'Dhaka',
                               'state' => 'Dhaka',
                               'zipcode' => 1212,
                               'country' => 'BGD',
                           ),
                   ),
               'source' =>
                   array (
                       'id' => '8d4fd2',
                       'category' => 'card',
                   ),
           ),
       'shipping' =>
           array (
               'customer' =>
                   array (
                       'name' => 'Mr. Recurr',
                       'email' => 'recurr@portonics.com',
                       'phone' => '01717451349',
                       'address' =>
                           array (
                               'street' => 'House 1, Road1, Gulshan 1',
                               'city' => 'Dhaka',
                               'state' => 'Dhaka',
                               'zipcode' => 1212,
                               'country' => 'BGD',
                           ),
                   ),
           ),
       'recurring' =>
           array (
               'period' =>
                   array (
                       'unit' => 'monthly',
                       'prorated' => true,
                   ),
               'number_of_payment' => 6,
           ),
       );

$invoice = $portPay->recurring->create($data);

```

#### Retrieve a recurring

[](#retrieve-a-recurring)

```
$recurring = $portWallet->recurring->retrieve($invoiceId); // $invoiceId = 85EDC82FE2900875

PortWallet\Recurring {#301 ▼
  +id: "R85EDC82FE2900875"
  +status: "PENDING"
  +name: "Order #17339988"
  +description: "Bangobd Membership Individual (7-day trial: BDT 5) After trail period monthly BDT 100"
  +period: {#294 ▶}
  +has_trial: false
  +trial: {#296 ▶}
  +has_offers: false
  +offers: {#287 ▶}
  +is_prorated: true
  +payment: {#292 ▶}
  +started: "Sun, 07 Jun 2020 12:02:38 +0600"
  +ended_at: "Mon, 30 Nov 2020 23:59:59 +0600"
  +next_payment: {#291 ▶}
  +customer: {#295 ▶}
  +user_id: 0
  +source: {#297 ▶}
  +history: array:1 [▶]
}

```

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 63.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1424d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fc7bf6cacc5223cb4f56412e5510ca049755722c6c4be46c9e759500332e094b?d=identicon)[arif98741](/maintainers/arif98741)

---

Top Contributors

[![zohurul](https://avatars.githubusercontent.com/u/6093194?v=4)](https://github.com/zohurul "zohurul (19 commits)")[![arif98741](https://avatars.githubusercontent.com/u/17213478?v=4)](https://github.com/arif98741 "arif98741 (4 commits)")[![sujancse](https://avatars.githubusercontent.com/u/16623485?v=4)](https://github.com/sujancse "sujancse (4 commits)")[![zohurul-portonics](https://avatars.githubusercontent.com/u/45381719?v=4)](https://github.com/zohurul-portonics "zohurul-portonics (3 commits)")

### Embed Badge

![Health badge](/badges/xenon-portwallet-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/xenon-portwallet-php-sdk/health.svg)](https://phpackages.com/packages/xenon-portwallet-php-sdk)
```

###  Alternatives

[paycore/openfintech-data

Openfintech data

22110.1k](/packages/paycore-openfintech-data)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
