PHPackages                             zrkb/bancard - 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. [API Development](/categories/api)
4. /
5. zrkb/bancard

ActiveLibrary[API Development](/categories/api)

zrkb/bancard
============

A minimal implementation for Bancard API vPOS 2.0

1.1(2mo ago)193MITPHPPHP ^8.1CI passing

Since Jun 9Pushed 2mo agoCompare

[ Source](https://github.com/zrkb/bancard)[ Packagist](https://packagist.org/packages/zrkb/bancard)[ RSS](/packages/zrkb-bancard/feed)WikiDiscussions master Synced 2d ago

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

Bancard
=======

[](#bancard)

> PHP SDK for the Bancard vPOS 2.0 payment gateway API

[![CI](https://github.com/zrkb/bancard/actions/workflows/ci.yml/badge.svg)](https://github.com/zrkb/bancard/actions)[![Total Downloads](https://camo.githubusercontent.com/818eb9b00e4c657c422d5b34bb682b2c335555f90e925df45fc0bbf71713767c/68747470733a2f2f706f7365722e707567782e6f72672f7a726b622f62616e636172642f642f746f74616c2e737667)](https://packagist.org/packages/zrkb/bancard)[![Latest Stable Version](https://camo.githubusercontent.com/cd542a6d5d1fc8993b6a4846a95733942519a4b0a600391fd8f53f6206accdf1/68747470733a2f2f706f7365722e707567782e6f72672f7a726b622f62616e636172642f762f737461626c652e737667)](https://packagist.org/packages/zrkb/bancard)[![License](https://camo.githubusercontent.com/59d879d29dcd10acade787081169376c5fc8957184ca28493229d496177d34f5/68747470733a2f2f706f7365722e707567782e6f72672f7a726b622f62616e636172642f6c6963656e73652e737667)](https://packagist.org/packages/zrkb/bancard)

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

[](#installation)

**Requirements:** PHP &gt;= 8.1

```
composer require zrkb/bancard
```

Configuration
-------------

[](#configuration)

```
use Bancard\Bancard;

$bancard = new Bancard(
    publicKey: 'YOUR_PUBLIC_KEY',
    privateKey: 'YOUR_PRIVATE_KEY',
    staging: true, // optional, defaults to false
);
```

Usage
-----

[](#usage)

All operations return typed response objects with convenience methods.

### Single Buy

[](#single-buy)

```
use Bancard\Util\Currency;

$response = $bancard->singleBuy([
    'shop_process_id' => '7777777',
    'amount' => '10000.00',
    'currency' => Currency::PYG->value,
    'return_url' => 'https://app.test/return',
    'cancel_url' => 'https://app.test/cancel',
]);

if ($response->isSuccessful()) {
    $processId = $response->getProcessId();
}
```

### Single Buy (Zimple)

[](#single-buy-zimple)

```
$response = $bancard->singleBuyZimple([
    'shop_process_id' => '7777777',
    'amount' => '10000.00',
    'currency' => Currency::PYG->value,
    'return_url' => 'https://app.test/return',
    'cancel_url' => 'https://app.test/cancel',
]);
```

### Single Buy Confirm

[](#single-buy-confirm)

Generates the confirm token for the iframe callback (no HTTP request is made).

```
$response = $bancard->singleBuyConfirm([
    'shop_process_id' => '7777777',
    'amount' => '10000.00',
    'currency' => Currency::PYG->value,
]);

$token = $response->getToken();
```

### Single Buy Get Confirmation

[](#single-buy-get-confirmation)

```
$response = $bancard->singleBuyGetConfirmation([
    'shop_process_id' => '7777777',
]);

if ($response->isApproved()) {
    $code = $response->getResponseCode();
}
```

### Single Buy Rollback

[](#single-buy-rollback)

```
$response = $bancard->singleBuyRollback([
    'shop_process_id' => '7777777',
]);
```

### Register a New Card

[](#register-a-new-card)

```
$response = $bancard->cardsNew([
    'card_id' => '123',
    'user_id' => '456',
    'return_url' => 'https://app.test/return',
]);

$processId = $response->getProcessId();
```

### List User Cards

[](#list-user-cards)

```
$response = $bancard->usersCards([
    'user_id' => '456',
]);

foreach ($response->getCards() as $card) {
    echo $card->card_masked_number;
}
```

### Charge (Token-Based Payment)

[](#charge-token-based-payment)

```
$response = $bancard->charge([
    'shop_process_id' => '7777777',
    'amount' => '10000.00',
    'currency' => Currency::PYG->value,
    'alias_token' => 'card_alias_token',
]);

if ($response->isApproved()) {
    // Payment successful
}

if ($response->is3dsRedirect()) {
    // 3DS authentication required
}
```

### Delete Card

[](#delete-card)

```
$response = $bancard->deleteCard([
    'user_id' => '456',
    'alias_token' => 'card_alias_token',
]);
```

### Preauthorization Confirm

[](#preauthorization-confirm)

```
$response = $bancard->preauthorizationConfirm([
    'shop_process_id' => '7777777',
]);

if ($response->isApproved()) {
    // Preauthorization confirmed
}
```

### Billing Client Info

[](#billing-client-info)

```
$response = $bancard->billingClientInfo([
    // billing client info fields
]);

$client = $response->getClient();
```

### Billing Cancel

[](#billing-cancel)

```
$response = $bancard->billingCancel([
    'shop_process_id' => '7777777',
]);
```

Response Objects
----------------

[](#response-objects)

All responses extend `Bancard\Response\Response` and provide:

- `isSuccessful(): bool` -- checks if `status === 'success'`
- `getStatus(): ?string`
- `getMessage(): ?string` -- first message description
- `getErrorKey(): ?string` -- error key from messages
- `raw(): \stdClass` -- access the raw response data

Specialized responses add operation-specific methods (e.g., `getProcessId()`, `isApproved()`, `getCards()`).

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

[](#error-handling)

```
use Bancard\Exception\ValidationException;

try {
    $response = $bancard->singleBuy($payload);
} catch (ValidationException $e) {
    // Missing required fields
    $errors = $e->getErrors(); // ['shop_process_id', 'amount', 'currency']
}
```

Amount Formatting
-----------------

[](#amount-formatting)

```
use Bancard\Util\Amount;

$formatted = Amount::format(10000); // "10000.00"
```

Upgrading from v1
-----------------

[](#upgrading-from-v1)

See [UPGRADE.md](UPGRADE.md) for the migration guide.

Security
--------

[](#security)

If you discover any security related issues, please use the issue tracker.

Credits
-------

[](#credits)

- [Felix Ayala](http://felixaya.la)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance86

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity71

Established project with proven stability

 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 ~173 days

Recently: every ~423 days

Total

13

Last Release

76d ago

Major Versions

0.6.2 → 1.02023-02-02

PHP version history (6 changes)0.1PHP &gt;=7.0

0.2PHP &gt;=7.3

0.5PHP ^7.2.5

0.5.2PHP ^7.2.5 | ^8.0

0.6PHP ^7.3 | ^8.0

1.1PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![zrkb](https://avatars.githubusercontent.com/u/947557?v=4)](https://github.com/zrkb "zrkb (29 commits)")

---

Tags

bancardparaguayphpvposphpbancard

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/zrkb-bancard/health.svg)

```
[![Health](https://phpackages.com/badges/zrkb-bancard/health.svg)](https://phpackages.com/packages/zrkb-bancard)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[mailchimp/transactional

458.9M16](/packages/mailchimp-transactional)[resend/resend-php

Resend PHP library.

564.7M21](/packages/resend-resend-php)[mozex/anthropic-laravel

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

762.6k](/packages/scriptdevelop-whatsapp-manager)

PHPackages © 2026

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