Skip to content
ofetisov edited this page Sep 27, 2016 · 6 revisions

When making a payment, there are two different scenarios that can arise.

  1. ValidationError can happen when you haven’t filled in all required fields in the model.
  2. ApiException can happen if your request is sent to the partner’s API and returns unsuccessful response. See API error messages.

It is important to handle all of the different exceptions in your code.

    begin
    # Your payment code
    rescue Judopay::ValidationError
      # There were missing or invalid fields
      puts $!
    rescue Judopay::APIError
      # Judo API exception
      puts $!
    rescue
      # A problem occurred outside the Judopay SDK
      puts $!
    end

Clone this wiki locally