PHPackages                             ndenisj/longswipe-payment - 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. ndenisj/longswipe-payment

ActiveLibrary[Payment Processing](/categories/payments)

ndenisj/longswipe-payment
=========================

Official PHP plugin for Longswipe payment integration

1.0.0(1y ago)08MITPHPPHP &gt;=7.4

Since Feb 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ndenisj/longswipe-payment)[ Packagist](https://packagist.org/packages/ndenisj/longswipe-payment)[ Docs](https://github.com/ndenisj/longswipe-payment)[ RSS](/packages/ndenisj-longswipe-payment/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

Longswipe Payment PHP Integration
=================================

[](#longswipe-payment-php-integration)

A PHP plugin for integrating Longswipe payment voucher system into your application. This plugin provides simple methods to validate and process voucher payments.

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- curl extension
- json extension

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

[](#installation)

Install the package via composer:

```
composer require ndenisj/longswipe-payment
```

### Quick Start

[](#quick-start)

```
// PHP code block
use Longswipe\Payment\LongswipeClient;
use Longswipe\Payment\Exceptions\LongswipeException;

// Initialize the client
$client = new LongswipeClient('your-api-key', true); // true for sandbox, false for production

// Example parameters
$params = [
    'voucherCode' => 'VOUCHER123',
    'amount' => 1000,
    'receivingCurrencyId' => '2eedd32', // Replace with actual receiving currency ID,
    'lockPin' => '1234', // Optional
    'walletAddress' => '0x123...' // Optional
];

try {
    // Fetch voucher details
    $voucherDetails = $client->fetchVoucherDetails($params);

    // If details are okay, process the payment
    $paymentResult = $client->processVoucherPayment($params);

} catch (LongswipeException $e) {
    echo "Error: " . $e->getMessage();
    echo "Code: " . $e->getCode();
    var_dump($e->getData());
}
```

### Detailed Usage

[](#detailed-usage)

- 1. Initialize the Client

```
// For sandbox environment
$client = new LongswipeClient('your-api-key', true);

// For production environment
$client = new LongswipeClient('your-api-key', false);
```

- 2. Fetch Voucher Details

```
try {
    $params = [
        'voucherCode' => 'VOUCHER123',
        'amount' => 1000,
        'receivingCurrencyId' => '2eedd32', // Replace with actual receiving currency ID,
        'lockPin' => '1234', // Optional
        'walletAddress' => '0x123...' // Optional
    ];

    $voucherDetails = $client->fetchVoucherDetails($params);

    if ($voucherDetails['status'] === 'success') {
        // Process voucher details
        $charges = $voucherDetails['data']['charges'];
        $voucher = $voucherDetails['data']['voucher'];
    }
} catch (LongswipeException $e) {
    echo "Error: " . $e->getMessage();
    if ($e->getErrorData()) {
        print_r($e->getErrorData());
    }
}
```

- 3. Process Payment

```
try {
    $params = [
        'voucherCode' => 'VOUCHER123',
        'amount' => 1000,
        'receivingCurrencyId' => '2eedd32', // Replace with actual receiving currency ID,
        'lockPin' => '1234', // Optional
        'walletAddress' => '0x123...' // Optional
    ];

    $paymentResult = $client->processVoucherPayment($params);

    if ($paymentResult['status'] === 'success') {
        // Payment successful
        echo "Payment processed successfully!";
    }
} catch (LongswipeException $e) {
    echo "Error: " . $e->getMessage();
    if ($e->getErrorData()) {
        print_r($e->getErrorData());
    }
}
```

API Response Models
-------------------

[](#api-response-models)

### Fetch Voucher Details Response

[](#fetch-voucher-details-response)

```
{
  "code": 0,
  "data": {
    "charges": {
      "amount": 0,
      "amountInWei": 0,
      "balanceAfterCharges": 0,
      "balanceAfterChargesInWei": 0,
      "gasLimitInWei": 0,
      "gasPriceInWei": 0,
      "processingFee": 0,
      "processingFeeInWei": 0,
      "totalGasCost": 0,
      "totalGasCostAndProcessingFee": 0,
      "totalGasCostAndProcessingFeeInWei": 0,
      "totalGasCostInWei": 0
    },
    "voucher": {
      "amount": 0,
      "balance": 0,
      "code": "string",
      "createdAt": "string",
      "createdForExistingUser": true,
      "createdForMerchant": true,
      "createdForNonExistingUser": true,
      "cryptoVoucherDetails": {
        "balance": "string",
        "codeHash": "string",
        "creator": "string",
        "isRedeemed": true,
        "transactionHash": "string",
        "value": "string"
      },
      "generatedCurrency": {
        "abbrev": "string",
        "currencyType": "string",
        "id": "string",
        "image": "string",
        "isActive": true,
        "name": "string",
        "symbol": "string"
      }
    }
  },
  "message": "string",
  "status": "string"
}
```

### Process Payment Response

[](#process-payment-response)

```
{
  "code": 0,
  "message": "string",
  "status": "string"
}
```

Error Handling
--------------

[](#error-handling)

The plugin uses the `LongswipeException` class for error handling. Always wrap your API calls in try-catch blocks:

```
try {
    // Your API call here
} catch (LongswipeException $e) {
    echo "Error Code: " . $e->getCode() . "\n";
    echo "Error Message: " . $e->getMessage() . "\n";
    if ($e->getErrorData()) {
        echo "Additional Error Data: ";
        print_r($e->getErrorData());
    }
}
```

Support
-------

[](#support)

For support, please contact:

- Email:
- GitHub Issues: [Create an issue](https://github.com/ndenisj/longswipe-payment/issues)

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance40

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

509d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/85155d4b07ec44b20a3b4b7d8b516b464b03ce4ca0663b5b099e29b74b25547d?d=identicon)[denisjn](/maintainers/denisjn)

---

Top Contributors

[![ndenisj](https://avatars.githubusercontent.com/u/45005671?v=4)](https://github.com/ndenisj "ndenisj (9 commits)")

---

Tags

phppaymentvoucherlongswipe

### Embed Badge

![Health badge](/badges/ndenisj-longswipe-payment/health.svg)

```
[![Health](https://phpackages.com/badges/ndenisj-longswipe-payment/health.svg)](https://phpackages.com/packages/ndenisj-longswipe-payment)
```

###  Alternatives

[yandex-money/yandex-money-sdk-php

Yandex.Money API SDK for PHP

105168.9k2](/packages/yandex-money-yandex-money-sdk-php)[cryptonator/merchant-php-sdk

Cryptonator.com Merchant API SDK for PHP

2714.4k](/packages/cryptonator-merchant-php-sdk)[omalizadeh/laravel-multi-payment

A driver-based laravel package for online payments via multiple gateways

491.2k](/packages/omalizadeh-laravel-multi-payment)[luyadev/luya-module-payment

LUYA Payment allows you to integrate payments in a safe and fast way. The module take care of all the provider required steps (call, create, success, abort, etc.) and provides all the informations for your store.

1012.2k](/packages/luyadev-luya-module-payment)

PHPackages © 2026

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