Download the PHP package veritrans/veritrans-php without Composer
On this page you can find all versions of the php package veritrans/veritrans-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download veritrans/veritrans-php
More information about veritrans/veritrans-php
Files in veritrans/veritrans-php
Package veritrans-php
Short Description PHP Wraper for Veritrans VT-Web Payment API.
License GPL-3.0
Homepage https://midtrans.com
Informations about the package veritrans-php
:warning::warning: ANNOUNCEMENT :warning::warning:
Please use the updated and composer compatible library: Midtrans PHP. For better more modern composer compatibility.
This repo still be here for archive and compatibility purpose. But it's always recommended to use the newer version Midtrans PHP.
:speaker: END OF ANNOUNCEMENT :speaker:
Veritrans-PHP
Midtrans :heart: PHP!
This is the Official PHP wrapper/library for Midtrans Payment API. Visit https://midtrans.com for more information about the product and see documentation at http://docs.midtrans.com for more technical details.
1. Installation
1.a Composer Installation
If you are using Composer, add this require line to your composer.json
file:
and run composer install
on your terminal.
1.b Manual Instalation
If you are not using Composer, you can clone or download this repository.
2. How to Use
2.1 General Settings
2.2 Choose Product/Method
We have 3 different products of payment that you can use:
- doc ref
- doc ref
- doc ref
Choose one that you think best for your unique needs.
2.2.a Snap
You can see Snap example here.
Get Snap Token
Get Snap Token in Yii2
Initialize Snap JS when customer click pay button
Implement Notification Handler
Refer to this section
~2.2.b VT-Web~
!!! VT-Web is DEPRECATED !!!
Please use Refer to this section
~You can see some VT-Web examples here.~
~Get Redirection URL of a Charge~
2.2.b Snap Redirect
You can see some Snap Redirect examples here.
Get Redirection URL of a Payment Page
Implement Notification Handler
Refer to this section
2.2.c Core API (VT-Direct)
You can see some Core API examples here.
Set Client Key
Checkout Page
Please refer to this file
Checkout Process
1. Create Transaction Details
2. Create Item Details, Billing Address, Shipping Address, and Customer Details (Optional)
3. Get Token ID from Checkout Page
4. Create Transaction Data
5. Charge
6. Handle Transaction Status
7. Implement Notification Handler
Refer to this section
2.3 Handle HTTP Notification
Create separated web endpoint (notification url) to receive HTTP POST notification callback/webhook. HTTP notification will be sent whenever transaction status is changed. Example also available here
2.4 Process Transaction
Get Transaction Status
Approve Transaction
If transaction fraud_status == CHALLENGE, you can approve the transaction from Merchant Dashboard, or API :
Cancel Transaction
You can Cancel transaction with fraud_status == CHALLENGE
, or credit card transaction with transaction_status == CAPTURE
(before it become SETTLEMENT)
Expire Transaction
You can Expire transaction with transaction_status == PENDING
(before it become SETTLEMENT or EXPIRE)
Contributing
Developing e-commerce plug-ins
There are several guides that must be taken care of when you develop new plugins.
-
Handling currency other than IDR. Veritrans
v1
andv2
currently accepts payments in Indonesian Rupiah only. As a corrolary, there is a validation on the server to check whether the item prices are in integer or not. As much as you are tempted to round-off the price, DO NOT do that! Always prepare when your system uses currencies other than IDR, convert them to IDR accordingly, and only round the price AFTER that. - Consider using the auto-sanitization feature.