configure reoccurring payment and one time payment for paypal using php - paypal

I am working on a website which provides the subscription plans like for 1 year, 2 year and 3 year. User can make payment using the one time payment and using the monthly payment. for achieving this functionality I integrated reoccurring payment and one time payment using paypal gateway and I have successfully integrated. But I have some problem below is my scenario.
Suppose customer checkout using one time payment for one year subscription plan and make payment on paypal then paypal will hit at my IPN handler script and I will update the subscription plan for that customer for one year.
Now if customer checkout using the reoccurring payment for one year subscription plan then it will hit at my IPN handler script and i will update the subscription plan.
But here i want to know how i will differentiate with one time payment and reoccurring payment because whenever paypal hit the IPN for monthly payment then it will update my database for that customer and it will update the subscription date with one year. In this way it will update database every month and customer subscription date will update every month with one year.
I hope you can understand what i am trying to say,
Thanks.

The txn_type in your IPN will be different depending on the type of payment, so that's one way to distinguish between the two. Configure your IPN to handle each txn_type different depending on what you need to do for one-time vs subscription payments.
Also, keep in mind that you can add an initial payment in to a recurring payments profile and it will be treated as a one-time payment. Sort of like a setup fee when signing up for cable service or something like that.
Are you using the Recurring Payments API or Standard Subscription buttons or what?

Related

Which webhooks to subscribe for payments on paypal recurring payments?

I'm creating a website using paypal recurring payments. Each month the payment happens automatically, but I need to know when this happens in order to update the user profile in my application, so I know until when the subscription is valid.
Using paypal webhooks, which events do I need to subscribe to in order to know when the payment actually happens (or fails) each month?

Paypal Recurring Payment API CALL when taking money

I am writing a subscription where I need to provide users a month trial and charge $5.00 after trial is finished. I just found an amazing code to do that for me.
I also have setup paypalpro plus recurring payments
This is the link
https://github.com/krio/paypal-recurring-subscriptions
Questions:
1- How to make first month Free Trial?
2- I need to update users billing and update their payment in my database so it can calculate their subscription, how would i get to call from paypal to my files to update?
If you are using subscriptions and you are wanting to make the first month a free trial, you would need to pass over the following variables and values.
a1=0
p1=1
t1=M
You can find a description of all of the variables for subscriptions here.
If you are wanting to get updates back to your system/database to update your profiles and etc, you can use IPN to do this. Instant Payment Notification (IPN) is a message service that notifies you of events related to PayPal transactions. You can use it to automate back-office and administrative functions, such as fulfilling orders, tracking customers, and providing status and other information related to a transaction.

PayPal Recurring Payments Item Purhcase

I am developing a payment system using PayPal Recurring Payments (SOAP API).
I am Creating a Recurring Profile and setting up the monthly billing amt, period etc. Now when the user wants to upgrade his plan, I would like to Bill the buyer for the difference amount by using the same Credit card info which is associated with his recurring profile. How can we achieve this? Shall we do a complete separate transaction? Or DoReferenceTransaction API?
If I do a separate Transaction will PayPal allow me to do another transaction if the monthly recurring day falls in the next 72 hours?
Please share your thoughts.
Thanks
I would go with reference transactions like you mentioned. That would be separate from the profile, so yeah, if the recurring payment comes soon after it would process like normal.

Get Transactions associated with a Recurring Payment Profile in Paypal

I have gone through nearly all the question related to Recurring Payment using Paypal and have not found a solution to my problem.
We are implementing a system that is subscription based on a monthly basis (fixed amount). We do not want to store CC details for security reasons, hence we are trying to use Website Payments Pro from Paypal.
Once a user agrees to recurring payments, we are creating a RecurringPaymentProfile for that user and are storing the returned Profile_Id for the user.
Now we need to get information about all the transactions related to this Recurring Profile_Id. This information is available when we login to the Paypal account but this needs to be automated so that the application is aware of all the payments and also of the current subscription of the user.
We have found two methods (possibly) to implement this.
1. IPN (Instant Payment Notification, for this we will have to create a service to listen to notifications, which seems to be cumbersome and is more informational than we require)
2. TransactionSearch (but this returns transactions for the Paypal account and not Profile_Id)
Since we just want to know the transaction history associated with the Recurring Profile and whether this months payment was successful (implying the user is active member), what is the best method to implement this ?
Thanks,
You're looking for the GetRecurringPaymentsProfileDetails API Operation. This operation will allow you to view a majority of the details associated with a recurring payment profile using a valid PROFILEID.
Relevant detail fields you may be interested in:
LASTPAYMENTDATE
The date of the last successful payment received for
this profile, in YYYY-MM-DD format.
LASTPAYMENTAMT
The amount of the last successful payment received for this profile.
FAILEDPAYMENTCOUNT
The total number of failed billing cycles for this profile.
NEXTBILLINGDATE
The next scheduled billing date, in YYYY-MM-DD format.
NUMCYCYLESCOMPLETED
The number of billing cycles completed in the
current active subscription period. A billing cycle is considered
completed when payment is collected or after retry attempts to collect
payment for the current billing cycle have failed.

Changing the Amount of a PayPal Subscription

We are using PayPal subscriptions to automatically make ongoing monthly donations. The user initially creates a subscription with some pre-determined monthly donation amount (e.g., say $50/month). This creates a recurring subscription which we process by way of IPN. All good there. But, our interface allows the user to come in and change their monthly donation amount, say from $50/month to $100/month. I am wondering how I can change the PayPal subscription to reflect this new amount?
There is a method in PayPal's NVP API called "UpdateRecurringPaymentsProfile" which says I can update the subscription amount, but unfortunately it says:
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).
(reference: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_UpdateRecurringPaymentsProfile)
To be honest, PayPal's API's are quite confusing so I'm not sure if I am using the Express Checkout or not. (We are creating Subscription buttons using the simple Website Payment Standard API).
Will this work? If not, is there an alternative to achieve what we need?
Thanks!
I'm not sure if I am using the Express Checkout or not. (We are creating Subscription buttons using the simple Website Payment Standard API).
I hope rereading the above, you will realize that you answered your own question: You are using Website Payments Standard (WPS) not Express Checkout (EC).
With WPS, you can create a subscription modify button but this is super inflexible and I would not recommend it.
With EC, you can modify subscriptions as well (page 99):
Use the UpdateRecurringPaymentsProfile API to modify a recurring payments profile.
NOTE: You can also modify recurring payments profiles from the PayPal website.
You can only modify the following specific information about an active or suspended profile:
Subscriber name or address
Past due or outstanding amount
Whether to bill the outstanding amount with the next billing cycle
Maximum number of failed payments allowed
Profile description and reference
Number of additional billing cycles
Billing amount, tax amount, or shipping amount
NOTE: You cannot modify the billing frequency or billing period of a profile. You can
modify the number of billing cycles in the profile.
NOTE: For recurring payments with Express Checkout, certain updates, such as billing
amount, are not allowed within 3 days of the scheduled billing date, and an error is
returned.
You can modify the following profile information during the trial period or regular payment
period:
Billing amount (excluding tax and shipping)
Number of billing cycles
With that information out of the way... For the most flexibility:
Look at creating Billing Agreement IDs through Express Checkout. You will need to get Reference Transactions enabled on your PayPal account (talk to merchant support to get this done).
With a BAID, you control when your customers are charged, how much they are charged, and pretty much anything else having to do with the transaction. The drawback is the same as the benefit.. you (see 'have to') control it all.