How do I include CVV in a new Credit Card?

43 views
Skip to first unread message

fatca...@yahoo.com

unread,
Mar 20, 2007, 4:19:14 PM3/20/07
to Active Merchant
I have ActiveMerchant up and running, and it works so far. But it
didn't check the CVV code. So I tried to add that in like so, but it
doesn't work. How should I add in CVV validation?

creditcard = ActiveMerchant::Billing::CreditCard.new(
:number => params[:number],
:cvv => params[:cvv],
:month => Integer(params[:exp_month]),
:year => Integer(params[:exp_year]),
:first_name => params[:first_name],
:last_name => params[:last_name],
:type => params[:card_type]
)

Cody Fauser

unread,
Mar 20, 2007, 11:42:43 PM3/20/07
to activem...@googlegroups.com
ActiveMerchant calls the cvv code the verification_value.

So, just replace :cvv with :verification_value in your sample code.
Also, by default, ActiveMerchant doesn't validate the presence of a
verification_value. If you want CreditCard#valid? to return false if
there isn't a verification value then you can set the following in
your application's configuration:

ActiveMerchant::Billing::CreditCard.require_verification_value = true


--
Cody Fauser
http://shopify.com - e-commerce done right
http://www.codyfauser.com - blog
http://www.oreilly.com/catalog/rjsrails - RJS Templates for Rails

fatca...@yahoo.com

unread,
Mar 21, 2007, 11:46:18 AM3/21/07
to Active Merchant
Thanks, I've changed "cvv" to "verification_value" and it seems to be
fine with that.

Where do I set
ActiveMerchant::Billing::CreditCard.require_verification_value =
true ? I've tried adding it in different areas, and they all cause
errors.

It seems like it should be added in "environments.rb", but when I add
it underneath "# Include your application configuration below" and run
the server, I get this error:
=> Booting WEBrick...
./script/../config/../config/environment.rb:57: undefined method
`require_ve
cation_value=' for ActiveMerchant::Billing::CreditCard:Class
(NoMethodError)

Where exactly should I put the code? I've been trying to search for
answers on this but to no avail yet...


On Mar 20, 11:42 pm, "Cody Fauser" <codyfau...@gmail.com> wrote:
> ActiveMerchant calls the cvv code the verification_value.
>
> So, just replace :cvv with :verification_value in your sample code.
> Also, by default, ActiveMerchant doesn't validate the presence of a
> verification_value. If you want CreditCard#valid? to return false if
> there isn't a verification value then you can set the following in
> your application's configuration:
>
> ActiveMerchant::Billing::CreditCard.require_verification_value = true
>

John Ward

unread,
Mar 21, 2007, 11:56:40 AM3/21/07
to activem...@googlegroups.com
make sure its after the Rails::Intializer block

fatca...@yahoo.com wrote:

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Active Merchant" group.
To post to this group, send email to activem...@googlegroups.com
To unsubscribe from this group, send email to activemerchan...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/activemerchant?hl=en
-~----------~----~----~----~------~----~------~--~---


  

--
Cengal

John Ward

Technical Director


   
Docklands Innovation Park
128-130 East Wall Road

Dublin 3 Dublin Leinster Ireland
www.cengal.com
pref cellMobile:+353.87.916.6003
workTel:+353.1.240.1324
Skype: ward.john john...@cengal.com

fatca...@yahoo.com

unread,
Mar 21, 2007, 12:02:44 PM3/21/07
to Active Merchant
It's after that block; it's at the very bottom of "environment.rb"

Is there another way to ensure that the "verification_value" is
checked? If not, does anyone know what I am doing wrong?

On Mar 21, 11:56 am, John Ward <john.w...@cengal.com> wrote:
> make sure its after the Rails::Intializer blockfa...@yahoo.comwrote:Thanks, I've changed "cvv" to "verification_value" and it seems to be fine with that. Where do I set ActiveMerchant::Billing::CreditCard.require_verification_value = true ? I've tried adding it in different areas, and they all cause errors. It seems like it should be added in "environments.rb", but when I add it underneath "# Include your application configuration below" and run the server, I get this error: => Booting WEBrick... ./script/../config/../config/environment.rb:57: undefined method `require_ve cation_value=' for ActiveMerchant::Billing::CreditCard:Class (NoMethodError) Where exactly should I put the code? I've been trying to search for answers on this but to no avail yet... On Mar 20, 11:42 pm, "Cody Fauser"<codyfau...@gmail.com>wrote:ActiveMerchant calls the cvv code the verification_value. So, just replace :cvv with :verification_value in your sample code. Also, by default, ActiveMerchant doesn't validate the presence of a verification_value. If you want CreditCard#valid? to return false if there isn't a verification value then you can set the following in your application's configuration: ActiveMerchant::Billing::CreditCard.require_verification_value = true On 3/20/07,fatcatt...@yahoo.com<fatcatt...@yahoo.com>wrote:I have ActiveMerchant up and running, and it works so far. But it didn't check the CVV code. So I tried to add that in like so, but it doesn't work. How should I add in CVV validation?creditcard = ActiveMerchant::Billing::CreditCard.new( :number => params[:number], :cvv => params[:cvv], :month => Integer(params[:exp_month]), :year => Integer(params[:exp_year]), :first_name => params[:first_name], :last_name => params[:last_name], :type => params[:card_type] )-- Cody Fauserhttp://shopify.com- e-commerce done righthttp://www.codyfauser.com- bloghttp://www.oreilly.com/catalog/rjsrails- RJS Templates for Rails>
> John Ward
>
> Technical Director Docklands Innovation Park


> 128-130 East Wall RoadDublin 3DublinLeinsterIreland
>

> www.cengal.comprefcellMobile:+353.87.916.6003workTel:+353.1.240.1324Skype: ward.john...@cengal.com
>
>
>
> smime.p7s
> 4KDownload

Cody Fauser

unread,
Mar 21, 2007, 12:03:08 PM3/21/07
to activem...@googlegroups.com
Try updating your version of ActiveMerchant.

fatca...@yahoo.com

unread,
Mar 22, 2007, 9:07:53 AM3/22/07
to Active Merchant
I have the updated version of ActiveMerchant but I am still getting
the same error. Is there a different place I can set it so it checks
the verification value?

On Mar 21, 12:03 pm, "Cody Fauser" <codyfau...@gmail.com> wrote:
> Try updating your version of ActiveMerchant.
>

> > > Cody Fauserhttp://shopify.com-e-commerce done righthttp://www.codyfauser.com-bloghttp://www.oreilly.com/catalog/rjsrails-RJS Templates for Rails

Cody Fauser

unread,
Mar 22, 2007, 10:33:53 AM3/22/07
to activem...@googlegroups.com
This is what I did:

edit config/environment.rb:

# Include your application configuration below

require 'active_merchant'


ActiveMerchant::Billing::CreditCard.require_verification_value = true

# Test in the console
$ script/console
Loading development environment.
>> ActiveMerchant::Billing::CreditCard.requires_verification_value?
=> true

Reply all
Reply to author
Forward
0 new messages