Skip to content

Instantly share code, notes, and snippets.

@appsgenii
Last active January 26, 2016 00:53
Show Gist options
  • Select an option

  • Save appsgenii/f918671cea4afb6da04f to your computer and use it in GitHub Desktop.

Select an option

Save appsgenii/f918671cea4afb6da04f to your computer and use it in GitHub Desktop.
stripe_customer = Stripe::Customer.create(
description: "ShareNGo Customer",
email: email,
metadata: { "First Name" => user.first_name,
"Last Name" => user.last_name,
"Email" => user.email }
)
strip_card = stripe_customer.sources.create(
{
source: params[:stripe_response][:stripeToken]
}
)
stripe_token = Stripe::Token.create(
{
customer: stripe_customer.id,
card: stripe_card.id
},
conntect_user_stripe_access_token
)
stripe_charge = Stripe::Charge.create(
{
amount: amount_in_cents,
currency: currency,
customer: stripe_customer.id,
source: stripe_token.id,
description: charge_description,
application_fee: application_fee,
capture: true,
statement_descriptor: statement_descriptor,
metadata: charge_metadata
},
conntect_user_stripe_access_token
)
# Stripe::InvalidRequestError (No such customer: cus_7ms8Ht5jfgvgNE):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment