How to use Relay Response URL in Authorize.NET in Ruby

284 views Asked by At

am currently working on integrating my sample site with Authorize.NET.

So I created a Sandbox account in Authorize.NET.

Using this test account, I am testing DPM and using Relay Response URL.

I have Public IP

I am setting the x_relay_response="TRUE"; x_relay_url="http://182.180.157.5:3000/payments/relay_response";

Controller

class PaymentsController < ApplicationController

layout 'authorize_net'
helper :authorize_net
protect_from_forgery :except => :relay_response

# GET
# Displays a payment form.
def payment
   @amount = 125.00
   @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :relay_response => true, :relay_url => "http://182.180.157.5:3000/payments/relay_response")
end

# POST
# Returns relay response when Authorize.Net POSTs to us.
def relay_response
   puts "In Relay Response"
   puts "Params: #{params}"
   sim_response = AuthorizeNet::SIM::Response.new(params)
   if sim_response.success?(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['merchant_hash_value'])
     render :text => sim_response.direct_post_reply("http://182.180.157.5:3000/payments/receipt", :include => true)
  else
      render
  end
end

# GET
# Displays a receipt.
def receipt
    @auth_code = params[:x_auth_code]
end

end

Getting This Error

An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card.

  This transaction has been approved.

It is advisable for you to contact the merchant to verify that you will receive the product or service.

Any Solution For This

0

There are 0 answers