# TypeError problem with active\_merchant

**URL:** <https://www.ruby-forum.com/t/typeerror-problem-with-active-merchant/226037>\
**Category:** Rails\
**Created:** [April 9, 2009, 3:36pm UTC](https://www.ruby-forum.com/t/typeerror-problem-with-active-merchant/226037 "2009-04-09T15:36:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yorkie-t](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/919ad9/32.png) [@yorkie-t](https://www.ruby-forum.com/u/yorkie-t)\
**Post date:** [April 9, 2009, 3:36pm UTC](https://www.ruby-forum.com/t/typeerror-problem-with-active-merchant/226037/1 "2009-04-09T15:36:16Z")

</div>

Hi folks

I’m doing some work on a project with active\_merchant and I keep getting  
the following error:

TypeError in CheckoutController#place\_order  
exception class/object expected

heres the piece of code from my controller that correpsonds:

[code=]@order = Order.new(params[:order])  
@order.customer\_ip = request.remote\_ip  
populate\_order

#raise “I need to know what values are being sent in the order object”  
unless  
@order.valid?  
return render :action =\> ‘index’  
flash.now[:error] = “error while placing order”  
end  
########## START of AM##########

# ActiveMerchant::Billing::Base.mode = :test #COMMENT OUT / REMOVE FOR

REAL TRANSACTIONS!

# ActiveMerchant accepts all amounts as Integer values in cents

#$10.00  
amount = @order.total  
#twodig\_year = @order.card\_expiration\_year.sub(/.\*(\d{2})$/, ‘\1’)

# twodig\_syear = @order.card\_start\_year.sub(/.\*(\d{2})$/, ‘\1’)

credit\_card = ActiveMerchant::Billing::CreditCard.new(  
:first\_name =\> @order.first\_name,  
:last\_name =\> @order.last\_name,  
:number =\> @order.card\_number,  
:month =\> @order.card\_expiration\_month,  
:year =\> @order.card\_expiration\_year,  
:start\_month =\> @order.card\_start\_month,  
:start\_year =\> @order.card\_start\_year,  
:issue\_number =\>@order.card\_issue\_no,  
:verification\_value =\>@order.card\_verification\_value  
)  
raise credit\_card.errors[/code]  
now this error message has only shown since i tried “raise  
credit\_card.errors”

can anyone help me at least get a better understanding of what is  
causing this error?

many thanks

🙂
