Skip to content

Charge Stripe in Actual Dollars, not Cents

Posted in Django

Stripe is a great payments solutions for developers and merchants alike. With rich API documentation in varied programming languages, it is undoubtedly one of the best in the system.

I’m currently working on a project where Stripe payments are integrated. I’m using Python-cum-Django for the project.

Unfortunately (or maybe fortunately), Stripe charges only in cents. Thus, if you’ve come across a similar situation, you’ll realize users enter, say 5 dollars into your form, but it ends up showing in your Stripe dashboard as 0.50 dollars.

This is because Stripe charges in cents. It is great having enough time to test using the Stripe testing sandbox, to iron out kinda weirdness.

I’m using a simple workaround, you might find useful. Some code will do now, enough of the talking:

100 Cents make a dollar, thus if the user wants an amount of 5 dollars to be charged to the card, 5 dollars is equivalent to 500 cents. Stripe servers will understand 500 cents the way it should be understood.

No need for any complex conversions. Same should work for other currencies too.