paypal recurrent payments with one time payments - php

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

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):

Paypal Orders API Mixed Single & Subscription Purchase

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.

Apply discount coupon code on first recurring payment in paypal (paypal-subscriptions)

I am using paypal (PHP) for recurring payment. It is working fine , but now i wants my user to get discount if they subscribe to my plans.
It is something like this, Plan actual cost is $20, if user subscribe to this plan , he should pay only $15,as $5 is given discount (only first time, after that next billing should be of $20).
can anyone help me how to do it in paypal.
I understand, Paypal currently is not supporting coupons or any kind of discounts on their /v1/billing/subscriptions or /v1/billing/plans endpoint.
You can manage yourself by creating Plan B (copy of Plan A but with a discount on price) and displaying that plan on the checkout. Then deactivate and activate other plan.

How to upload cart that contains both single payment items and installment items

I wrote my own shopping cart [in PHP] a couple of years ago that uses PayPal's Classic API "Payments Standard" -- specifically the "upload" command to send the contents of the shopping cart to PayPal. Now I want to add the option to pay for an item with installments and I want that to integrate with the shopping cart process.
In other words, I want the customer to be able to put Item A into the cart and select a single payment option, and then also put Item B in the same cart but select an installments option for that item. Then, when they hit the "Check Out With PayPal" button, I want the Item A and Item B to be processed in the same transaction. My cart also has a feature that allows the customer to enter a coupon code.
I have spent hours running in circles though the PayPal API documentation and I can't find a solution that seems to cover everything that I need:
No monthly payment (I'm too small to absorb monthly payments, so it must be a fee-per-transaction service).
Ability to process single payment items AND installment items from the same cart.
Ability to accept a discount/coupon and apply it to the transaction at the PayPal side.
All collection of payer's shipping address, payment information, etc, done at the PayPal side.
Determine if sales tax is required at the PayPal side.
Provide an IPN type response.
I'd rather not install code on the server [that needs to be maintained or reinstalled if I switch hosts].
Can anyone point me to a solution that could cover all of this?
I was looking at the Adaptive Payments solution but it looks like it I would have to determine whether to charge sales tax (and perhaps have to collect the payer's shipping address info, which I want to avoid). I like everything else about Adaptive Payments. Does anyone know if it will be as "nice" about handling the payer's information, as "Payments Standard" does?

Using Paypal API's to process conditional rental payments using PHP

I am building an eCommerce site which gives a user the ability to rent
an item for a designated amount of time. If the item is not returned
within that time, the customer is billed automatically for another rent
cycle. If the item is returned the customer will stop getting billed
for additional rent cycles. If the item is bought the customer will be
billed and an additional amount different from the rent price will be
billed to the customer and the customer will no longer be billed for
additional rent. Most of the billing is ongoing and has too many
variables going on to just have a simple subscription payment method.
I think the sequence of transactions can be initiated with a simple PayPal button form which sends information about my IPN script location, Cancel Payment script location and recurring payment script location.
I find that there are some limitations of what PayPal's API's can do. It seems that the recurring payments API is set up for an amount of set payments set over a specified billing period over a set number of times a customer would be billed. I am not 100% sure on this but I think PayPal only accesses the recurring payment API for a customer once for the initial transaction and executes the continuous transactions without checking my websites internal database which might give data to influence parts of the recurring payment script to cancel continuous payments. An example of when this condition should occur is when a customer returns a product or purchases a product which was already being rented out. PayPal has been terrible at getting back to me about technical problems like this. Another problem with PayPal's recurring payments API is a recurring payment subscription cannot be longer than a year so if a customer is renting an item for 2 years then they would only be charged for the first year.
Any advice on how I can implement a payment system like this using PayPal, if it is even possible would be greatly appreciated. I don't want to have make my own payment gateway if PayPal can do this.

Categories