You've got the token for your user's credit card details, now what? Now you charge them money. This happens
on your server, and the fastest way to do it is by using one of our client libraries. If you haven't already,
install your favorite language now. In this tutorial, we'll show code for
In your web server, grab the Stripe token in the POST parameters submitted by your form. Once you do, it's one simple call to charge the card with Stripe:
Also note that we've placed your test secret API key in the code. This will authenticate you to Stripe, and it's separate from your publishable key — keep it secret and keep it safe. Remember to replace the test key with your live key in production. You can get all your keys from your account page.
That's it! If the charge creation request succeeds, and doesn't throw an error, the cards has been successfully charged. You will receive your money in seven days.
Saving credit card details for later
Stripe tokens can only be used once, but that doesn't mean you can't save payment information
for your users. Stripe provides a
Customer abstraction that makes it easy to save
this information for later.
Instead of charging the card immediately, you can create a new
object and save the card to that customer. This will let you charge the user at any point in
In this example, right after we created the customer we still created a new charge by passing in the customer, rather than the card. You can always provide either a card or a customer when creating a new charge.