简体   繁体   中英

How to report stripe-payments usage as floating point number

I am adding payment and subscription to my application using stripe I want to fee the user per the usage of my system, I tried to report usage as floating point number but cant find a way to do that, the supported method allows you send integer usage only any suggestion to do that?

I used UsageRecordCreateOptions.Quantity, but its integer field

The quantity parameter is indeed an integer value, therefore you will need to specify the price for the smallest unit that you are planning to use.

For example, if your subscription price is $6 for 1 hour, but you measure usage with 1-minute precision, you might want to change the price to $0.1/minute instead.

I took vanya suggestion(look to the comments) changed stripe price to be 0.01$ and reported the value multiplied by 100 to convert it to cents now the loss will be parts of cent when casting to integer or long, and this is accepted for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM