2

I want to integrate paytm using ruby on rails for web only, now the problem is that when I fetched the values of attributes form database like MID, CUST_ID, WEBSITE, CALLBACK_URL, INDUSTRY_TYPE_ID and some others attributes, then one problem is occurring which is below.

Attributes:

paramList["WEBSITE"] = "WEBSTAGING"

Error:

invalid: Special character not allowed

enter image description here

def start_payment
    unless @paytm_keys.nil? 
      paramList = Hash.new
      paramList["MID"] =  ""
      paramList["ORDER_ID"] = "#{Time.now.to_i.to_s}"
      paramList["CUST_ID"] = "#{Time.now.to_i.to_s}"
      paramList["INDUSTRY_TYPE_ID"] = @paytm_keys.industry_type_id
      paramList["CHANNEL_ID"] = @paytm_keys.channel_id
      paramList["TXN_AMOUNT"] = @payable_amount
      paramList["MOBILE_NO"] = @paytm_keys.mobile_number
      paramList["EMAIL"] = @paytm_keys.email
      paramList["WEBSITE"] = "WEBSTAGING" 
      paramList["CALLBACK_URL"] = @paytm_keys.paytm_url
      @paramList=paramList
      puts @paramList
      @checksum_hash = generate_checksum()
      respond_to do |format|
        format.js
        format.html
      end
    else
      redirect_to new_checkout_path, alert: "Right now you don't have to pay."
    end
  end
Community
  • 1
  • 1
Suman Das
  • 301
  • 1
  • 4
  • 18
  • Can you please use updated URL, please see below details Transaction URL : https://securegw-stage.paytm.in/order/process Transaction Status URL : https://securegw-stage.paytm.in/order/status Thanks Kapil Varma – kapil varma Jan 06 '20 at 07:44

1 Answers1

1

It seems there are some special characters in one of the params you're passing in your hash. Have a look at the output of

puts @paramList

It might be helpful if you could post this in your question, but you probably want to obfuscate real credentials by perhaps substituting or removing all valid alphanumeric characters from your puts so you can give us the output of:

puts paramList.to_s.gsub(/\w/, '') 

# this should only contain non alphanumeric characters which 
# would be safe to post in your question.
lacostenycoder
  • 10,623
  • 4
  • 31
  • 48