PHPackages                             atdev/viva-php - 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. atdev/viva-php

ActiveLibrary[API Development](/categories/api)

atdev/viva-php
==============

Viva Wallet Native Checkout V2 API PHP Wrapper Library

1.0.4(4y ago)06083MITPHPPHP &gt;=5.6.0

Since May 20Pushed 4y ago1 watchersCompare

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

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

Viva Wallet Native Checkout V2 API PHP Wrapper Library
======================================================

[](#viva-wallet-native-checkout-v2-api-php-wrapper-library)

This is a wrapper for Native Checkout V2 API of Viva Wallet:

How to use
----------

[](#how-to-use)

This library is installed via [Composer](http://getcomposer.org/). You will need to require `atdev/viva-php`:

```
composer require atdev/viva-php:~1.0

```

Prerequisites
-------------

[](#prerequisites)

Complete prerequisite steps from  and obtain your `Client ID` and `Client Secret`. You'll need to set up a payment source with Native Checkout V2 as the integration method and get a `Source Code`.

Get card charge token
---------------------

[](#get-card-charge-token)

Create payment form and `Charge Token` at front end as described here: You'll need to have `Access Token` and `Base URL` at front end and you can get them as follows:

```
$baseUrl = \ATDev\Viva\Transaction\Url::getUrl("[Test Mode]"); // Test mode, default is false

$accessToken = (new \ATDev\Viva\Account\Authorization())
	->setClientId("[Client ID]") // Client ID, Provided by wallet
	->setClientSecret("[Client Secret]") // Client Secret, Provided by wallet
	->setTestMode("[Test Mode]") // Test mode, default is false, can be skipped
	->getAccessToken();
```

Now, when you have `Charge Token` you can make actual transactions.

Transactions
------------

[](#transactions)

### CHARGE

[](#charge)

```
$customer = (new \ATDev\Viva\Transaction\Customer())
	->setEmail("[Customer Email]")
	->setPhone("[Customer Phone]")
	->setFullName("[Customer Full Name]");

$transaction = (new ATDev\Viva\Transaction\Charge())
	->setClientId("[Client ID]") // Client ID, Provided by wallet
	->setClientSecret("[Client Secret]") // Client Secret, Provided by wallet
	->setTestMode("[Test Mode]") // Test mode, default is false, can be skipped
	->setSourceCode("[Source Code]") // Source code, provided by wallet
	->setAmount((int) "[Amount]") // The amount to charge in currency's smallest denomination (e.g amount in pounds x 100)
	->setInstallments((int) "[Installments]") // Installments, can be skipped if not used
	->setChargeToken("[Charge Token]") // Charge token obtained at front end
	->setCustomer($customer);

$result = $transaction->send();

if (!empty($transaction->getError())) {

	// Log the error message
	// $error = $transaction->getError();

} else {

	// Save transaction id
	// $transactionId = $result->transactionId;
}
```

### AUTHORIZATION

[](#authorization)

```
$customer = (new \ATDev\Viva\Transaction\Customer())
	->setEmail("[Customer Email]")
	->setPhone("[Customer Phone]")
	->setFullName("[Customer Full Name]");

$transaction = (new ATDev\Viva\Transaction\Authorization())
	->setClientId("[Client ID]") // Client ID, Provided by wallet
	->setClientSecret("[Client Secret]") // Client Secret, Provided by wallet
	->setTestMode("[Test Mode]") // Test mode, default is false, can be skipped
	->setSourceCode("[Source Code]") // Source code, provided by wallet
	->setAmount((int) "[Amount]") // The amount to pre-auth in currency's smallest denomination (e.g amount in pounds x 100)
	->setInstallments((int) "[Installments]") // Installments, can be skipped if not used
	->setChargeToken("[Charge Token]") // Charge token obtained at front end
	->setCustomer($customer);

$result = $transaction->send();

if (!empty($transaction->getError())) {

	// Log the error message
	// $error = $transaction->getError();

} else {

	// Save transaction id
	// $transactionId = $result->transactionId;
}
```

### CAPTURE

[](#capture)

Make sure you have recurring payments enabled in your account.

```
$transaction = (new \ATDev\Viva\Transaction\Capture())
	->setClientId("[Client ID]") // Client ID, Provided by wallet
	->setClientSecret("[Client Secret]") // Client Secret, Provided by wallet
	->setTestMode("[Test Mode]") // Test mode, default is false, can be skipped
	->setTransactionId("[Transaction ID]") // Transaction id of authorization transaction
	->setAmount((int) "[Amount]"); // The amount to capture in currency's smallest denomination (e.g amount in pounds x 100)

$result = $transaction->send();

if (!empty($transaction->getError())) {

	// Log the error message
	// $error = $transaction->getError();
} else {

	// Save transaction id
	// $transactionId = $result->transactionId;
}
```

### CANCEL

[](#cancel)

Make sure you have refunds enabled in your account.

```
$transaction = (new \ATDev\Viva\Transaction\Cancel())
	->setClientId("[Client ID]") // Client ID, Provided by wallet
	->setClientSecret("[Client Secret]") // Client Secret, Provided by wallet
	->setTestMode("[Test Mode]") // Test mode, default is false, can be skipped
	->setSourceCode("[Source Code]") // Source code, provided by wallet
	->setTransactionId("[Transaction ID]") // Transaction id of charge, authorization or capture transaction
	->setAmount((int) "[Amount]"); // The amount to refund in currency's smallest denomination (e.g amount in pounds x 100)

$result = $transaction->send();

if (!empty($transaction->getError())) {

	// Log the error message
	// $error = $transaction->getError();
} else {

	// Save transaction id
	// $transactionId = $result->transactionId;
}
```

Get charge token at backend
---------------------------

[](#get-charge-token-at-backend)

It's possible to get charge token at backend. It may be required in custom integration, more details can be found here:

```
$transaction = (new \ATDev\Viva\Transaction\ChargeToken())
	->setClientId("[Client ID]") // Client ID, Provided by wallet
	->setClientSecret("[Client Secret]") // Client Secret, Provided by wallet
	->setTestMode("[Test Mode]") // Test mode, default is false, can be skipped
	->setAmount((int) "[Amount]"); // The amount in currency's smallest denomination (e.g amount in pounds x 100)
	->setCvc("[Cvc code]") // Card cvc code
	->setNumber("[Card number]") // Card number
	->setHolderName("[Holder name]") // Card holder name
	->setExpirationYear((int) "[Expiration Year]") // Card expiration year
	->setExpirationMonth((int) "[Expiration Month]") // Card expiration month
	->setSessionRedirectUrl("[Session redirect url]"); // Url to redirect when authentication session finished

$result = $transaction->send();

if (!empty($transaction->getError())) {

	// Log the error message
	// $error = $transaction->getError();
} else {

	// Get charge token
	// $chargeToken = $result->chargeToken;
	// $redirectToACSForm = $result->redirectToACSForm;
}
```

Check for installments
----------------------

[](#check-for-installments)

Retrieve the maximum number of installments allowed on a card.

```
$transaction = (new \ATDev\Viva\Transaction\Installments())
	->setClientId("[Client ID]") // Client ID, Provided by wallet
	->setClientSecret("[Client Secret]") // Client Secret, Provided by wallet
	->setTestMode("[Test Mode]") // Test mode, default is false, can be skipped
	->setNumber("[Card number]"); // Card number

$result = $transaction->send();

if (!empty($transaction->getError())) {

	// Log the error message
	// $error = $transaction->getError();
} else {

	// Get number of installments
	// $installments = $result->maxInstallments;
}
```

Unit tests
----------

[](#unit-tests)

Tests are run by `./vendor/bin/phpunit tests`. Although the library code is designed to be compatible with `php 5.6`, testing requires `php 7.3` as minimum because of `phpunit` version `9`.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

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

Total

7

Last Release

1538d ago

Major Versions

0.2.0 → 1.0.02020-04-25

### Community

Maintainers

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

---

Top Contributors

[![alekseykuleshov](https://avatars.githubusercontent.com/u/6037974?v=4)](https://github.com/alekseykuleshov "alekseykuleshov (37 commits)")

---

Tags

apipaymentwalletcheckoutnativev2viva

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/atdev-viva-php/health.svg)

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

###  Alternatives

[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)[blocktrail/blocktrail-sdk

The BlockTrail PHP SDK, for integration of Bitcoin functionality through the BlockTrail API

4921.1k3](/packages/blocktrail-blocktrail-sdk)

PHPackages © 2026

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