PHPackages                             stadem/viva-payments - 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. stadem/viva-payments

ActiveLibrary[Payment Processing](/categories/payments)

stadem/viva-payments
====================

Viva Payment package for PHP 8

v1.0.6(1y ago)127MITPHPPHP ^8.2.0

Since Aug 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/stadem/viva-payments)[ Packagist](https://packagist.org/packages/stadem/viva-payments)[ Docs](https://github.com/stadem/viva-payments)[ RSS](/packages/stadem-viva-payments/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (4)Versions (8)Used By (0)

Viva Payments - Minimal Dependencies
====================================

[](#viva-payments---minimal-dependencies)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a3f1403ba0f1cace1e8ffe70d033855e3a4e6274cede0723a3c016a684d323da/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73746164656d2f766976612d7061796d656e74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stadem/viva-payments)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/4456a127cb138eb220463d6d8ee7780d479d7aad3ebe9d662267989bc0e60f15/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73746164656d2f766976612d7061796d656e74732f7068702e796d6c3f6272616e63683d6d6173746572)](https://github.com/stadem/viva-payments/actions)[![Code Quality](https://camo.githubusercontent.com/917d612dcfaff3a93b810e3007e66575eef8b54f1a651830d434ebc6779d2cbf/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f73746164656d2f766976612d7061796d656e74732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/stadem/viva-payments/?branch=master)[![Code Intelligence Status](https://camo.githubusercontent.com/c75ff76d7c7a3c6f9c1fd31e8a6e04db9666f1bedac9ec8dc4c0b1df3a3d44eb/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73746164656d2f766976612d7061796d656e74732f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)

[![VivaPayments logo](./assets/vw-logo.svg "Viva Wallet logo")](https://www.vivawallet.com/)

This package provides a streamlined interface for the Viva Wallet Payment API, enabling seamless integration with **Smart Checkout**, **Webhooks**, and support for both **API v1** and **API v2** calls.

Features
--------

[](#features)

- **Smart Checkout Integration**: Easily integrate Viva Wallet's Smart Checkout into your application.
- **Webhooks**: Handle Viva Wallet webhooks with minimal setup.
- **API v1 &amp; v2 Support**: Compatible with both versions of the Viva Wallet API.
- **Lightweight &amp; Minimal Dependencies**: Designed to be easy to install and use without unnecessary bloat.

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

[](#installation)

Install the package through Composer.

This package requires PHP 8.2 + and no other dependencies.

```
composer require stadem/viva-payments

```

#### Configuration

[](#configuration)

Rename `viva-config.php.example` to `viva-config.php` and add your credentials.

Add the following data on your `viva-config.php`.

And for you local environment

```
    'vivaDEMO' => [
        'VIVA_URL' => 'https://demo.vivapayments.com',
        'VIVA_ACCOUNT_URL' => 'https://demo-accounts.vivapayments.com',
        'VIVA_API_URL' => 'https://demo-api.vivapayments.com',
        'VIVA_API_KEY' => '',
        'VIVA_MERCHANT_ID' => '',
        'VIVA_SOURCE_CODE' => '',
        'VIVA_CLIENT_ID' => '',
        'VIVA_CLIENT_SECRET' => '',
        'VIVA_SMARTCHECKOUT_COLOR'=>'0d1bbd',
        'VIVA_DEBUG'=>0,
    ],
```

And for you production

```
'vivaPROD' => [
    'VIVA_URL' => 'https://www.vivapayments.com',
    'VIVA_ACCOUNT_URL' => 'https://accounts.vivapayments.com',
    'VIVA_API_URL' => 'https://api.vivapayments.com',
    'VIVA_API_KEY' => '',
    'VIVA_MERCHANT_ID' => '',
    'VIVA_SOURCE_CODE' => '',
    'VIVA_CLIENT_ID' => '',
    'VIVA_CLIENT_SECRET' => '',
    'VIVA_DEBUG'=>0,
],
```

The total file config.php

```
return [
    'curlDebug' => 0,
    'defaultProvider' => 'vivaDEMO',
    'vivaDEMO' => [
        'VIVA_URL' => 'https://demo.vivapayments.com',
        'VIVA_ACCOUNT_URL' => 'https://demo-accounts.vivapayments.com',
        'VIVA_API_URL' => 'https://demo-api.vivapayments.com',
        'VIVA_API_KEY' => 'a4bw%t%^',
        'VIVA_MERCHANT_ID' => '123456',
        'VIVA_SOURCE_CODE' => '2222',
        'VIVA_CLIENT_ID' => '123456.vivapayments.com',
        'VIVA_CLIENT_SECRET' => '123456',
        'VIVA_BANK_TRANSFER_URL_API' => 'https://demo.vivapayments.com/api/wallets/{{platformAccountId}}/commands/banktransfer/{{vendorAccountId}}',
        'VIVA_WALLET_TO_WALLET_URL_API'=>'https://demo.vivapayments.com/api/wallets/{{platformAccountId}}/balancetransfer/{{vendorAccountId}}',
        'VIVA_SMARTCHECKOUT_COLOR'=>'0d1bbd',
        'VIVA_DEBUG'=>0,
    ],

    'vivaPROD' => [
        'VIVA_URL' => 'https://www.vivapayments.com',
        'VIVA_ACCOUNT_URL' => 'https://accounts.vivapayments.com',
        'VIVA_API_URL' => 'https://api.vivapayments.com',
        'VIVA_API_KEY' => '',
        'VIVA_MERCHANT_ID' => '',
        'VIVA_SOURCE_CODE' => '',
        'VIVA_CLIENT_ID' => '',
        'VIVA_CLIENT_SECRET' => '',
        'VIVA_DEBUG'=>0
    ]
];
```

> Read more about API authentication on the Developer Portal:

Usage
-----

[](#usage)

### Full example

[](#full-example)

```
require_once __DIR__ . '/../vendor/autoload.php';
use Stadem\VivaPayments\Enums;
use Stadem\VivaPayments\Services\AccessToken;
use Stadem\VivaPayments\Request\Customer;
use Stadem\VivaPayments\Request\CreatePaymentOrder;

$requestLang = $_REQUEST['requestLang'] ?? 'Greek';

 $config = new Config();
 $accessToken = new AccessToken($config);

$customer = new Customer(
    $email = 'test@gmail.com',
    $fullName = 'Customer name',
    $phone = '+306941234567',
    $countryCode = 'GR',
    $requestLang = Enums\RequestLang::fromName($requestLang),
);

$CreatePaymentOrder  = [
    'amount'                => 120,
    'customerTrns'          => 'Test POST - No End Payment', items/services being purchased.
    'paymentTimeout'        => 1800,
    'preauth'               => false,
    'allowRecurring'        => false,
    'maxInstallments'       => 0,
    'forceMaxInstallments'  => false,
    'paymentNotification'   => true,
    'tipAmount'             => 0,
    'disableExactAmount'    => false,
    'disableCash'           => true,
    'disableWallet'         => false,
    'cardTokens'            => null, Tokens tutorial.
    'merchantTrns'          => 'This is a short description that helps you uniquely identify the transaction',
    'tags'                  => ['tag1', 'tag2']
];

$paymentMethods = [0, 8, 21, 29, 34, 35];

$paymentMethodFees  =  [
    'paymentMethodId' => '35',
    'fee' => 550
];

try {
   	$order = new CreatePaymentOrder($CreatePaymentOrder, $accessToken,$config);
    $order->setCustomer($customer);
    $order->setPaymentMethods($paymentMethods);
    $order->setPaymentMethodsFees($paymentMethodFees);

    $getOrderJson = $order->send();
    echo '';
    echo $order->getOrderCode();
    echo '';
} catch (Exception  $e) {
    echo 'An error occured: ' . $e->getMessage() . '';
}
```

### Get the Access Token

[](#get-the-access-token)

Here’s a quick example of how to get started:

To interact with the Viva Wallet API, you'll first need to obtain an access token. Here’s a quick example of how to get started:

'vivaPROD' =&gt; \[ Create a file and add the following code, you can switch from the `vivaDEMO` to `vivaProd` evn.

```
require_once __DIR__ . '/../vendor/autoload.php';
use Stadem\VivaPayments\Enums;
use Stadem\VivaPayments\Services\AccessToken;
use Stadem\VivaPayments\Request\Customer;
use Stadem\VivaPayments\Request\CreatePaymentOrder;
use Stadem\VivaPayments\Config\Config;

$config = new Config();
$accessToken = new AccessToken(); // Set the value on config file -> defaultProvider
or
$config = new Config();
$accessToken = new AccessToken(environment: 'vivaDEMO'); // By direct set, mostly for testing purposes
```

Additionaly you can access to token and status code by using

```
$Token = $accessToken->getAccessToken();
$statusCode = $accessToken->getStatusCode();
dump($Token.'-'.$statusCode);
```

### Create new customer

[](#create-new-customer)

```
$customer = new Customer(
    $email = 'test@gmail.com',
    $fullName = 'Customer name',
    $phone = '+306941234567',
    $countryCode = 'GR',
    $requestLang = Enums\RequestLang::fromName('Greek'),
);
```

You can set the `requestLang` with multiple ways by type or value. For further details refer to `src\VivaPayments\Enums\RequestLang`

```
 RequestLang::Greek
 RequestLang::from('el-GR') // by value
 RequestLang::fromName('Greek') // by name
```

### Create Payment order

[](#create-payment-order)

```
$CreatePaymentOrder  = [
    'amount'                => 120,
    'customerTrns'          => 'Test POST - No End Payment',
    'paymentTimeout'        => 1800,
    'preauth'               => false,
    'allowRecurring'        => false,
    'maxInstallments'       => 0,
    'forceMaxInstallments'  => false,
    'paymentNotification'   => true,
    'tipAmount'             => 0,
    'disableExactAmount'    => false,
    'disableCash'           => true,
    'disableWallet'         => false,
    'cardTokens'            => null, Tokens tutorial.
    'merchantTrns'          => 'This is a short description that helps you uniquely identify the transaction',
    'tags'                  => ['tag1', 'tag2']
];

	$order = new CreatePaymentOrder($CreatePaymentOrder, $accessToken,$config);

```

 **amount**
*The amount associated with this payment order \*100. Must be a positive, non-zero number*
 **customerTrns**
 *This optional parameter adds a friendly description to the payment order that you want to display to the* customer on the payment form. It should be a short description of the
 **paymentTimeout**
*By using this parameter, you can define a different life span for the Payment Order in sec*
 **preauth**
*This will hold the selected amount as unavailable (without the customer being charged) for a period of time*
 **allowRecurring**
*If this parameter is set to true, recurring payments are enabled so that the initial transaction ID can be used* for subsequent payments.
 **maxInstallments**
*The maximum number of installments that the customer can choose for this transaction*
 **forceMaxInstallments**
*If this parameter is set to true, the customer will be forced to pay with installments and with the specific number indicated in maxInstallments parameter*
 **paymentNotification**
 *If you wish to create a payment order, and then send out an email to the customer to request payment*
 **tipAmount**
*The tip value (if Applicable for the customer's purchase) which is already included in the amount of the payment* order and marked as tip
 **disableExactAmount**
*If this parameter is set to true, then any amount specified in the payment order is ignored (although still* mandatory), and the customer is asked to indicate the amount they will pay
 **disableCash** \\ *If this parameter is set to true, the customer will not have the option to pay in cash at a Viva Spot*
 **disableWallet**
*If this parameter is set to true, the customer will not have the option to pay using their Viva personal account* (wallet)
 **cardTokens**
*You can provide the card tokens you have saved on your backend for this customer. The card tokens will then be* presented to the customer on Smart Checkout to pay with. For details, view our Handle Card
 **merchantTrns**
*This can be either an ID or a short description that helps you uniquely identify the transaction in the viva* banking App
 **tags**
*You can add several tags to a transaction that will help in grouping and filtering in the viva banking App*

Create the payment order
------------------------

[](#create-the-payment-order)

The amount requested in cents is required. All the other parameters are optional. Check out the [request body schema](https://developer.vivawallet.com/apis-for-payments/payment-api/#tag/Payments/paths/~1checkout~1v2~1orders/post).

```
try {
    $order = new CreatePaymentOrder($CreatePaymentOrder, $accessToken,$config);
    $order->setCustomer($customer);
    $order->setPaymentMethods($paymentMethods);
    $order->setPaymentMethodsFees($paymentMethodFees);
    $order->send();
    $redirectUrl = $order->redirectUrl();
} catch (Exception  $e) {
    echo 'An error occured: ' . $e->getMessage() . '';
}
```

Run tests via PEST &amp; PHP STAN
---------------------------------

[](#run-tests-via-pest--php-stan)

You can run tests via PEST with the following command

```
 ./vendor/bin/pest tests/Payments

```

```
 ./vendor/bin/phpstan analyse src

```

Upcoming Features
-----------------

[](#upcoming-features)

Marketplace API Support: Future updates will include support for marketplace-related API calls.

Documentation
-------------

[](#documentation)

For comprehensive documentation, please visit the Viva Wallet Developer Portal.

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

[](#contributing)

Contributions are welcome! Please submit a pull request or open an issue to discuss potential changes.

License
-------

[](#license)

This project is licensed under the MIT License. See the LICENSE file for details.

Disclaimer
----------

[](#disclaimer)

Note: This is an unofficial package, and its usage is at your own discretion.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

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

Total

7

Last Release

606d ago

Major Versions

v0.0.1 → v1.0.12024-08-08

PHP version history (2 changes)v1.0.1PHP ^8.1.0

v1.0.5PHP ^8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3c794de592107b17d53c8d6304cc3f6e47bdd035afc836144e192620dcb34759?d=identicon)[stadem](/maintainers/stadem)

---

Top Contributors

[![stadem](https://avatars.githubusercontent.com/u/6703135?v=4)](https://github.com/stadem "stadem (13 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/stadem-viva-payments/health.svg)

```
[![Health](https://phpackages.com/badges/stadem-viva-payments/health.svg)](https://phpackages.com/packages/stadem-viva-payments)
```

###  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/braintree

Braintree gateway for Omnipay payment processing library

35558.0k3](/packages/omnipay-braintree)

PHPackages © 2026

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