I'm working on installment plan. Lets suppose we have a plan of 1,250,000 with 35 installments and payment frequency is after 1 month.
customer has to pay 5% extra after every 6 months. So regularly he will pay 1% and after every 6 months he will pay 6%.
So suppose after other payment charges we have payment of 812,500 that is 65% of total payment.
Now every 6th month customer will pay 1% of regular fee with 5% extra that is 62500.
For clearfication see screenshot. Currently I have to manually add that values but I need to automate this process to save time.
you can use the mod operator to find every 6th row like this .
for($i=1;$i<=20;$i++){
if($i%6 == 0)
echo $i;
}
Related
I want to know is there any scenario supported by stripe with recurring plans,
If a user subscribes to a plan A that costs $300 and its billing cycle is 3 months and he/she upgrades to
a new plan i.e., Plan B costs $600 i.e., also for 3 months recurring period, after 1 month or less subscription period of using plan A then we need
to upgrade that user to plan B with following conditions:
-100$ should be deducated from 300$ for 1 month or less than 30 days and 200 will be remaining in his wallet
-He/she will have to pay 600-200(Remaining from plan A payment)=400$ for the new plan i.e., Plan B
-Similarly, if He/she subscribed to plan B first then he can also subscribe to plan A after the usage of 1 month or less
than 30 days then the deducated amount from his wallet would be 600/3=200$ the deducated amount will be 200$ and the remaining amount is
400$ that will be added in his wallet then if he/she subscribed to plan A then there will be deductions of 300 from 400$ which is in his/her wallet now
so his/her remaining balance will be 100$.
-Please explain is it possible with the stripe? If yes then please help me for this issue.
Sorry for the english grammatical mistakes
Thank you
When you update a subscription, there is a prorate option, which defaults to true, so that the user will automatically be charged for any difference in the price of the new plan, adjusted for their time in the current billing period.
https://stripe.com/docs/api#update_subscription-prorate
That should be all that's required for your first example.
I don't totally follow on your other examples, but it seems that you could simplify it by simply using multiple plans.
https://stripe.com/docs/billing/subscriptions/multiplan
Generally, either you have different tiers of plans, which users might upgrade/downgrade, in which case you likely just want to update their existing subscription with proration. Or, if users might be subscribing to multiple plans at the same time, then you would simply allow users to sign up for multiple plans, which Stripe fully supports. There shouldn't be much of a reason to try to do both at once for the same set of plans.
I am working with Stripe subscription and I don't want to create different plans with xy users included but set the price simple to 10$ per user per month. See the pricing at https://www.box.com/en_GB/pricing/ to get an idea what I mean.
How can i realize that subscription behavior in Stripe? Do I need to create an own plan for every count of users? (eg. oneuserplan 10$, twouserplan 20$, threeuserplan 30$,.....)
Or can I somehow multiply the 10$/month base subscription with with the count of users?
You can find a quantity field in stripe documentation
The quantity you'd like to apply to the subscription you're creating.
For example, if your plan is $10/user/month, and your customer has 5
users, you could pass 5 as the quantity to have the customer charged
$50 (5 x $10) monthly....
Okay so let's say I have
A balance of $6.00 created from a credit.
An invoice of $12.00 created by an admin.
You subtract the invoice amount from the balance and get a total of $-6.00
How would you subtract the two until you reach $0.00 to figure out the amount taken from the balance to pay the invoice.
So you would get that the balance paid for was a total of $6.00 and the client still owes $6.00
My PHP code is as follows for this predicament!
if($balance >= $due)
{
$amount = $due;
}
else
{
$amount = $due - $balance;
}
if($balance > '0')
{
$data = array(
'invoice_id' => $invoice_id,
'balance_pay' => '1',
'amount' =>
);
$this->payment->create($data);
}
UPDATE
I'm just trying to figure out how much is still owed on the invoice. If I don't figure this out, because of how my application is set-up, it will display that the total invoice was paid when really only half of it was paid.
This is a VERY simple problem, that has needlessly been complicated, which often happens. Just need to take a step back rather than getting deeper into the problem (if that is even possible) and further complicatingn the issue.
Firstly, you don't have to subtract to reach $0.00.
In the most general case, the amount of current credit balance could be negative (customer currently owes you money), 0 (customer does not owe you any money currently), or positive (you currently owe customer money). But the actual calculation is the same in all three cases. Let the current credit balance for the customer be x.
Now you wish to generate an invoice. Let this invoice amount be y. (I assume that y will always be positive, but doesn't really matter.)
Then, z = x - y is the new credit balance for the customer:
If z < 0: customer did not have enough credit balance to pay off the new invoice. Customer still needs to pay z.
If z = 0: customer had just enough credit balance to completely pay off the new invoice, and the new credit balance is 0.
If z > 0: customer had more than enough credit to pay off the new invoice, and the new credit balance is z.
It's just straightforward addition/subtraction, needlessly complicated in your head by credit/debit/plus/minus signs, with the added confusion resulting from wanting to balance to zero when you really don't have to.
I'm working on car rental system. Currently I allow users choose the same addon items as many times as they wish. Deposit charge and price per day will occur for each items chosen.
Now I want to add some condition. If the same item chosen between the specified time period and the quantity is one, deposit charge will be omited from second item onwards. How do I achieve this please?
For instance,
specified time period=11-09-2014 to 17-09-2014
Item 1 chosen from 11-09-2014 to 12-09-2014.Deposit $20 and $50 price per day charged.
item 1 chosen again from 13-09-2014 to 16-09-2014 and the quantity is 1.Now I want to omit the deposit from being charged ,instead just charge the price per day $50 for the second item.
Can anyone help please?
This is my array
$_SESSION['info'][]=array('c_id'=>$car_id,'addon_id'=>$addon_id,'date_c'=>$date_c,'date_d'=>$date_d,'item_type'=>$item_type,'quantity'=>$qty,'services'=>$services);
And this is how I call them
foreach($_SESSION['info'] as $info=>$in)
{
$info;
echo $in['addon_id'];
}
I tried:
if(in_array($in['addon_id'],$_SESSION['info']))
{
echo'exist';
}
I tried:
if(array_key_exist($in['addon_id'],$_SESSION['info']))
{
echo'exist';
}
I tired:
if ( count($in['addon_id']) > count(array_unique($in['addon_id'])) )
{
EXECUTE CODE
}
It display exist for all item entered the array. What I want is, if for first time a value enters array then must mark new, if more than once the same value enters then mark exist.
I simply used comparison operators like <= and >= to compare the dates and it worked!
I need to adjust/allocate the advance amount to the corresponding bills, if it's possible.
For example: Exactly advance amount is less than of invoice amount, may be if overpaid i just want to adjust the excess amount(means Invoice amt rs. 8500/- but paid amt is Rs.10,000/-, here Rs.1,500 is the excess amount) to the next corresponding bills when the excess amount turns zero.
If customer pay advance amount Rs.10,000/- I want to allocate the amount to the customer bills like: 1st bill like Rs.5000/-, 2nd bill Rs.3500/-, 3rd bill Rs.3000/-, after adjusting the advance amount Rs.10,000/- balance amount the customer wants to pay us is Rs.1500/-.