PHPackages                             geekwalletsrl/arnipay-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. geekwalletsrl/arnipay-sdk

ActiveLibrary[Payment Processing](/categories/payments)

geekwalletsrl/arnipay-sdk
=========================

SDK for integrating with the Arnipay payment processing system

1.4.1(3mo ago)015MITPHPPHP &gt;=7.4

Since Feb 2Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/GEEKWALLETSRL/arnipay-sdk-php)[ Packagist](https://packagist.org/packages/geekwalletsrl/arnipay-sdk)[ RSS](/packages/geekwalletsrl-arnipay-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

Payment Gateway PHP SDK
=======================

[](#payment-gateway-php-sdk)

This SDK provides a simple and easy-to-use interface for integrating with our payment processing system.

You can find the full API documentation [here](https://github.com/GEEKWALLETSRL/arnipay-api).

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

[](#installation)

Install via Composer:

```
composer require geekwalletsrl/arnipay-sdk
```

Quick Start (Recommended)
-------------------------

[](#quick-start-recommended)

The easiest way to use the SDK is via the fluent interface.

```
require 'vendor/autoload.php';

use Arnipay\Arnipay;

// 1. Setup
// The third argument 'true' enables Sandbox mode automatically.
$arni = new Arnipay('CLIENT_ID', 'PRIVATE_KEY', true);

// 2. Create Payment Link
try {
    $url = $arni->payment()
        ->title('Pizza Order')
        ->amount(50000)
        ->reference('ORDER-123')
        ->description('Two large pizzas')
        ->redirect('https://site.com/thanks', 'https://site.com/oops')
        ->allow(['qr', 'card']) // Optional: restrict payment methods
        ->createUrl();

    echo "Pay here: " . $url;
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}

// 3. Get Payment Methods
try {
    $methods = $arni->getPaymentMethods();
    // Returns array: [['code' => 'qr', 'name' => 'Código QR'], ...]
    print_r($methods);
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}

// 4. Webhook Handling (webhook.php)
try {
    $arni->webhook('WEBHOOK_SECRET')->handle(function($event) {
        if ($event->isPaid()) {
            // $event->reference corresponds to the reference you set above
            Order::complete($event->reference);
        }
    });

    http_response_code(200);
} catch (Exception $e) {
    http_response_code(400);
}
```

Advanced Usage (Service Pattern)
--------------------------------

[](#advanced-usage-service-pattern)

For more control, you can use the underlying services directly.

### Initialization

[](#initialization)

```
use Arnipay\Gateway\Client;
use Arnipay\Gateway\PaymentLink;
use Arnipay\Gateway\Webhook;
use Arnipay\Gateway\Transaction;

// Initialize the client
$client = new Client(
    'your-client-id',
    'your-private-key'
);

// For sandbox:
// $client->setBaseUrl('https://sandbox-api.arnipay.com', false);
```

### Creating a Payment Link

[](#creating-a-payment-link)

```
$paymentLink = new PaymentLink($client);

try {
    $link = $paymentLink->create(
        150000, // price
        'Premium Subscription', // title
        '1 year access to all premium content', // description
        [
            'payment_methods' => ['qr', 'tigo'],
            'reference' => 'SUB-' . date('Y'),
            'approved_redirection_url' => 'https://example.com/success',
            'failed_redirection_url' => 'https://example.com/failed'
        ]
    );

    echo "Payment link created with ID: " . $link['id'] . "\n";
    echo "Payment URL: " . $link['url'] . "\n";
} catch (Arnipay\Exception\GatewayException $e) {
    echo "Error: " . $e->getMessage() . "\n";
    if ($errors = $e->getErrors()) {
        print_r($errors);
    }
}
```

### Getting a Specific Payment Link

[](#getting-a-specific-payment-link)

```
$paymentLink = new PaymentLink($client);

try {
    $link = $paymentLink->get('payment-link-uuid');

    echo "Payment link details:\n";
    echo "Title: " . $link['title'] . "\n";
    echo "Price: " . $link['price'] . "\n";
    echo "Is Paid: " . ($link['is_paid'] ? 'Yes' : 'No') . "\n";
} catch (Arnipay\Exception\GatewayException $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
```

### Managing Transactions

[](#managing-transactions)

You can inspect specific transactions and perform actions on them, such as reversals.

```
// List transactions for a specific payment link
try {
    $transactions = $arni->transaction()->list(['link_payment_id' => 123]);
    foreach ($transactions as $tx) {
        echo "Transaction ID: " . $tx['id'] . "\n";
    }
} catch (Exception $e) {
    echo "Error listing transactions: " . $e->getMessage();
}

// Get a single transaction
try {
    $tx = $arni->transaction()->get('transaction-uuid');
    print_r($tx);
} catch (Exception $e) {
    echo "Error getting transaction: " . $e->getMessage();
}

// Reverse a transaction (Refund)
try {
    $result = $arni->transaction()->reverse('transaction-uuid', 'Customer requested refund');
    echo "Reversal initiated. Status: " . $result['status'];
} catch (Arnipay\Exception\GatewayException $e) {
    echo "Reversal failed: " . $e->getMessage();
    // Check if it was because the payment method doesn't support it
    if (isset($e->getErrors()['payment_method'])) {
        echo "Payment method not supported for auto-reversal";
    }
}
```

### Handling Webhooks (Manual)

[](#handling-webhooks-manual)

The SDK exposes helpers so you do not have to wire superglobals manually:

```
$webhook = new Webhook('your-webhook-secret');

try {
    // Automatically captures method, URI, headers and body, then validates the signature.
    $event = $webhook->handleRequest();

    switch ($event['event']) {
        case 'payment.completed':
            $linkId = $event['data']['link_id'];
            $paymentId = $event['data']['payment_id'];
            $amount = $event['data']['amount'];
            // Update your database or take appropriate action
            break;

        case 'payment.failed':
            // Handle failed payment
            break;

        case 'payment.pending':
            // Handle pending payment
            break;

        case 'pending_refund':
            // Handle out-of-stock condition detected
            break;

        case 'auto_refunded':
            // Handle successful automatic refund
            break;
    }

    http_response_code(200);
    echo json_encode(['status' => 'success']);
} catch (Arnipay\Exception\GatewayException $e) {
    http_response_code($e->getStatusCode() ?: 400);
    echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
}
```

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

[](#error-handling)

The SDK throws `Arnipay\Exception\GatewayException` when an error occurs. This exception provides:

- Error message
- HTTP status code
- Validation errors (if available)

```
try {
    // SDK operation
} catch (Arnipay\Exception\GatewayException $e) {
    echo "Error: " . $e->getMessage() . "\n";
    echo "Status Code: " . $e->getStatusCode() . "\n";

    if ($errors = $e->getErrors()) {
        echo "Validation Errors:\n";
        print_r($errors);
    }
}
```

Testing
-------

[](#testing)

The project defines separate PHPUnit test suites for unit and integration tests.

- Unit tests (no external services required):

```
vendor/bin/phpunit --testsuite Unit
```

- Integration tests (require environment variables; see `tests/Integration/README.md`):

```
vendor/bin/phpunit --testsuite Integration
```

Note: Using `--testsuite` is the recommended way to exclude integration tests. If you previously used `--exclude-group=integration` and still saw integration tests run, switch to the `--testsuite` commands above.

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance87

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

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

Every ~1 days

Total

2

Last Release

94d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/95ec9f3898cf3583ca4fb6793c6e8fcdaed36e0f8f56a10b779248d8686ef809?d=identicon)[Ceneka](/maintainers/Ceneka)

---

Top Contributors

[![Ceneka](https://avatars.githubusercontent.com/u/11842166?v=4)](https://github.com/Ceneka "Ceneka (26 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/geekwalletsrl-arnipay-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/geekwalletsrl-arnipay-sdk/health.svg)](https://phpackages.com/packages/geekwalletsrl-arnipay-sdk)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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