Download the PHP package bamz3r/veritrans-php without Composer
On this page you can find all versions of the php package bamz3r/veritrans-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bamz3r/veritrans-php
More information about bamz3r/veritrans-php
Files in bamz3r/veritrans-php
Package veritrans-php
Short Description PHP Wraper for Veritrans VT-Web Payment API.
License GPL-3.0
Homepage https://veritrans.co.id
Informations about the package veritrans-php
Veritrans-PHP
Enchanced version feature:
- Compatible with PSR-4 autoload
- Fix some bug
If you want to use my version first remove the original of veritrans/veritrans-php and then add bamz3r/veritrans-php to your composer.json:
and run composer install
on your terminal.
Original README:
Veritrans is now :arrow_right: Midtrans
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:
- Snap - Customizable payment popup will appear on your web/app (no redirection)
- VT-Web - Customer need to be redirected to payment url hosted by midtrans
- Core API (VT-Direct) - Basic backend implementation, you can customize the frontend embedded on your web/app as you like (no redirection)
Choose one that you think best for your unique needs.
2.2.a Snap
You can see Snap example here.
Get Snap Token
Initialize Snap JS when customer click pay button
Implement Notification Handler
Refer to this section
2.2.b VT-Web
You can see some VT-Web examples here.
Get Redirection URL of a Charge
Implement Notification Handler
Refer to this section
2.2.c Core API (VT-Direct)
You can see some VT-Direct examples here.
Set Client Key
Checkout Page
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.