How to do multiple recurring payments together through Paypal Express Checkout - php

I have a website in opencart and selling subscriptions/recurring-payments (weekly, monthly, yearly) where customer can add-in-cart/buy more than one subscription/s and pay through PayPal Express Checkout.
When doing the payment, it works for only one/first subscription but not for others (throwing Error: A successful Billing Agreement has already been created for this token.). I understand that. But as per Paypal's documentation, we can execute payments for multiple subscriptions. As I checked, Even opencart's code is written in a way which can perform payments for multiple subscriptions.
Would it be possible? How can I do it? Can a TOKEN be used for multiple recurring payments?

Related

How to make monthly subscription payments with paypal php rest api

I want to make monthly subscription payment with paypal php rest api. Is it possible with rest api. If yes then please describe how can I achieve that. Also after successful subscription how can I cancel the subscription via Api. Also how can update the DB if subscription payment is failed.
It's possible to create a subscription payment with the Paypal API.
First of all you need to create a product with the catalogue api:
https://developer.paypal.com/docs/api/catalog-products/v1/#products_create
You have to create a product regardless what you are selling (physical goods or services)
The you will use the subscriptions api to create plans that are linked to the created product:
https://developer.paypal.com/docs/api/subscriptions/v1/#plans_create
Obviously a product can have multiple plans with different pricing or billing cycle
Finally you can integrate the Smart Payment buttons to your checkout form to allow users to subscribe to a plan:
https://developer.paypal.com/docs/subscriptions/integrate/#4-create-a-subscription
You can read the currently complete guide of paypal subscription integration here:
https://developer.paypal.com/docs/subscriptions/integrate/
After a subscription is created it can be canceled via the subscription api:
https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_cancel
I don't remember how to create the recurring payment with Paypal, but as far as I know, canceling it is not possible via their api.
On our website, we have to tell the users to cancel their subscription on paypal's website.

Paypal standard or Payments Pro

I'm currently using the standard cart function from paypal (using my own PHP to configure the data and price details) to create a shopping cart for services (based off this post: How to send multiple items to PayPal).
However, I need to show the full item price and the deposit amount, and only charge the user the deposit amount. Currently, I have the Deposit Amount set as the Item Price, but I think that will be confusing to users since it doesn't show the full item price. I need to show both the Item Price as the full amount of the product, and then have another label for Deposit Amount that is used as the amount that is charged.
For example, this is what I need to show:
**Service 1**
Item Price: $500
Deposit Amount: $200
___
**Amount Due Now: $200**
Balance Remaining: $300
___
I haven't seen a way to do this using the standard cart function, and was wondering if it's possible to customize these type of variables using Payments Pro.
You can use PayPal Payments Pro or Express Checkout.
Express Checkout allows you to set the call (from the PayPal Developer Documentation)
Call SetExpressCheckout to set up the transaction and define the URL to which the customer is returned after the customer authorizes payment.
Redirect the customer to PayPal for authorization of the payment.
Call GetExpressCheckoutDetails to obtain customer information, e.g. for customer review before payment. (returns to your website, and send the payment details to your cart)
Call DoExpressCheckoutPayment to complete the transaction.
In the return page you can present the final payment amount to the buyer, which will allow you to charge the deposit amount.
Here is the getting started Guide for Express Checkout, which has a complete picture of the typical Express Checkout Flow
Express Checkout Getting Started
You can use the Code Wizard to generate Express Checkout Code.
Integration Wizard
Express checkout also allows for recurring payments if you need to charge someone a deposit now, and then the rest of the payment at a later date. Here is the integration guide for Express Checkout Recurring Payments
Express Checkout Recurring Payments Developer Guide
If you would prefer to use PayPal Payments Pro Payflow edition you can create a custom cart that keeps your buyer's on your website and allows you to charge the card the deposit amount. PayPal Payments Pro Payflow Edition does have recurring payments as an option as well.
Here is the getting started overview for Payflow Pro
Payflow Pro Getting Started Overview
Here is the Payflow Pro Developer Guide

Suggest recurring payment method for paypal

We have specific requirement list for recurring payment method which are as follow:
After registration process user can select plan for recurring payment which is like 7$/month.
While registering user can enter coupon code and if he/she choose recurring plan then user will get discount on first month only and rest of the month he has to pay decided amount (7$/month) for recurring.
User can cancel his/her recurring plan and switch to free account.
User's account (premium/free) is depend on the received payment. So i have to check that user's payment is received and if not then i have to update my database and make user as free user.
There is a scenario that user signed up with recurring payment method after some month he switched to free account. Now again he wants to sign up with recurring plan. how can i achieve above scenario.
I know there are two options (subscription and recurring payment) but i am confuse which is suitable for this scenario. If there is another solution available then please suggest it.
PayPal doesn't have a coupon code feature so that is something you would need to handle on your own.
You can set up a trial period for a Recurring Profile that lasts a month and would be charged at the lower rate. After that trial period the Recurring Profile would start billing the normal amount of $7.
A buyer will always be able to change their Recurring Profiles within PayPal. You can't have a Recurring Profile open with PayPal for free. We require that a positive amount is provided. You can still track the users on your own but there wouldn't be an active Profile for them within PayPal you can check.
An existing Recurring Profile can be updated but the amount charged cannot be changed more than 20%.
Either a Subscription button through Payments Standard or Recurring Payment API's through Express Checkout will allow you to do this. Express Checkout Recurring Payments can be handled entirely through API calls.

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.

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