Download the PHP package stadem/viva-payments without Composer
On this page you can find all versions of the php package stadem/viva-payments. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stadem/viva-payments
More information about stadem/viva-payments
Files in stadem/viva-payments
Package viva-payments
Short Description Viva Payment package for PHP 8
License MIT
Homepage https://github.com/stadem/viva-payments
Informations about the package viva-payments
Viva Payments - Minimal Dependencies
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
- Smart Checkout Integration: Easily integrate Viva Wallet's Smart Checkout into your application.
- Webhooks: Handle Viva Wallet webhooks with minimal setup.
- API v1 & v2 Support: Compatible with both versions of the Viva Wallet API.
- Lightweight & Minimal Dependencies: Designed to be easy to install and use without unnecessary bloat.
Installation
Install the package through Composer.
This package requires PHP 8.2 + and no other dependencies.
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
And for you production
The total file config.php
Read more about API authentication on the Developer Portal: https://developer.vivawallet.com/getting-started/find-your-account-credentials/client-smart-checkout-credentials/
Usage
Full example
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' => [
Create a file and add the following code, you can switch from the vivaDEMO
to vivaProd
evn.
Additionaly you can access to token and status code by using
Create new customer
You can set the requestLang
with multiple ways by type or value.
For further details refer to src\VivaPayments\Enums\RequestLang
Create Payment order
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. https://developer.viva.com/tutorials/payments/create-a-recurring-payment/
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
The amount requested in cents is required. All the other parameters are optional. Check out the request body schema.
Run tests via PEST & PHP STAN
You can run tests via PEST with the following command
Upcoming Features
Marketplace API Support: Future updates will include support for marketplace-related API calls.
Documentation
For comprehensive documentation, please visit the Viva Wallet Developer Portal.
Contributing
Contributions are welcome! Please submit a pull request or open an issue to discuss potential changes.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Disclaimer
Note: This is an unofficial package, and its usage is at your own discretion.