I am testing stripe payment gateway. If I try to pay in INR (Indian rupee), the amount is not converting to US dollar correctly. In my code if I debug using break points I get the amount is 610 and currency code is INR but while processing the payment I get error stating :
com.stripe.exception.InvalidRequestException: Amount must convert to at least 50 cents. ₹6.10 converts to approximately $0.09.
It should be ₹610.00 but its taking ₹6.10. I am not able to figure it out why? Is this a bug in stripe?
This is not a stripe bug. It is a stripe feature. Basically this error is shown because the minimum amount required for a transaction in stripe is 50 cents. Stripe asks you to convert your amount into the lowest denomination no matter what currency type you were using. Just convert the amount in the smallest part of money. for e.g.,
In 1 rupee there is 100 paisa. So when you charge the 610 INR stripe take this as in paisa not in rupees. So you have to multiply the amount by 100, i.e., 610 * 100 (1 INR )
Related
I'm using separate charges and transfers with Stripe Connect accounts.
So, if I create a transfer of $1.00 to a Connect account, Stripe is going to charge my platform(me) $2.00/month + % fees + $0.25/payout for that active account according to their Connect pricing page
Question - Is there any way to charge the Connect account or pass that $2.00/month active fee onto the Connect account, so my platform doesn't have to pay it? ex. Direct charge, negative balance, invoice, debit custom account, etc. Or is there a way to see the total pending balance that will be sent out to the Connect bank account and "take back" some of it before it gets delivered?
Concern and/or Challenge - When I issue a transfer, I won't have any problems recouping funds (my 5% fees, Stripe's Connect fees 0.25%) from my customers Connect accounts. I won't go into the math explicitly, unless you ask, but I will remove all fees from the transfer before it's sent, then check via "TransferGroup" to look and see if any transfers have been made to the Connect account for that pay period (1/month) and if no transfers have been created yet, I will deduct on another $0.25/payout to be withheld. BUT now I have to do something similar to collect/recoup the Stripe $2.00/month flat rate per active account and this is where my problem arrises. My transfers might all be for $1.00 each! Ex. $1.00x100. So I can't simply deduct $2.00 from a $1.00 transfer to collect this fee.
My idea - The transfers for Stripe are coming from a tipping mechanism I've implemented between students and instructors on my site/app. The students can tip $1,2,3,4,...N tips. I can do a check to see if any tips have been sent for the month and if it's the first tip, force a minimum tip amount of $3.00, for each additional tip a student wants to send, it will only be $1.00. So the first student to send a tip gets forced into a min. $3.00 tip.
Another idea - Check each transfer amount to see if it's >= $3.00, if true, I can take all fees including the $2.00 account fee and still be in the Net positive to transfer, but if this transfer group doesn't receive any $3.00+ transfers in a month, I would then track the amount owed/not collected ($2.00) and try and collect it next month. This might work but seems like a sub par solution. Maybe there's a better way?
Another idea - Allow the Connect account to go into a negative balance , if I had to take $2.00 + $0.25 + %fees out of the first $1.00 transfer. I don't know if this is a good idea or how it would work exactly.
Another idea - I was looking to see if Stripe has a way to look at the total pending balance that will be transferred out to the bank account before the end of the pay period and somehow deduct the $2.00 from the total? I see there is a way to debit accounts, but there are lots of restrictions so I don't think it will work for my scenario (lots of international accounts).
Another idea - Debit custom accounts seems reasonable but it has too many restrictions ex. doesn't work for international accounts.
Another idea - I was looking at Direct Charges where it looks like I can charge a Connect account, but looking at this code, it only creates a "Request". How does it get me the money? Is it automatically sent from the Connect account to me(platform)? What happens if I only transfer $1.00 to a Connect account for a payout, but then send a "Request" for $2.00, does the Connect account go into some negative balance?
var service = new PaymentIntentService();
var createOptions = new PaymentIntentCreateOptions
{
PaymentMethodTypes = new List<string>
{
"card",
},
Amount = 2000,
Currency = "usd",
};
var requestOptions = new RequestOptions();
requestOptions.StripeAccount = "{{CONNECTED_STRIPE_ACCOUNT_ID}}";
service.Create(createOptions, requestOptions);
Stripe only charges the $2.00 fee on active Connect accounts - i.e. ones that you either transfer money to or customers do direct charges to. As such, there is always a monetary transaction before the Stripe Connect charges are accumulated.
In your case (and mine, actually) you are using separate charges and transfers - so withhold an amount equal to the $2.00 charge the first time you transfer to an account each month (a little bit of database/bookkeeping), as well as a "guess" at the payout charges as well (a "guess" because you know when you transferred money, but don't necessarily know how they will be combined into payouts).
2022-01-20
Pseudo-code:
//if using multiple charges to a single vendor
=> collect charges filtered by transfer_group, summing available, pending, fees, then net as AVAILABLE
=> collect existing transfers by transfer_group, summing amounts as ALREADY_TRANSFERED, and gathering transfer Id's
=> we'll use AVAILABLE_TO_TRANSFER = AVAILABLE - ALREADY_TRANSFERED
=> check Connect Account receipt records (your database) for previous transfers in this calendar month (I did mention bookkeeping)
=> if there are no other receipts, then what we'll set BASE = CONNECTED_ACTIVE (currently $2)
=> the amount we will transfer is the AVAILABLE_TO_TRANSFER less reserved fees
=> We know the potential Payout fees will be based on the amount actually transferred (might be less if transfers are collected into a single payout - remember I said pessimistic)
=> The Payout Fee (which we will save as RESERVE) will be based on the actual transfer, FEE = BASE + PER_PAYOUT + PAYOUT_RATE*PAYOUT, with the pessimistic assumption PAYOUT = TRANSFER. PER_PAYOUT is currently $0.25 and PAYOUT_RATE is currently 0.25%.
PLEASE PLEASE PLEASE put the actual values in a database somewhere and use variables to pass into the formula - that way you can easily maintain your code.
=> So now we know AVAILABLE_TO_TRANSFER, and we know that TRANSFER = AVAILABLE_TO_TRANSFER - RESERVE, and we know that RESERVE = BASE + PER_PAYOUT + PAYOUT_RATE*TRANSFER
=> a half-page of algebra, and we can get
RESERVE = (AVAILABLE_TO_TRANSFER*PAYOUT_RATE + (BASE + PER_PAYOUT))/(1 + PAYOUT_RATE)
and
TRANSFER = AVAILABLE_TO_TRANSFER - RESERVE
As mentioned, you do need to keep receipts in your database to know if the Active Connected Account fee needs to be collected. Keep the reserves in your platform account until the monthly Connected Account & Payout fees are charged, reconcile the # of actual payouts against the pessimistic guesses above, and you can the withdraw (payout) any excess from your platform account.
2022-01-20a
you can be even more pessimistic (by a small amount) and just use
RESERVE = BASE + PER_PAYOUT + PAYOUT_RATE*AVAILABLE_TO_TRANSFER
You'll just reserve a tiny amount more than you have to - which we are kinda already doing anyway...
BIG NOTE
This is NOT official advice from Stripe - I do not work for them. This is my approach.
You can specify an application_fee_amount to collect a fee for a Direct Charge.
With Direct Charge, the connected account will pay the Stripe fee, and you as the platform will get the application fee that you specified in the Payment Intent creation.
Here's the use case I am trying to solve for:
Create a new monthly subscription of $1000 that starts on May 20 with the CancelAt field set to June 29.
Expected behavior:
Stripe charges Customer $1000 on May 20
Stripe charges Customer $1000 on June 20
Stripe automatically cancels the subscription on June 29 with no further invoices
Total amount charged: $2000
What I tried:
Create a Susbcription with CancelAt of June 20 and ProrateBehavior=None
Actual Stripe behaviour:
Stripe charged Customer $1000 on May 20 (correct)
I see in the Stripe dashboard an upcoming invoice of $317.97 for period June 21 - June 29 (incorrect)
I see in the Stripe dashboard that Subscription is set to cancel on June 29 (correct)
Total amount that will be charged: $1317.97 (incorrect)
I can't seem to figure out what combination of fields would make stripe behave as I described. Isn't setting the Prorate behavior to None supposed to tell Stripe to never charge less than full amount? Seems like a common use case unless I am missing something?
Thanks for the help!
Stripe Subscriptions are prepaid, so your May 20 invoice actually covers from May 20 to June 20, so this actually makes sense.
cancel_at specifically says:
A timestamp at which the subscription should cancel. If set to a date
before the current period ends, this will cause a proration if
prorations have been enabled using proration_behavior. If set during a
future period, this will always cause a proration for that period. (emphasis mine)
You either want to just cancel the Subscription in June via the API with proration_behavior:none - potentially using metadata to record the 'when to cancel date' and webhooks to check if the subscription needs cancelling this period - or possibly use Subscription Schedules: https://stripe.com/docs/billing/subscriptions/subscription-schedules
I am implementing Stripe connect to charge a customer and then transfer commission to another associated account but I am stuck at the first step.
I have successfully taken card details of the customer and using stripe.js, I have tokenized it and then exchanged that token for a customer id which I saved in my DB.
Now for charging I am using:
$charge = \Stripe\Charge::create([
"amount" => 774,
"currency" => "usd",
"customer" => $customerId,
"transfer_group" => $uniqueTransferString
]);
Now that actually makes payment of $7.74 instead of $774.00 and I have no idea why. Of course I am using everything in test mode.
The card I used to create the customer at the first place was: 4242 4242 4242 4242
I have tried to give charge amount as: 1000, 774.00 etc but every time it only charges 1% of the given amount.
I have searched but couldn't find help anywhere as if why is this happening.
Please help. Any push in the right direction is appreciated.
Stripe always work in a currencys lowest amount. So in dollars that would be cents.
That mean to charge f.ex 1$ you need to multiply it by 100. This gives you 100 which is the amount you pass to stripe.
In your case to charge 774$ you would need to pass 77400 in stripes amount field
I would like to use stripe to bill per GB of data used in an application. Here is an example of an invoice:
Usage: 2.38GB
Rate: $0.20/GB
Total: $0.46
However, it seems like Stripe only allows integer quantity, so how would the above be done? If I were to bill per MB, then I'd have the following:
Usage: 2380MB
Rate: $0.0002
Total: $0.46
However, the lowest rate that I could add (at least from what it looked like in the dashboard) was $0.01.
So, what would be the best way to accomplish the above (other than round to the nearest GB -- which looks a bit fishy to an end user, imho).
Stripe cannot support charging less than the minimum unit for a currency (because you can't charge a customer less than that, for example if they only used 1 unit).
You could set your "Unit" to be the smallest amount of data that would total to one cent, so that you are rounding to the smallest amount possible. In this case, $0.20/GB = $0.0002/MB = $0.01/50MB, 1 cent per 50 MB. You would have to account for this when reporting usage to the API, by keeping track of their usage yourself and updating the API using action= set rather than increment[0].
While this is what you'd have to do behind the scenes, there's no reason you have to expose that to the user. You could still list your rate in units of MB, with a note saying that totals will be rounded to the nearest 50MB.
[0] https://stripe.com/docs/api/usage_records/create#usage_record_create-action
So I am super stuck with this question and don't even know where to start from. This is the info I have:
Start to Finish Number of People per Day roundtrip
Seattle to Bainbridge 5,847 passengers 14.4 miles
Seattle to Tacoma, WA 3,243 passengers 40.2 miles
Bainbridge to Tacoma, WA 746 passengers 42 miles
This whole system costs 20 million. I need to develop different prices for the roundtrip tickets in a way that will be fair and understaandable to everyone. If the costs go from 20- 22 million, the system should be felxible to adjust for that too. The hint is to use equation "y=mx+b". This is the only information that I am given. Can anyone please help me where to even start? My idea was that we should charge Tacoma,WA passengers the most money cause it's less people and longest miles, second we should charge Seatle-Tacoma,WA passengers and finally the least amount should be charged to Seattle-Bainbridge passengers because it's the least miles and most passengers. Can you guys help me formulate this in an excel and how to get a head start with this one. |
I would really aprreciate the help,
Thanks,
Nika
Consider charging all passengers a specific amount per mile. The more you charge per mile, the more revenue you will generate on a daily basis.
At a minimum, the mileage rate should be set to generate enough money to cover the daily operating costs and create a maintenance reserve.
If you increase the mileage rate beyond this, you will also generate a cash stream that you can use to retire 20 million investment. The greater the rate the quicker the payback!