Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stripe Payment gateway I wants to use amount in decimal format

I am implementing Stripe Payment gateway (php) in my website. I want to send a subscription amount in decimal form. For example I'd like to send 9.99 but it gives me an error that it is an invalid integer. Why doesn't this work?

like image 841
QSM Avatar asked Aug 28 '14 10:08

QSM


People also ask

Is Stripe amount in cents?

Stripe is a pay-as-you-go payment processing platform with flat-rate, transaction-based fees. Overall, you'll pay 2.9% plus 30 cents per transaction to accept card payments online and 2.7% plus 5 cents to accept in-person payments with Stripe. It does not charge monthly or annual fees.

Does Stripe support zero decimal?

Stripe treats TWD as a zero-decimal currency for payouts, even though you can charge two-decimal amounts. When you create a manual payout in TWD, only integer amounts that are evenly divisible by 100 are allowed.

How do you change currency on Stripe?

The only way to change the currency you charge a customer in is to create a new Customer object representing that customer, attaching a payment method, and then pursuing the desired task in the right currency.

What is better Stripe or PayPal?

While both companies specialize in online payment processing (over in-person transactions), PayPal is better suited for small or new businesses that are just getting started while Stripe is a better fit for larger companies, as it provides more options for payment customization.


2 Answers

All amounts sent to Stripe must be in integers, representing the lowest currency unit (e.g., cents). So your subscription amount would be 999.

Hope that helps, Larry

PS I work on Support at Stripe.

like image 93
Larry Ullman Avatar answered Sep 16 '22 14:09

Larry Ullman


Amount that you send to Stripe must be in integer (you should send value in cents) but note there is issue with some currencies. See explanation here: https://stripe.com/docs/currencies#zero-decimal

I use next code for my payment module:

<?php

$currency = 'usd';
$amount = 17.24;

if(in_array($currency,['bif','clp','djf','gnf','jpy','kmf','krw']))
{                   
    $amount = number_format(ceil($amount) , 0, '', '');
}
else
{
    $amount = number_format(($amount*100) , 0, '', '');
}
like image 40
Sergey Kharchishin Avatar answered Sep 18 '22 14:09

Sergey Kharchishin