Paypal Orders API Mixed Single & Subscription Purchase - php

I'm currently using the Paypal Orders API (v2) to process multiple items from a website's cart. Everything is working smoothly, but I now want to integrate subscriptions for some products. Basically, when they add the item to the cart it should be a subscription after checking out, that will charge money monthly.
Is it possible to combine having single purchases & subscriptions in a single checkout?

It's not possible unless you create a custom Plan with a setup_fee that corresponds to the amount you want to charge immediately.

Related

Multiple products in single charge Stripe?

My use case is that I have multiple products some of which are one time payment and others are recurring payment products. I want to charge the user only once so that the user doesn't have to pay for each product separately. According to my study we can create multiple product subscriptions with one charge. https://stripe.com/docs/billing/subscriptions/multiple-products#creating
If I had one-time payment products only, I can only receive one payment of the payment amount for selected products (as sum of prices).
But as I have mentioned I have some products which are recurring payment. So my question is if I add one-time payment products in this subscription request will they be charged again ones the recurring period overs, and if yes how can I Implement the above case in PHP?
Note: I want to implement this in custom form. I don't want to be redirected to stripe page.
You can use Stripe Checkout and combine both one-time and recurring prices3.
You can follow this guide in order to integrate Stripe Checkout with PHP.
Here what it will looks like for combining both prices types, the first charge will be for both pricing, and the second charge will be just for the recurring price(s):

Unable to add multiple variable subscription products in WooCommerce in Cart

FYI - The below mentioned process works perfectly fine on localhost (local env) but not on our server.
I'm developing a feature called "Home Try On" where we are allowing the customers to buy two pairs of shoes at the same time at the cost of one, but if customer fails to return the product then we would be deducting the cost of the other product using Recurring Payment Method. So, to ease out the process we purchased "WooCommerce Subscriptions" but it's not allowing the customers to add multiple products.
Here is an example scenario of actual work flow - We have kept all the Home Try On products as Variable Subscription products
Customer visits the website
Customer goes to Home Try On Section if he/she is unsure of their shoe size
Customer selects on Product let's say it as X Product and selects one pair (Size 6) and adds to cart, now we want the customer to add another pair of X Product (Size 7) but the problem is it's now allowing to add multiple variable subscription products and throws an error "A subscription has been removed from your cart. Due to payment gateway restrictions, different subscription products can not be purchased at the same time."
Can someone help me out on this? We purchased the WooCommerce Subscription plugin because it mentioned multiple subscriptions are accepted. It stated:
Your customers can also purchase different subscription products in
the same transaction and Subscriptions will group the products to
reduce the payment gateway fees and logistical overhead for their
future renewals.
Can anyone please point me in the right direction please?
Regards,
Piyush
For anyone that finds this question:
You haven't activated stripe yet. As the subscriptions plugin needs stripe woocommerce needs to have stripe activated!
it is free. just go to stripe and create an account. there you get two keys that you can use on your side.
hope this helps someone

Can I charge a variable amount to Stripe as a subscription?

I want to use the Stripe API to bill users every month for an amount they specify. It appears that Stripe does not allow websites to create a subscription without first setting up a plan for it manually, restricting what people can bill themselves for to predesignated amounts.
What is the best way to do this?
You can! Before we talk more about how this works in practice, make sure you understand when an invoice is open for modification.
Subscribing your customer to a new plan, or updating your customer's existing subscription
If you are subscribing your customer to a plan via the API, you won't be able to add any custom fees after the initial invoice is created since it will be immediately closed. This means you'll need to setup any custom amounts before the initial invoice is created. You can do this in one of two ways:
Set the account_balance when creating a customer or updating a customer's subscription.
Create any invoice items before your customer is subscribed to the plan, and then create the subscription via an update customer subscription call.
In either case, we'll pull the account balance or any outstanding invoice items into the initial invoice, so your customer will still be charged for the setup fees. These are essentially one-time charges that you are combining with the subscription's recurring charges. Since these are being added to the invoice total, only a single charge is being created.
Subscription renewals
The account balance and invoice items are simply one-time adjustments to your customer's account, so they won't be automatically applied each month. If your service uses metered billing or needs to add custom amounts for taxes or other dynamic costs, then you will need to create invoice items every month.
To get started, just use webhooks to listen for the invoice.created event. Whenever an invoice is open for modification, your webhook endpoint can create an invoice item that references the existing invoice's ID. We'll automatically pull this amount into the invoice total before charging your customer, approximately an hour after the invoice's creation.
Link:
https://support.stripe.com/questions/metered-subscription-billing

paypal recurrent payments with one time payments

I'm currently working on a shopping cart where I want to add paypal payments with subscription feature for credit card customers where the shopping cart have both one time payment products as well as monthly subscription services. I was able to do the subscription separately and one time payment (express checkout) separately. However when both type of items are added on the shopping cart often by the customers.
I want to know how I can integrate paypal for the following scenario.
In the shopping cart there are two items available. One item is a one time payment ( a product) and the other item is the website subscription (monthly recurring payment). I want to know how I can integrate the paypal to do both these different transactions in single checkout process where the subscription and the one time payment works in a single flow.
I have given a sample shopping cart below.
shopping cart
item 1 - 20$
item 2 - 5$
service 1 - 10$ every month
For the above example, i want to know how can i make the one time payments with the each month subscription in single checkout.
You can have loop of cart items and their type of payments (single, recurring) and based on their payment type call respective paypal class and process payment and take their response on one page and show result to user at end of process..Hope this logic will help you

Paypal, Add to Cart - Can I sell a product AND a subscription at the same time?

I have a question regarding Paypal.
I have a website that I sell both products and subscriptions. I have been unable to figure out how someone can purchase a product and a subscription at the same time through my cart.
Logically I would see this as simply two products (one with reoccurring billing), but I can't seem to find a solution.
If you are using Website Payments Standard, this would not be possible. You can not have a regular single transaction and a subscription during the same checkout. However, if you are using Express Checkout, PayPal Payments Pro or Payflow this is possible through using the API's. Depending on which service you use, the flow/code would be slightly different.

Categories