PayPal recurring payment "add-ons" - php

Requirement:
We want to have a base subscription which is X/month, done via recurring payments, and give clients the ability to choose extra "add-ons" as they please. An "add-on" will be Y/Month and should last the remainder of the base subscription. For example, the base subscription is 10/month and feature X is extra 5/month and feature Y is an extra 7/month. I choose to have the base subscription with feature X and Y so my total monthly payment for a year will be 22/month. Now, if I chose only the base subscription for the first 6 months and want to start using feature X for the final 6 months of my subscription, the final 6 months should be 15/month opposed to the previous 10/month. In further terms, add-on features subscription should last the duration of the base subscription.
Is there a simple way to do this via the PayPal API?

Actual recurring payments profiles (setup with Standard or Express Checkout) have a limit on how much you can raise the amount of a profile. You can only raise it by 20% every 180 days. If you create a recurring payments profile with Payments Pro, though, then there is no such limit and you can change the amount at any time to whatever you need. I wouldn't recommend going without EC, though, as lots of people prefer to pay with PayPal.
What you could do, though, instead of using the recurring payments APIs would be to use billing agreements / reference transactions. This way you'd save the billing agreement / auth ID in your database and then you can use the DoReferenceTransaction API to process any variable amount you need to at any time.
So in that case you would basically be building your own recurring payments system where you'll save the "next payment date" in your database, and then you'll have an automated script run each day to process all of the payments that are due that day via a reference transaction.
Reference transactions work with Payments Pro, too, so if you're using that everything would still work the same.
Since you're working with PHP I'd recommend taking a look at my class library for PayPal. It will make all of these API calls very simple for you.

Related

PayPal API with PHP - single payment, then recurring payment with different amount

I am using the following code to send a payment request to PayPal's API (the $field array in the $paypal class is used to build a POST request). This code works fine.
$paypal = new paypal_class;
$paypal->add_field('business', $store_email);
$paypal->add_field('return', $script_location.'?action=success&order_id='.$order_id);
$paypal->add_field('cancel_return', $script_location.'?action=cancel');
$paypal->add_field('notify_url', $script_location.'?action=ipn');
$paypal->add_field('item_name_1', strip_tags(str_replace("'","",$_POST["description"])));
$paypal->add_field('amount_1', $amount);
$paypal->add_field('item_number_1', $item_id);
$paypal->add_field('quantity_1', '1');
$paypal->add_field('custom', $_SERVER['REMOTE_ADDR']);
$paypal->add_field('upload', 1);
$paypal->add_field('cmd', '_cart');
$paypal->add_field('txn_type', 'cart');
$paypal->add_field('num_cart_items', 1);
$paypal->add_field('payment_gross', $amount);
$paypal->add_field('currency_code', strip_tags(str_replace("'","",$_POST["currency"])));
$paypal->submit_paypal_post(); // submit the fields to paypal
Now, let's say the $amount I'm sending is $199. This amount will be charged correctly using the code above. Now I want to charge $29 per year in addition to the initial $199. Can I modify the code above (sending some extra fields presumably) to accomplish this?
I've been looking through the docs and I've seen some options for recurring billing but can't find one for exactly what I'm looking for - which is an initial payment of Amount X and then recurring payments of Amount Y.
You can offer a trial period of any amount including 0. The Trial period is the initial payment and after the trial period is over then you can setup the actual subscription amount, and start the billing on a specific date.
Here is the documentation for Express Checkout:
Express Checkout Recurring with Trial Period
&TRIALBILLINGPERIOD=Month #Period of time in one trial period
&TRIALBILLINGFREQUENCY=1 #Frequency of charges, if any, during the trial period
&TRIALTOTALBILLINGCYCLES=1 #Length of trial period
&TRIALAMT=0 #Payment amount (can be 0) during the trial period
&CURRENCYCODE=USD #The currency, e.g. US dollars
Here is the documentation for direct Recurring Payments
Trial Period for Direct Recurring Payments
It looks like you're working with Payments Standard. Can you confirm that?
If so, the answer pp_MSI_Jenn gave isn't going to apply. That said, I would recommend you switch to Express Checkout if you're comfortable with PHP class (which apparently you are.) This class library will make Express Checkout very simple for you.
You'll be working with the following API's.
SetExpressCheckout
GetExpressCheckoutDetails
CreateRecurringPaymentsProfile
Since you mentioned that you want to charge a one-time amount of $199 and then $29/year after that, you actually don't need to mess with a trial period. Instead, you'll just use the INITAMT parameter in the CRPP request to process the $199. Then you'll use the regular AMT, BILLINGPERIOD, BILLINGFREQUENCY, etc. to setup the $29/year, but you'll set the PROFILESTARTDATE to be 1 year from the current date. That way the first $29 payment won't happen for 1 year, but you'll get the $199 right away when the profile is created.
If you'd rather stick with Payments Standard, then you actually could utilize the trial period as a work-around the way pp_MSI_Jenn mentioned doing with Express Checkout. You would set the trial period for 1 year and use the $199 amount for that period, and then set the regular period to $29/year.
For more details on that look at the Sandard Varaibles list, specifically the recurring payments section.

Paypal Multiple Stage Recurring Payment

I would like to know, if Paypal supports multiple stage recurring payment ?
For instance, can we have payment structure something like this :
$10/month for 3 months
$20/month for 6 months
$30/month thereafter.
The payment is billed every month. I could not find any help in the Paypal developer community, so I am starting to think, such a payment structure is not supported at all.
P.S : It is not a follow-up question to my previous one.
The actual Recurring Payments API only allows for a one time payment that happens when the profile is created, and then you can do a trial amount and period, and then the actual amount and period. In your case you could just do a $30 one time for the first 3 months, then $20/mo trial period, and then $30/mo until canceled.
Alternatively, you could setup your own recurring payments system using the Preapproval API and then you wouldn't have any limitations (outside of the profiles themselves) on how or when you charge different amounts.

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.

Change the amount paid per month of paypal recurring payment account

The situation is like this,
I have three kind of user registration on my site
$20/month
$30/month
$40/month
now, suppose a user registers with $30 amount and takes the 2nd registration...
next 2 months his $30 per month were deducted as per the recurring payment of paypal...working fine .:)
Now, he wants to upgrade to $40 i.e 3rd membership , so from next month his amount deduction should be $40... How to update paypal for this change in amount..
I DON'T WANT TO GO TO PAYPAL'S SITE FOR THIS...
Is there any API for this purpose.......
Any help would be appreciated....
First off, Paypal's API is not a simple or easy thing to use, but what you're asking can be done. It is simply a matter of canceling the existing 'recurring payment profile' via the API, and starting another recurring payment that ends at the same time.
The API methods themselves change depending on which system you are using. At my company, we use Paypal Website Payments Pro. This has a specific set of functions to perform actions. Without knowing which system you use, however, we can't give any further advice.
The below link shows a number of the methods for the different Paypal API's. Do your research, and try to ask specific questions. :)
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_api_reference
Daniel Moniz
I was able to do this, but first, this caveat from PayPal should be noted:
Note: For recurring payments with Express Checkout, the payment amount can be increased by no more than 20% every 180 days (starting when the profile is created).
Since I'm not using Express Checkout, POSTing this worked for me to change an amount from $75 to $200 (the credentials are fake):
TRXTYPE=R&TENDER=C&PARTNER=PayPal&VENDOR=Acme&USER=Acme&PWD=a1b2c3d4
&ACTION=M&AMT=200.00&ORIGPROFILEID=RP0000001234
The other caveat is that this is only one of I-don't-know-how-many APIs and I-don't-know-how-many-types-of-accounts (in this case Payflow) that PayPal has, and I don't know if something similar works for all of them. The above code is actually copied almost verbatim (credentials and amount changed) from https://developer.paypal.com/docs/classic/payflow/recurring-billing/.

Categories