can i update subscription amount after subscribed in stripe? - ruby-on-rails-3

I am developing rails application and integration of stripe payment. I am new in stripe payment integration. I set up for plan to user subscribe. But i have 1 issue over here. Suppose, user subscribe for any one plan and all plan are recurring so every month deduct plan amount from customer account. Every plan have a some limit to add user in our site. If want to add extra user then pay $5 per user / month. which will be deduct every month with plan. Then now, how i can settle this amount with already subscribed plan to deduct extra use amount on every month.
Suppose, plan amount is $20 and extra user $5 per month. So, now set amount of plan $25 instead of $20 in recurring payment.
How can settle this amount or any other way?
Thanks

There are two ways to do this. First, you could create an invoice item when you receive the invoice.created webhook from Stripe. This would let you add the $5 to the customer's upcoming invoice every month.
Second, you could create a new plan for the user and switch them to the new plan. There's no limit to the number of plans you can have in Stripe, so theoretically you could have unique plans for every customer.
That said, I would go with the first option if I were you. It's much simpler to work with.

I solved issue. But right now i set $1 for plan and now user subscribe for plan then set 20 quantity for that plan so deduct $20 for particular plan. Now if customer want to add extra user then i update quantity - 20 to 25 in particular customer subscription. So now recurring amount become $25. Problem solved.

Related

Need help on implementing this Use-Case Scenario in NetSuite Oracle

I am very new to E-Commerce World.
I have a use case scenario that I want to Implement in Oracle NetSuite.
But I am not sure how to move forward with it.
Use-Case Scenario:
A Sales Order has a few Line Items & Among them, a few are out of stock.
The 3PL currently I am dealing with accepts only one Unique Sales Order ID as an Identifier.
I want to fulfill the items that are currently in stock and Later on, when the Inventory gets updated I want to fulfill the remaining Items back-ordered in the Sales Order.
But the fulfillment should happen only after the customer has paid for the Items.
Can anyone let me know? How can I achieve this?
Thank you.
You will probably need some customisation to achieve this. I don't know the full set of processes you're working with, but as a general approach, I would suggest the following:
Set up a payment term that says the customer must prepay.
Set up a script to run on your fulfilments, handle "prepay" customers.
You'll also want to check your settings in Setup > Accounting > Accounting Preferences > Order Management. Look for the option on sales orders and fulfilment. You'll probably want to default your fulfilment to available quantity only. You may want to prevent overage on your fulfilments.
When the script executes on your fulfilment, it should execute "before load". The script will need to check the sales order it's fulfilling. If the term is "prepay", the script should then check if a payment has been made against the sales order. You'll potentially need to consider deposits and paid invoices. If the script finds no payments, then it should block the fulfilment.
I'm working on the assumption that you will create a fulfilment with a "Picked" status to send to your warehouse. When they confirm the "goods-out", you will want some sort of feedback loop from your 3PL to set the fulfilment to "Shipped" and update your tracking numbers.
I hope this helps.
Mark

Does transaction locks the row to prevent the data inconsistancy

I am new to MSSQL and creating a website where Customers can place orders.
Each order may have multiple items with any number of quantity.
I am interested in before saving my order to check if the desired quantity is available for each item, if yes then I will place the order and update the items inventory, otherwise I want to rollback.
But at the same time I want that any other order should wait till first transaction is finished. So that up updates don't overwrite the changes and produce inconsistency.
If each order is processed within a transaction, is it enough or do I have to consider something else too?
If you go on any Online retail website, you will notice that you go through the shop, buying stuff (not actually buying but being added to a basket) and once you have completed your shopping you go to Checkout that is, where you are asked to provide payment details etc.
So the idea is, the website shows everything (that has at least 1 stock item) to every customer, At this point no item inventory is being updated or inserted, at the checkout stage a complete order is compiled and submitted to system, (at this stage you will do the actual updates/inserts to item stock inventory) now how you want to handle the orders is entirely up to you.
Do you want to rollback entire order when any one item has less stock than
the quantity ordered?
Do you want to commit all order lines and only rollback those order lines where the items has less stock than quantity ordered?
Or do you want to place a provisional
order regardless of the stock availability and manipulate the delivery date?
Depending on what path you chose to go with (this should be a business decision a developer shouldn't be making these decisions) there is a lot of flexibility, but one thing you never do is as soon as someone has select to buy an item, you update the inventory. All this should be done right in the end of the Purchase process and all should be done at Once.

Assigning different shipping cost based on time of day

Can I assign different shipping cost based on time in Prestashop?
For example, From 11am - 5pm products should sell at X shipping cost and on X+10 shipping cost when time is 5pm,- 10pm etc.
The best way to do that is to create new shipping module for this specific carrier, here you can read how to do that:
http://doc.prestashop.com/display/PS16/Creating+a+carrier+module
In getOrderShippingCost method you should insert your code where you'll check current time and modify shipping costs.
Of course those are basis, there are plenty of options here, you can modify method getShippingPackageCost in Cart.php, you can modify cost in database using some dynamic hook after order creation etc.

Authorize.net - delayed payment and recurring

I have a question regarding Authorize.net.
Heres the scenario:
User signs up and is charged $5 right away for a sample product (and credit card is registered into ARB recurring billing profile). Two weeks later they are subscribed to the monthly product subscription if they don't cancel, and are charged a 'membership' fee on their first monthly payment.
So payments:
First purchase: $5
First month: $20membership + $30/mth
Rest of the months: $30/mth
From my research it looks the first purchase and then setting up a monthly payment with recurring with a two week trial period will be easy.
However, how should I deal with the first month membership payment? It is a one off payment that needs to be delayed two weeks after the first payment. This system being built is very simplistic and am not using any database backend, so solutions must be able to be done at time of purchase, or through the authorize.net backend.
ARB offers trial periods which allows you to set a special price to be charged for a set time period before the regular subscription price kicks in. This will do exactly what you need. As for when the subscription starts, just set the start date to be two weeks from today's date.

Best way to structure table for commission reports

I want to have a table that will track all the commissions we are due from our wireless sales. Each plan pays a different Commission, not a problem. We do our reconciliation as sometimes the carriers don't pay (they may miss a line or 2).
The problem occurs when the carriers change how much they pay for the commissions. We want to be able to go back and see that there was 4 lines not paid for in January at commission rate x. but Feb the same types of plans were sold but their commission rates were x-10.
If I change the rate in the commission table for the plan, when i go back to pull the data from the January report I will get incorrect commission rates.
I have a table for sales set up with a date stamp so I was thinking i can cross reference that somehow.
Hope someone followed this.
I am looking for the best way to structure this.
You should "STAMP" the record with the commission rate. You could either stamp the actual rate into every record... or you could keep a commission ID and put that into each record.