Voiding requests

ofetisov edited this page Jun 13, 2017 · 7 revisions

Voiding a pre-auth requires that you have the receipt_id and amount of the pre-auth transaction. Before you make a payment please check if your SDK is initialized.

Include a model

Add model inclusion to your source code:

require 'judopay/models/void'
1. Create the Void model
  # result_preauth - successful pre-authorization response
  void = Judopay::Void.new(
    :receipt_id => result_preauth.receipt_id,
    :amount => 5.01

You can check on the required fields and the format of each field in the Judopay REST API reference.

2 .Check the void result
    result_void = void.create    
    if result_void.result == 'Success'
        puts 'Void successful'
        puts 'There were some problems while processing your void'

If the void is successful, you'll receive a response Mash:

  "message"=>"Void successful",

It is also important to handle different exceptions in your code. See our Error handling section.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.