Skip to content

Instantly share code, notes, and snippets.

@andrewpthorp
Created January 30, 2014 04:12
Show Gist options
  • Save andrewpthorp/8702516 to your computer and use it in GitHub Desktop.
Save andrewpthorp/8702516 to your computer and use it in GitHub Desktop.
Shared Customer Example
# Setup your api key
Stripe.api_key = "sk_your_secret_key"
# assuming token is the result of creating a credit card token
# and plan_id is something you have set elsewhere
# create the customer on the application owners account,
# notice, no ACCESS_TOKEN
customer = Stripe::Customer.create({
card: token.id,
plan: plan_id,
email: "[email protected]"
})
# create a token, using the customer id and an ACCESS_TOKEN
new_token = Stripe::Token.create({
customer: customer.id
},
ACCESS_TOKEN
)
# use the token to create a charge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment