NICEPay Ruby Bindings

Ruby SDK API Operation Test

Virtual Account

$ ruby sample/test-va.rb
----------------------------------------------------------------------
Virtual  Number : 7001400000000631
Description            : Payment of Invoice-7834
Reference No           : Invoice-7834
Transaction ID         : VACCTCLOSE02201606061649584906
----------------------------------------------------------------------

Card Checkout

$ ruby sample/test-card.rb
-----------------------------------------------------------------------------------------------------
Redirect Customer to   : https://www.nicepay.co.id/nicepay/api/orderInquiry.do?tXid=IONPAYTEST01201606061651114907
tXid                   : IONPAYTEST01201606061651114907
-----------------------------------------------------------------------------------------------------

Check Transaction Status

$ ruby sample/test-status.rb
----------------------------------------------------------------------
Transaction Status     : 3
Amount                 : 3000
Reference No           : Invoice-7834
Transaction ID         : VACCTCLOSE02201606061354204825
----------------------------------------------------------------------

Ruby on Rails

Add gem into Gemlock

add following line

gem 'nicepay', '~> 0.1.1'

Generate Controller

rails generate controller checkout
$ rails generate controller checkout
      create  app/controllers/checkout_controller.rb
      invoke  erb
      create    app/views/checkout
      invoke  test_unit
      create    test/controllers/checkout_controller_test.rb
      invoke  helper
      create    app/helpers/checkout_helper.rb
      invoke    test_unit
      invoke  assets
      invoke    coffee
      create      app/assets/javascripts/checkout.coffee
      invoke    scss
      create      app/assets/stylesheets/checkout.scss

Configure routes (config/routes.rb)

add following line

      resources :checkout