Search code examples
ruby-on-railsruby-on-rails-4payment-gatewaystripe-paymentsstripe-connect

Verify CVC code before creating charge


I'm trying to check the user entered cvc code. I have stored stripe customer_id and the stripe card_id. I want to verify the CVC code before charging the user.

Below are code for creating charge.

charge = Stripe::Charge.create(
        :amount => 1000,
        :currency => "usd",
        :customer => "cus_3sAc**************",
        :card => "card_18m*********************",
        :description => "Testing multiple card payment",
        :capture => false # default true,
        :cvc => 125 
      )

But cvc parameter is invalid here. If I remove the cvc, it works fine. But it won't check the CVC verification. How can I check this?


Solution

  • You cannot provide the CVC directly in a charge creation request. (Incidentally, if you did provide the CVC directly in the charge creation request sent by your backend server, that would mean your backend server has access to the CVC which would be problematic from a PCI compliance point of view.)

    At this time, Stripe doesn't provide a way to check the CVC of saved cards. The CVC is checked once, when you initially create the customer object using the card token, or add a card to an existing customer object. It is not possible (for now) to "revalidate" the CVC at later times.