Calculating shipping costs and tax with Stripe - laravel-5

I'm using Stripe with Laravel 5.4. My problem here is that I was asked to include the shipping costs and the taxes to the total amount when using Stripe. Payments are possible in USA only.
Is that possible to do in one step?

Stripe does not have an API for calculating taxes and shipping costs. You'd need to use another API for this. You can see some recommendations here:
https://stripe.com/works-with/categories/shipping
https://stripe.com/works-with/categories/tax-calculation

Related

How to calculate Protocol revenue and Supply Side revenue for Polkadot?

I want to calculate the protocol revenue and supply-side revenue without using the TheGraph subgraph.
The problem with TheGraph is that it requires a smart contract address and all I have is an Ethereum wallet with zero balance.
I also tried to explore the supported tools listed on Polkadot's website but none could help me figure out how to calculate the revenue.
I am unsure how scanning a whole substrate-based chain can help me deduce the revenue generated from protocol and from fees (assuming the supply-side revenue means transaction fees only).

Subscriptions - Positive and negative balance?

The docs about Subscription.getBalance() say
The amount of outstanding charges associated with a subscription.
I noticed that I can achive a negative balance as well by granting a credit voucher in form of a discount but this is unfortuntely not mentioned in the docs.
A few quetions come to mind:
Is this intentional and how do subscriptions behave with negative balance?
What happens if a subscription with negative balance gets canelled?
If transactions are not supposed to get refunded, what is the best way to handle a user's cancellation request anyway?
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact
support.
The ability to have a negative balance on a subscription is intended functionality. Some merchants may give several months "free" by creating a discount that will show as a negative balance. When a subscription has a negative balance and is then charged for the next billing cycle, the negative balance will be used in place of charging them. For example, a customer has a negative balance of $20 on their subscription on a $30 per month subscription. On the next billing cycle they will be charged $10 (with $20 covering the negative balance).
If a subscription with a negative balance is cancelled that will be up to the merchant to determine how to handle. Refunding customers for transactions is certainly allowed and if you need to issue a refund to a customer you are able to do so.
For more information about negative balances and what refunds may pose problems I would recommend reaching out to support for more information. They will be able to walk through specific scenarios with you in greater detail.

How can I create a magic shopping cart for B2B?

I work in a B2B e-commerce company and we want improve our user experience with a function called "Magic shopping cart".
Let me explain :
Our website is a marketplace with multiple sellers selling a range of products with a limited stock per product, the point of our function is to make our customers find the cheapest cart for all the products they wish to buy.
At the moment customers need to search through all the website to find the best prices and to regroup a maximum of products on the same seller to reduce shipping fees.
We are searching for an algorithm that does all the research for our customers, meaning finding the best combination of sellers and products in order to buy the cheapest products.
We have done a function that combines all possible shopping cart for given products and quantities than we test which one is the cheapest, this is flawless except it takes way too much time.
We need a quicker/ more efficient way to find the cheapest cart, we have thought of machine learning (we are no experts) but we are open to all ideas.
Conventional algorithms offer better speed in most cases as compared to machine learning algorithms. If the customer wishes particular goods, and there is already a list of ALL offerings of these goods, then you just need an efficient search algorithm.
Machine learning would help you to identify which goods match which classes, for example, but this is not the problem you are trying to solve apparently.
Perhaps you are looking for some trade-off between the speed and quality of the magic cart feature (not optimum, but a good solution). In such case, there just might be space for using some machine learning, but it takes more specific formulation of the search task to come up with specific algorithm!
You might as well look into evolutionary algorithms and other optimization methods.

Google API costs

where do I see daily costs in the Google API interface for Translate? I can see how many requests sent but I can't see the actual cost breakdown. Any help would be greatly appreciated.
You can use the Price Calculator here, to get the correct price on your quota!
Google Cloud Price Calculator
Google Translate API pricing can be found here.
Prices per month
0-1.5 billion characters 1.5 billion+
Translation $20 per 1,000,000 characters* $15 per 1,000,000 characters*
Language Detection $20 per 1,000,000 characters* $15 per 1,000,000 characters*
As of 02 APR 2020
Effective 11/1/2019, up to $10 worth of free usage/month will be applied to Billed accounts using either the Basic or Advanced editions of the Cloud Translation API. The usage applies to NMT and PBMT text translation, and language detection calls, collectively.
More details can be found here https://cloud.google.com/translate/pricing

What is the simplest way to handle too many cases when calculating shipping fees? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
i am building a system that allows sellers to setup shipping fee.
The sellers can set shipping fee for 1 item by choosing 1 of these options:
-0$ (no shipping fee)
-a fixed local shipping fee
-a fixed international shipping fee
-a flat local shipping fee
-a flat international shipping fee
-TBCL (to be calculated later)
The buyer has his/her own address & can buy many items (all items must belongs to 1 seller) per order. & different items may have different shipping fee options.
Too many combinations can happen. Ex, a Buyer in Australia buy many items (it could be 0$, fixed or flat fee) from a seller in USA,
So what is the best & simplest way to handle this complexity?
I believe the Strategy design pattern from the GOF[1] would fit well in this case.
You would define an ShippingFeeStrategy interface with a method like calculateShipping(deliveryAddress). You would then implement various classes that realize this interface (like NoShippingFeeStrategy and FixedLocalShippingFeeStrategy), each one implementing the calculateShipping() method accordingly.
Every item or seller (according to how you model your system) would have an associated instance of ShippingFeeStrategy, which would be requested to do the calculation whenever needed.
A similar example can be found in http://www.dofactory.com/javascript-strategy-pattern.aspx, which calculates shipping fees according to the selected shipping method.
[1]: Erich Gamma, Richard Helm, Ralph Johnson,John Vlissides - Design Patterns: Elements of Reusable Object-Oriented Software (Addison-Wesley, ISBN: 0-201-63361-2)

Resources