I am creating a web platform where users must subscribe to use its modules, each module must be purchased every month to use it. what i want to do is enabling a recurring payment each month.I know I can make monthly recurring payments and Paypal charges a sum each month, but what if a user subscribe in the middle of a month (like 15-06-2016). i must charge him only with remaining 15 days of June(because he will use it only in half of a month), then Paypal do the job each 1th of the next month( July-August.. etc). so How can i procede to
- charge the user for using a module in the remaining days of the current month
- make recurring payment each 1th of the next month.
I'm using nvp api of paypal.
I hope I was clear.
You may build a logic on your site to charge only the difference amount and setup PayPal Reference Transactions, PayPal RT allows you to charge buyers a variable amount at different intervals.
https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECReferenceTxns/
Related
I have used https://github.com/stymiee/Authorize.Net-XML/ library for implement recurring payment for my website.
Is there an option to change the next cycle billing date? For example, initially I have subscribed for one plan on 04-03-2018 for every month. But I need to change Next cycle subscription to start on 06-04-2018 . Is it possible in authorize.net recurring payment?
You cannot change the date of a recurring billing subscription. If you need to change the date you need to cancel the current subscription and create a new one with a starting date of 06-04-2018. If the billing dates are going to not be consistent then you would want to switch from using the ARB API to the CIM API which allows you to create payment accounts and charge against them at a future date. Then you can build your own billing engine to charge users when necessary.
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.
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.
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.
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.