Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4613800
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:36:21+00:00 2026-05-22T01:36:21+00:00

I have a file named purchase.rb that I am using to test Activemerchant with

  • 0

I have a file named purchase.rb that I am using to test Activemerchant with Trustcommerce:

require “rubygems”
require “active_merchant”

Use the TrustCommerce test servers

ActiveMerchant::Billing::Base.mode = :test
amount = 1000

credit_card = ActiveMerchant::Billing::CreditCard.new(
             :first_name         => 'againchangeD',
             :last_name          => 'Tessdsdst',
             :number             => '4242424242424242',
             :month              => '8',
             :year               => '2012',
             :verification_value => '123'

           )


billing_address = { :address1 => '9909 Down the Road',
    :city => 'San Francisco', :state => 'CA',
    :country => 'US', :zip => '23456', :phone => '(555)555-5555'}


options = {:billing_address => billing_address}

# Validating the card automatically detects the card type

if credit_card.valid?

# Create a gateway object for the TrustCommerce service

gateway = ActiveMerchant::Billing::TrustCommerceGateway.new(
           :login => "xxxxxx",
           :password => "xxxxxx"
         )

# response = gateway.authorize(amount, credit_card)

# This is transid received from sandbox with authorize() ran before

   trans_id = 027-0004842047
   response = gateway.capture(amount,trans_id)


   if response.success?
       good = 'yes'
   puts "Successful #{good}"
   else
       puts "NO"
       raise StandardError, response.message
   end

end

I run ruby purchase.rb on the terminal and I get: Invalid octal digit because of 027-0004842047. Anybody know how to get around this? Does it make a difference if I actually build a rails app instead of running the file like this with ruby command? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:36:22+00:00Added an answer on May 22, 2026 at 1:36 am

    Stupid me…

    This solved the issue:
    trans_id = ‘027-0004842047’

    I had to treat it as a string

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file named test.txt that is like this: Test Foo Bar But
I have created a file named MyFile.db using SQLite3 from my C#.net application. This
I have a file named cmd that contains a list of Unix commands as
I have a file named A/B/SomeFile.dll that gets generated by visual studio on each
I have a file named todo.txt and I have a function that will list
I have a file that users will purchase via paypal, clickbank and paydotcom. I
I have a jar file named xyz.jar that have the file abc.xml and I
I have created a text box using xaml. I have a file named styles.xaml
I have a file named my file.pdf and I can't delete this file with
I have a file,named f1.txt, whose contents are 75 15 85 35 60 50

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.