Paypal Subscription : Adjustment of the amount on revised plan - paypal

In the paypal subscription, we have integrated the revised subscription feature for our system.
Subscription flow working fine, but when the user upgrade or downgrade their plans in mid of the subscription cycle, do we have any option to adjust their subscription amount?
Example :
Customer has purchased the Plan A with price $100 for 1 month recurring plan.
After 15 days, customer is upgrading to the Plan B with price $500
In that case currently no extra charge is executed by the Paypal for that 15 days, From the next payment cycle paypal will charge $500, So how can we manage that 15 days extra charge for that upgraded plan?
For the upgrade we want to manage refund for the adjustment amount and for the upgrade we want to charge extra adjustment amount.
Thank you in advance.

We did solution as below, if anyone need help for the case.
If customer purchase Plan A with price $100 and upgrade subscription to Plan B After 15 days.
So, customer used plan for 15 days and remaining 15 days amount will be return
Before moved to next plan. Previous plan's subscription will be cancel and calculated amount will be refund.
Calculation:
Charged amount = (price * plan used days) / duration (In Days)
Charged amount = ($100 * 15) / 30
Charged amount = $50
Refundable amount = Price - Charged amount
Refundable amount = $100 - $10
Refundable amount = $50
Simply we are giving refund before starting new plan and generating new subscription with new amount.

Create a new plan with a 1 month trial period for the prorated/adjusted amount you want to bill next, and a regular period for the amount you want to bill ongoing. Use this plan to revise the subscription.

Related

How to setup magento 2 when shipping fee is charged for each warehouse (source)

We have two questions about the shipping fee in magento2
Question 1
We are considering how to setup magento 2 when shipping fee is charged for each warehouse (source) . One type of product is basically assigned to one warehouse in our system. But, if you buy multiple types of products from different warehouses at once, the shipping fee will be the total shipping cost for each warehouse.(Also the shipping fee doesn't depend on the quantity of the products.)
For example if there is Product A (which is assigned to warehouse 1 and the shipping fee is 8$) and Product B (which is assigned to warehouse 2 and the shipping fee is $8) , the total shipping fee will be $16 when buying them at once, $8 when buying either of them.
How can we do this in magento 2?
Question 2
Since the shipping fee paid by the customer is different from the actual shipping cost, is it possible to calculate the gross profit and display them in the admin page as a report?
For example if there is Product A (assigned to warehouse 1, shipping fee paid $8, actual shipping cost $7) and Product B (assigned to warehouse 2, shipping fee paid $8, actual shipping cost $4) and bought them both at once, we want to add the shipping profit(($8-$7)+($8-$4)=$5) into the gross profit calculation and display them on the admin page.
we found some extensions and developing programmatically for magento2 which can customize then shipping fee
but couldn't find the way to change the shipping fee depending on warehouses.

Changing subscription plans and billing the difference

I am trying to implement seat based pricing but the documentation doesn't cover scenarios for changing plan mid subscription.
For reference these are the docs I am following: https://developer.paypal.com/docs/api/subscriptions/v1/
Let me give you an example. Lets say I have this pricing:
1-10 seats $5 each per month
11+ seats $3 each per month
To mimic this in PayPal I create 2 quantity based subscription plans. One with a quantity price of $5, the other for $3. Both plans are on the same product and have term set to monthly.
There are a few situations I am unsure how to handle and cannot find this information in the docs. They are as follows:
1) User signs up for 1 seat on the 1st June. On the 15th June they decide to change to 5 seats. The docs say this will be adjusted in the "next billing cycle" but I am unclear what that means. Their next billing cycle is in 15 days so does that mean they get access to 4 seats for free that month? What I would want to happen is the difference is calculated. The user has paid $5 so far and is halfway through the month so half a month cost is $2.50. The new subscription price is $25. So the remainder of the month would cost $12.50. So the difference to pay is $10 to cover them to the end of the month with the additional seats until they will then be billed $25 for a full month. Is this in anyway possible?
2) User signs ups for 5 seats. They then upgrade to 20 seats halfway through the month which moves them onto a different plan to get discounted pricing. How does situation 1 play out again in this regard when changing plans? How are the differences calculated and billed?
It seems in the old billings API you could override the setup cost when creating the subscription but that no longer seems possible. It is not possible to add the setup cost to a plan because this needs to be added dynamically based on the elapsed time in billing cycle, change in seat quantity and change in plan cost.
Have PayPal really removed all possible ways of dealing with package upgrades?
To have new arbitrary costs, setup or otherwise, you would need to dynamically create a bespoke package/plan for that particular checkout.

Facebook ads API daily_budget update limitations

I'm trying to update ads with daily budgets. From FB API we learn that:
When updating a set's lifetime or daily budget to a lower value, the new value must be at least 10% greater than the current amount spent already. For example: if an ad set has a $1000 lifetime budget and has spend $300 so far, the lowest new lifetime budget would be $330.
Does this rule mean that if we want to update the daily budget of an Adset, the new daily value must be at least 10% greater than the current amount already spent in the SAME day and the next day we can set any budget as long as it is > $1 and is at least twice our bid?
For example: if an ad set has a $10 daily budget and has spent $5 since the beginning of the day, the lowest new daily budget would be $5.5. The next day budget doesn’t depend on previous days budgets. Right?
Thanks for your help!
Facebook has updated the logic for lifetime_budget. It now sates:
An updated budget begins spending from zero (if there's a switch in budget types, the entire set spend to date is set to zero for the purposes of calculating the remaining budget).
Accordingly, if you update the daily budget to $20, it will spend 20 dollars for that day in addition to what it has already spent for the given day. From next day onwards it should work as $20 daily budget.

paypal button for buy 1 year, get 6 months free

I want to make a Paypal button for buy 1 year, get 6 months free
It's rather easy to setup a free trial period, but in that case the first billing doesn't hit until the trial period is finished. That sucks.
We want to run a promotion where the free trial period comes at the END. So they pay for a full year today, and aren't billed again for another 18 months, at which point they are billed for another year of service, and the yearly billing cycle continues from there.
Billing for the trial period of 18 months won't solve my problem because there are 3 different checkout options and the trial period applies to all of them as a whole (they are different prices).
We have 3 subscription types, and 3 promotions. So it seems like I have to make 9 different buttons to solve my problem?? How can it be done a better way?
Solved this. I just had to make a separate buttons for each. For example:
I wanted the first subscription type to pay 1 year, get 6 months free.... In Paypal I selected yearly billing for X dollars, then chose an 18 months promotion (and the cost of the promotion was set to the same cost as the regular yearly billing).
This way, we get paid from the first second, the customer still gets their "free trial" which I guess isn't technically a free trial. It's more like a 50% discount for the first 1.5 years.

woocommerce subscription free trail text

I'm trying to setup woocommerce subscriptions so that all paypal standard payments fall on the same day by using the free trial feature.
But the problem I'm having is changing the text when this feature is used so the customer doesn't get confused.
At the moment on the product page is says "£24.95 / month with a 2-day free trial" when ideally it needs to say "£24.95 / month starting in 2 days" or similar
In the cart is says "A 2-day free trial then £24.95 / month" when I would like it to say "A £24.95 / month starting in 2 days" or similar
And lastly when the customer gets taken to PayPal's secure servers is says under terms "Free for the first 2 days. Then £24.95 GBP for each month" when I would like this changed to "£24.95 GBP for each month starting in 2 days time" or similar
Would anyone know if there are any filter hooks I can use to get the desired effect, or if there is anything else I can do?
The site only has one product so I hope it's going to be straight forward.
Thanks in advance.
The 'woocommerce_subscriptions_product_price_string' filter can be used to customise the price displayed for a product.
The 'woocommerce_subscription_price_string' filter can be used to customise the cart/order prices displayed in the cart and on an order.
For examples of how to build your price strings and details of the parameters passed to each filter, view the source of the WC_Subscriptions_Product::get_price_string() and WC_Subscriptions_Manager::get_subscription_price_string() functions. I always try to write self-documenting code & include PHPDoc for anything that is not self evident.
Hope that helps. :)