jeudi 14 septembre 2017

stripe CardError (Cannot charge a customer that has no active card)

def create_charge
 @amount = 500
    customer = Stripe::Customer.create(email: params[:email])
    pay = Stripe::Charge.create(
    :amount => params[:amount],
    :currency =>params[:currency],
    # :source=>params[:token],
    :customer=>customer.id, # obtained with Stripe.js
    :description => "Charge for ")
    send_json_response("Payment","success",{:pay=>pay})
end 

Am trying to create a customer and charge that customer using Rails and Stripe. The customer is getting created in Stripe, but I keep getting the error Cannot charge a customer that has no active card when trying to do the charge

Aucun commentaire:

Enregistrer un commentaire