PHPackages                             somosgad/laravel-payu - 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. somosgad/laravel-payu

ActiveLibrary[Payment Processing](/categories/payments)

somosgad/laravel-payu
=====================

A Laravel package to encapsulate global PayU requests

31981PHPCI failing

Since Jan 14Pushed 6y ago2 watchersCompare

[ Source](https://github.com/somosgad/laravel-payu)[ Packagist](https://packagist.org/packages/somosgad/laravel-payu)[ RSS](/packages/somosgad-laravel-payu/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

laravel-payu
============

[](#laravel-payu)

A Laravel package to encapsulate global PayU requests. More info at [PaymentsOS Docs](https://developers.paymentsos.com).

[![Total Downloads](https://camo.githubusercontent.com/0ba30c90ee74b3eac852bbf658747cbe95f25c92383e97be11a92def31962c42/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736f6d6f736761642f6c61726176656c2d706179752e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/somosgad/laravel-payu)

**Currently in development**

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

[](#installation)

Via [Composer](https://getcomposer.org)

```
composer require somosgad/laravel-payu:dev-master
```

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

[](#configuration)

### Set API variables

[](#set-api-variables)

Set your PayU configs at `.env` file

```
PAYU_APP_ID=
PAYU_ENV=
PAYU_PUBLIC_KEY=
PAYU_PRIVATE_KEY=
PAYU_PROVIDER=
```

Your `.env` file must end up looking like:

```
PAYU_APP_ID=com.foo.bar
PAYU_ENV=test
PAYU_PUBLIC_KEY=g6l2g4yn-nvgp-uiil-6fm7-d2337cegunmz
PAYU_PRIVATE_KEY=68lhkww3-lkgw-4mcc-r21m-cf8nnnx3wj2k
PAYU_PROVIDER="PayU Argentina"
```

### Export Config

[](#export-config)

```
php artisan vendor:publish --provider="SomosGAD_\LaravelPayU\LaravelPayUServiceProvider"
```

Usage
-----

[](#usage)

```
use SomosGAD_\LaravelPayU\LaravelPayU;

$payu = new LaravelPayU;
```

---

### Payment

[](#payment)

#### Create

[](#create)

```
$amount = 2000;
$currency = 'USD';
$payment = $payu->createPayment($amount, $currency);
```

---

### Create Token

[](#create-token)

```
$card_number = '4111111111111111';
$credit_card_cvv = '123';
$expiration_date = '10/29';
$holder_name = 'John Doe';
$token_type = 'credit_card';
$token = $payu->createToken(
    $card_number,
    $credit_card_cvv,
    $expiration_date,
    $holder_name,
    $token_type
);
```

### Create Authorization

[](#create-authorization)

```
$authorization = $payu->createAuthorization($payment['id'], $encrypted_cvv, $token);
```

### Create Capture

[](#create-capture)

```
$capture = $payu->createCapture($payment['id'], $payment['amount']);
```

---

### Charge

[](#charge)

#### Create Card Charge

[](#create-card-charge)

```
$charge = $payu->createCharge($payment['id'], $token);
```

#### Create Cash Charge

[](#create-cash-charge)

```
$charge = $payu->createCharge2($payment['id'], [
    'payment_method' => [
        'source_type' => 'cash',
        'type' => 'untokenized',
        'vendor' => 'COBRO_EXPRESS',
        'additional_details' => [
            'order_language' => 'en',
            'cash_payment_method_vendor' => 'COBRO_EXPRESS',
            'payment_method' => 'PSE',
            'payment_country' => 'ARG',
        ],
    ],
    'reconciliation_id' => time(),
];
```

\* Notes:

1. `order_language` is always uppercased for you;
2. Omitted `reconciliation_id` gets created;
3. Only `ARG` `payment_country` are able to create cash charges for Argentina;
4. Payments for cash charges must be created with `customer_id` set and customer must have `shipping_address` set with at least one field, otherwise, the receipt won't be printable or downloadable.

---

### Customer

[](#customer)

#### Create Customer

[](#create-customer)

##### Required Props

[](#required-props)

```
$customer = $payu->createCustomer([
    'customer_reference' => 'johntravolta18021954',
]);
```

\* Notes:

1. `customer_reference`s are unique, API won't create customers for same references. Choose something like an ID, document or anything else unique and immutable to set as `customer_reference`.
2. PayU Argentina won't print or download PDF if you haven't set customer's `shipping_address` with at least one info (like `country` or any other field).

##### Customer Sample from PayU API Docs

[](#customer-sample-from-payu-api-docs)

```
$customer = $payu->createCustomer([
    'customer_reference' => 'johntravolta18021954',
    'email' => 'john@travolta.com',
]);
```

##### Optional Props

[](#optional-props)

```
$customer = $payu->createCustomer([
    'customer_reference' => 'johntravolta18021954',
    'email' => 'john@travolta.com',
    'first_name' => 'John',
    'last_name' => 'Travolta',
    'additional_details' => [
        'extra1' => 'Info Extra 1',
        'extra2' => 'Info Extra 2',
    ],
    'shipping_address' => [
        'country' => 'ARG',
        'state' => 'TX',
        'city' => 'Customer Shipping City',
        'line1' => '10705 Old Mill Rd',
        'line2' => '10706 Young Mill Rd',
        'zip_code' => '75402-3435',
        'title' => 'Dr.',
        'first_name' => 'John',
        'last_name' => 'Travolta',
        'phone' => '23645963',
        'email' => 'john@travolta.com',
    ],
]);
```

#### Delete Customer

[](#delete-customer)

```
$customer_id = '0ab5511c-3a62-4b4b-8682-cb3c15172965';
$delete = $payu->deleteCustomer($customer_id);
```

#### Get Customer by ID

[](#get-customer-by-id)

```
$customer_id = '0ab5511c-3a62-4b4b-8682-cb3c15172965';
$customer = $payu->getCustomerById($customer_id);
```

#### Get Customers by Reference

[](#get-customers-by-reference)

```
$customer_reference = 'johntravolta18021954';
$customers = $payu->getCustomerByReference($customer_reference);
```

\* Note: `getCustomerByReference` returns an `array` not a single record like `getCustomerById`;

---

### Create Payment Method

[](#create-payment-method)

```
$payment_method = $payu->createPaymentMethod($customer['id'], $token);
```

Testing
-------

[](#testing)

```
phpunit
```

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

[](#contributing)

Feel free to contribute with anything on this package or contact us about it.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Somos GAD\_](https://github.com/somosgad)
- [Giovanni Pires da Silva](https://github.com/giovannipds)
- [Camilo Cunha de Azevedo](https://github.com/Camilotk)
- [Danner Terra](https://github.com/DannerTerra)
- [All Contributors](../../contributors)

License
-------

[](#license)

MIT. Please see the [license file](license.md) for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1820017?v=4)[G. Pires](/maintainers/giovannipds)[@giovannipds](https://github.com/giovannipds)

---

Top Contributors

[![Camilotk](https://avatars.githubusercontent.com/u/30880723?v=4)](https://github.com/Camilotk "Camilotk (9 commits)")[![DannerTerra](https://avatars.githubusercontent.com/u/12717279?v=4)](https://github.com/DannerTerra "DannerTerra (1 commits)")

---

Tags

laravellaravel-frameworklaravel-packagelaravel6paymentpayment-integrationpayment-methodspayment-modulepaymentspaymentsospayu

### Embed Badge

![Health badge](/badges/somosgad-laravel-payu/health.svg)

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

###  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)
