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?
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.
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.
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.
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.
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.
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, '', '');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With