PHPackages                             josebobadillac/laravel-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. josebobadillac/laravel-bancard

ActiveLibrary[API Development](/categories/api)

josebobadillac/laravel-bancard
==============================

This project has been created to facilitate Bancard API integrations

118PHP

Since Nov 19Pushed 5mo agoCompare

[ Source](https://github.com/josebobadillac/laravel-bancard)[ Packagist](https://packagist.org/packages/josebobadillac/laravel-bancard)[ RSS](/packages/josebobadillac-laravel-bancard/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Bancard
===============

[](#laravel-bancard)

Este proyecto es un fork del paquete original [mancoide/laravel-bancard](https://github.com/mancoide/laravel-bancard) creado por Henry Gonzalez.

Créditos
--------

[](#créditos)

- **Autor original:** Henry Gonzalez ([mancoide](https://github.com/mancoide))
- **Fork y modificaciones:** José Bobadilla ([josebobadillac](https://github.com/josebobadillac))

Cambios realizados
------------------

[](#cambios-realizados)

- Soporte agregado para Laravel 11 y 12 (versión dev).
- Actualización del namespace y proveedor de servicio para uso personal.
- Ajustes en composer.json para compatibilidad con PHP 8.2+.

Licencia
--------

[](#licencia)

Este proyecto se distribuye bajo licencia MIT, igual que el original.

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

[](#installation)

Install via composer

```
composer require josebobadillac/laravel-bancard:dev-main
```

Publish config and migrations

```
php artisan vendor:publish --provider="josebobadillac\Bancard\BancardServiceProvider" --tag="bancard-configs"
php artisan vendor:publish --provider="josebobadillac\Bancard\BancardServiceProvider" --tag="bancard-migrations"
```

This is the contents of the file which will be published at config/bancard.php:

```
return [

    /*
    |--------------------------------------------------------------------------
    | Bancard Keys
    |--------------------------------------------------------------------------
    |
    | The Bancard public key and private key give you access to Bancard's
    | API.
    |
    */
    'public' => env('BANCARD_PUBLIC_KEY', ''),

    'private' => env('BANCARD_PRIVATE_KEY', ''),

    /*
    |--------------------------------------------------------------------------
    | Bancard Environment
    |--------------------------------------------------------------------------
    |
    | This value determines if your application is using the
    | staging environment from Bancard's API.
    |
    */
    'staging' => (bool) env('BANCARD_STAGING', true),

    /*
    |--------------------------------------------------------------------------
    | Bancard URL
    |--------------------------------------------------------------------------
    */

    // The return URL for the Single Buy Operation
    'single_buy_return_url' => env('BANCARD_SINGLE_BUY_RETURN_URL', ''),

    // The cancel URL for the Single Buy Operation
    'single_buy_cancel_url' => env('BANCARD_SINGLE_BUY_CANCEL_URL', ''),

    // The return URL for the New Card Operation
    'new_card_return_url' => env('BANCARD_NEW_CARD_RETURN_URL', ''),
];
```

Run migrations

```
php artisan migrate

```

Usage
-----

[](#usage)

The methods listed below return an instance of the class [Illuminate\\Http\\Client\\Response](https://laravel.com/api/8.x/Illuminate/Http/Client/Response.html).

- [singleBuy](#single-buy)
- [newCard](#cards-new)
- [listCards](#users-cards)
- [deleteCard](#delete)
- [tokenCharge](#charge)
- [confirmation](#single-buy-get-confirmation)
- [rollback](#single-buy-rollback)

According to [Laravel Documentation](https://laravel.com/docs/8.x/http-client) these are some of the methods you can use to inspect the response.

```
// Get the body of the response.
$response->body() : string;

// Get the JSON decoded body of the response as an array or scalar value.
$response->json() : array|mixed;

// Determine if the status code is >= 200 and < 300...
$response->successful();

// Determine if the status code is >= 400...
$response->failed();
```

### Single Buy

[](#single-buy)

Start the payment process.

```
use josebobadillac\Bancard\Bancard;

$response = Bancard::singleBuy('Ejemplo de pago', 10330.00);
if ($response->failed()) {
	// Do something here.
}
$data = $response->json();
$processId = $data['process_id'];
$scriptUrl = Bancard::scriptUrl();

return view('your_view_here', compact('processId', 'scriptUrl'));
```

Through the `singleBuy` method an eloquent model called `SingleBuy` is created. You can retrieve the record using the `process_id` value.

```
use josebobadillac\Bancard\Models\SingleBuy;

$order = SingleBuy::where('process_id', '')->first();
```

### Cards New

[](#cards-new)

Start the registration process of a card.

```
use josebobadillac\Bancard\Bancard;

$response = Bancard::newCard(966389, '09********', 'user@example.com');
if ($response->failed()) {
	// Do something here.
}
$data = $response->json();
$processId = $data['process_id'];
$scriptUrl = Bancard::scriptUrl();

return view('your_view_here', compact('processId', 'scriptUrl'));
```

Through the `newCard` method an eloquent model called `Card` is created. You can retrieve all the cards from an user with the `user_id` value;

```
use josebobadillac\Bancard\Models\Card;

$cards = Card::where('user_id', '')->get();
```

### Users Cards

[](#users-cards)

Operation that allow you to list the cards registered from an user.

```
use josebobadillac\Bancard\Bancard;

$response = Bancard::listCards(966389);
if ($response->failed()) {
	// Do something here.
}
$data = $response->json();
$cards = $data['cards'];
```

### Delete

[](#delete)

Operation that allow you to delete a registered card.

```
use josebobadillac\Bancard\Bancard;

$response = Bancard::deleteCard(966389, 'c8996fb92427ae41e4649b934ca495991b7852b855');
if ($response->failed()) {
	// Do something here.
}
$data = $response->json();
$status = $data['status'];
```

### Charge

[](#charge)

Operation that allow you to make a payment with a token.

```
use josebobadillac\Bancard\Bancard;

$response = Bancard::tokenCharge('Ejemplo de pago', 10330.00, 'c8996fb92427ae41e4649b934ca495991b7852b855');
if ($response->failed()) {
	// Do something here.
}
$data = $response->json();
$confirmation = $data['confirmation'];
```

Through the `tokenCharge` method two eloquent models are created. These models are `SingleBuy` and `Confirmation`. You can retrieve each record with the `shop_process_id` value that comes in the response.

```
use josebobadillac\Bancard\Models\{SingleBuy, Confirmation};

$order = SingleBuy::where('shop_process_id', '')->first();
$confirmation = Confirmation::where('shop_process_id', '')->first();
```

### Single Buy Rollback

[](#single-buy-rollback)

Operation that allow you to cancel the payment.

```
use josebobadillac\Bancard\Bancard;

$response = Bancard::rollback('12313');
if ($response->failed()) {
	// Do something here.
}
$data = $response->json();
$status = $data['status'];
```

Through the `rollback` method an eloquent model called `Rollback` is created. You can retrieve the record using the `shop_process_id` value.

```
use josebobadillac\Bancard\Models\Rollback;

$record = Rollback::where('shop_process_id', '')->first();
```

### Single Buy Get Confirmation

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

Operation that allow you to know if a payment was confirmed or not.

```
use josebobadillac\Bancard\Bancard;

$response = Bancard::confirmation('12313');
if ($response->failed()) {
	// Do something here.
}
$data = $response->json();
$confirmation = $data['confirmation'];
```

Through the `confirmation` method an eloquent model called `Confirmation` is created. You can retrieve the record using the `shop_process_id` value.

```
use josebobadillac\Bancard\Models\Confirmation;

$record = Confirmation::where('shop_process_id', '')->first();
```

Credits
-------

[](#credits)

- [Henry Gonzalez](https://github.com/josebobadillac)

License
-------

[](#license)

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

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance48

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/93013e878de6da991e5a5776f519f3344e62ef9c85840fdedba2294cbfb2593e?d=identicon)[josebobadillac](/maintainers/josebobadillac)

![](https://www.gravatar.com/avatar/9a86964234d2e03b988a06bdc859f09f3e5b2628034685e6ce2659bfe2027913?d=identicon)[rodrigoRIDB](/maintainers/rodrigoRIDB)

---

Top Contributors

[![Mancoide](https://avatars.githubusercontent.com/u/99782073?v=4)](https://github.com/Mancoide "Mancoide (5 commits)")[![rodrigoRIDB](https://avatars.githubusercontent.com/u/57151073?v=4)](https://github.com/rodrigoRIDB "rodrigoRIDB (5 commits)")[![josebobadillac](https://avatars.githubusercontent.com/u/43726611?v=4)](https://github.com/josebobadillac "josebobadillac (3 commits)")

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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