README.md in veritrans-2.2.0 vs README.md in veritrans-2.3.0
- old
+ new
@@ -1,9 +1,9 @@
# Veritrans ruby library
Veritrans gem is the library that will help you to integrate seamlessly with
-Midtrans.
+Midtrans (formerly known as Veritrans Indonesia).
[![Gem Version](https://badge.fury.io/rb/veritrans.svg)](http://badge.fury.io/rb/veritrans)
[![Build Status](https://travis-ci.org/veritrans/veritrans-ruby.svg?branch=master)](https://travis-ci.org/veritrans/veritrans-ruby)
To see it in action, we have made 3 examples:
@@ -39,29 +39,16 @@
server_key: # your api client key
```
## STEP 1: Process credit cards
+#### Snap
-#### VT-Web
+##### Pop-up
-*If you want to use VT-Web, add `payment_type: "VTWEB"`*
+This will result in payment page being a pop-up(iframe) inside your own web page, no need redirection, similar to our [demo](http://demo.midtrans.com)
-```ruby
-@result = Veritrans.charge(
- payment_type: "VTWEB",
- transaction_details: {
- order_id: "my-unique-order-id",
- gross_amount: 100_000
- }
-)
-
-redirect_to @result.redirect_url
-```
-
-#### Snap
-
First, generate token in the back end provided with enough details as necessary
and as detailed as you wish to.
```ruby
response = Veritrans.create_widget_token(
@@ -99,14 +86,49 @@
// onError
});
});
```
-#### VT-Direct
+##### Redirection
+This will result in redirect_url, you can redirect customer to the url, payment page is securely hosted by Midtrans.
+
+```ruby
+@result = Veritrans.create_snap_redirect_url(
+ transaction_details: {
+ order_id: "my-unique-order-id",
+ gross_amount: 100_000
+ }
+)
+
+redirect_to @result.redirect_url
+```
+
+> This is similar feature as old VT-Web
+
+#### VT-Web
+
+> !!! WARNING NOTE: VT-Web is deprecated, please use [Snap](#Snap) instead, it has better previous VT-Web feature and many more improvements, including redirect_url.
+
+*If you want to use VT-Web, add `payment_type: "VTWEB"`*
+
+```ruby
+@result = Veritrans.charge(
+ payment_type: "VTWEB",
+ transaction_details: {
+ order_id: "my-unique-order-id",
+ gross_amount: 100_000
+ }
+)
+
+redirect_to @result.redirect_url
+```
+
+#### VT-Direct / Core API
+
It's little more complicated, because credit_card is sensitive data,
-you need put credit card number in our safe storage first using `veritrans.js` library, then send received token to with other payment details.
+you need put credit card number in our safe storage first using `midtrans.min.js` library, then send received token to with other payment details.
We don't want you to send credit card number to your server, especially for websites not using https.
File: "app/views/shared/_veritrans_include.erb"
@@ -225,27 +247,27 @@
if @result.success?
puts "Success"
end
```
-## STEP 2: Process not credit cards
+## STEP 2: Process non credit cards payment
-We provide many payment channels to receive money, but API is almost same.
+We provide many payment channels to accept payment, but the API call is almost the same.
-For VT-Web in only one request, and payment page will have all available payment options.
+For Snap / VT-Web in only one request, payment page will display all available payment options.
-For VT-Direct you have to specify payment method (token required only for credit card transactions).
+For Core API / VT-Direct you have to specify payment method (without get token step, credit card token required only for credit card transactions).
```ruby
@result = Veritrans.charge(
payment_type: "bank_transfer",
bank_transfer: { bank: 'permata' },
transaction_details: {
order_id: @payment.order_id,
gross_amount: @payment.amount
}
)
-puts "Please send money to account no. #{@result.permata_va_number} in bank Permata"
+puts "Please transfer fund to account no. #{@result.permata_va_number} in bank Permata"
```
See [our documentation](https://api-docs.midtrans.com/#charge-features) for other available options.