Using Paypal API's to process conditional rental payments using PHP - 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.

Related

Automate PayPal commission payments from Merchant when someone subscribes

I'm building a site for a client that involves a number of content creator users that other users can subscribe to with automatically recurring monthly payments (think OnlyFans). All transactions are to go through PayPal, which I thought would be the easiest solution. I'm coding in PHP (WordPress environment) using Curl to call the REST API.
I've got the content creators on-boarding fine as merchants. I originally went down the path of creating Orders, and PayPal has a great commission tool in that system so that my client will get their commission every time a user starts a subscription. I was going to take care of the recurring payments at my own end, but then I discovered PayPal's Subscription system - it seemed perfect, but it doesn't have the automatic commission facility of the orders system, which is a bummer. So I could have PayPal automate the commissions while I programmed a subscription system, or I could use their subscription system and ... what?
That's where I'm stuck. I now need to automate PayPal deducting a payment from my merchant and paying it to my client as their commission. This needs to be done whenever a subscription is started and then each month as the subscription payment comes through. I've tapped into web-hooks to get notified when these automated monthly payments are happening (at least I'm hoping I have), but how can I automate a percentage of the initial payment and each subsequent monthly payment to be automatically deducted from the merchant and paid to my client?
I've looked at orders, but that needs to be approved by the merchant. What else is available to me?
To automate sending payments from your own account to creators or affiliates, you could potentially use Payouts.
See here for information on requesting access to Payouts.

Subscriptions and recurring payments with preapproved allowance limit

I am working on a site providing software as a service which is billed on a monthly basis.
The software is licensed on a per-user basis and will be extensible via optional standard modules and custom apps that can be subscribed to through an app store.
The customer can alter the number of users, subscribe or unsubscribe modules and apps every month.
Users, modules and apps should be billed along with the base software, thus the billing amount may greatly vary from month to month.
The goal is to minimize PayPal requests for approval and let customers specify an amount that is above the base subscription price so that minor purchases do not require approval by anyone with access to the company's PayPal account (unless the customer limits the amount to the original subscription price).
Which PayPal APIs would you recommend in this scenario ?
As I understood it, UpdateRecurringPaymentsProfile does not allow the amount to be increased by more than 20% within 180 days without explicit approval by the buyer, so it probably would not work if we try to first request e.g. $200, then bill only $100 and later increase back to e.g. $150, right ?
The Adaptive Payments API seems to require the seller to bill rather than have PayPal do it on a regular basis, is this correct ?
I don't know it's help full or not right now, As it is a very old post.
Instead of creating recurring profile on PayPal Server, You can store the customer's credit card on the PayPal using REST API: https://developer.paypal.com/docs/api/#vault then every month you can fetch it and charge it like recurring Payment, Also you no need to worry about how many time customer upgrade the subscription you can manage it on your server end, Or When client is no longer with the services then just remove its card from PayPal.
I suppose Authorize.net SIM method also does the same.
Hope this make sense.

Proper way to create dynamic automatic billing method with paypal API?

I know this maybe a duplicate but due to the overwhelming amount of paypal APIs I am having a hard time finding a GOOD answer to my question.
I need to create variable monthly billing per user in PHP. The idea is that a user could sell a number of items with a total sum of sales at the end of the month p. So the billing would be something of the extent MY_PERCENTAGE_FEE * p. The user would then be sent an invoice, and a would be automatically billed via paypal for that amount.
Now, it would be SUPER great if this could be done by creating reoccurring billing and updating the amount at the end of the month. Is that possible? If not what would be the next best way to go?
If you're creating recurring profiles with Payments Pro you can adjust those without any limits. Unfortunately, with Express Checkout you're limited to raising the amount by only 20% every 180 days, so that doesn't normally work out very well. You have a few options of how to get around that.
1) Utilize billing agreements with Express Checkout and Reference Transactions. This would allow you to run an authorization (or an original sale of some sort) for a payer and then from that point on you can use that transaction ID from the original transaction along with a new amount in the DoReferenceTransaction API. Reference Transactions area available with Payments Pro by default, but if you want to use them with Express Checkout you'll need to get that specifically enabled on your account.
2) Use the Preapproval API, which is part of the Adaptive Payments platform. This is similar to reference transactions except that you can create preapproved rules by which you can bill your payers at any time without further approval. This would allow you to process payments for them at any time you need to and pull variable amounts accordingly.
3) Use the Pay API, which is also part of Adaptive Payments, with a split payment (parallel or chained) which would allow you to take your cut in real-time without the need to track balances and submit variable recurring payments. Each time one of your customers is paid for their product/service, you would immediately be paid your share.

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.

Reference transaction with Recurring PayPal payment profiles

I want to modify my billing cycle of recurring payment with a different amount before the next billing cycle starts, and I was suggested that I should use reference transaction for that. But as we know recurring payment profile call does not respond with transaction id then how is it possible to make a reference transaction ?
Please help me with this subject.
Thank You,
If you're working with a recurring payments profile created via Payments Pro or Express Checkout then you'll need to update it using UpdateRecurringPaymentsProfile. You could also do it manually via the PayPal account.
If the profile was setup using a credit card there aren't any limitations to updating the amount. Unfortunately, if the profile was setup using a PayPal account you can only increase the amount by 20% every 180 days.
That's probably why reference transactions were recommended. Using reference transactions you can build your own recurring payments system and avoid this limitation.

Categories