Payment IPN - Payment Integration Issue - Multiple subscriptions on 1 paypal account - php

I have an issue with our PayPal checkout system that we can't seem to figure out. Here is the problem.
Let me setup the scenario properly:
User A = Office Manager of 3 realtors
User B = A realtor at that office
User C = Another realtor at the same office
User A is in charge of purchasing the upgrades to all of the realtors in this particular office (Users B &C).
In our system User A would have to login to their account click to the appropriate cart and checkout. This takes them to a PayPal checkout. They sign in and confirm their purchase. This is a subscription that last for X days.
Now, that user logs out and logs in with User B (because they are the office manager) account and goes to the checkout. They login with the same PayPal account they had used previously to purchase upgrade on User A. They confirm the purchase.
So, lets reflect on what we have thus far. User A has logged in with PayPal account 1 and purchased two separate subscriptions from our service. Each having their own unique credentials.
Let’s move on,
User A now logs into User C account and repeats the steps checking out with the same PayPal account, again.
All is good up to this point because no one has cancelled their subscription payment. Now this is where it gets a little tricky.
User B tells the office manager they no longer want their account to be upgraded and ask the manager to handle it. User A (the manager) logs into that PayPal account used to purchase all of the subscriptions within that office and cancels User B subscription.
Now that this action has taken place this is where we are running into issues. Because all of the subscriptions were purchased under this one account when the time of renewal comes the IPN notice we receive is not individually identifying the purchases. It is basically saying that a payment was made on the account (because User A and User C) still have active subscriptions. So on our end the system thinks User B is still active and they get a “free” upgrade that should have cancelled.
I hope I explained this well enough. Maybe it’s a simple adjustment we need to make so that the information received from PayPal allows us to identify properly between the 3 payments and keep active only the accounts that have made a renewal payment.
Thanks!

In short, you should be paying attention to the subscription ID (subscr_id) that comes back in each IPN — that will uniquely identify each subscription.
When each user creates their subscriptions, you should be getting an IPN with txn_type set to subscr_signup, and a subscription ID in subscr_id.
Each time a subscription payment is processed, you should be getting an IPN with txn_type set to subscr_payment, and the relevant subscription ID in subscr_id.
When user B cancels, you'll get an IPN with txn_type set to subscr_cancel, letting you know that they cancelled their subscription. (The subscription ID will be in subscr_id.)
When the term of user B's subscription expires, you'll get an IPN with txn_type set to subscr_eot (and again, the subscription ID in subscr_id). Once you get this IPN, you can deactivate the upgrade on this user's account.
So, if you keep track of each subscription ID and which user it belongs to, it should be pretty easy to figure out who's paying and who isn't.

the problem we are facing in this case is that when we cancel one account then the other account also become canceled in this case.We have seted as you mentioned.Payment has been done from the same paypal account for all those users.

Related

Custom Paypal Cart (Payment ID Number)

We are working on finding a solution for a custom PayPal cart install. I'll try to explain what actions are taking place then point out where we are having issues.
Here is the issue that we are facing:
1.) Users of our site can purchase a subscription
2.) That subscription once paid for activates several actions on the user’s account.
3.) Subscriptions last for Xx amount of time.
4.) Each hour our cron page runs and checks for payment received or not.
5.) After Xx amount of time (the subscription length duration) if the payment is verified to have been received the users account automatically renews. If payment is not verified to have been received then the account we return to normal.
6.) We have it operating correctly in the scenario if the payment is made from one PayPal account for a single user subscription.
7.) However, if a user uses one PayPal account to purchase multiple subscriptions (for this example 10) and cancels X amount (for this example 9) of subscriptions from within their PayPal account, none of the accounts get cancelled from within our site. Say a office manager submits payment from one single PayPal account (because they are in charge of 10 users accounts). Then immediately cancels 9 of the subscriptions from within that sign PayPal account and leaves one active account in our current setup it still thinks a payment was received for all 10 of the users because it’s checking the account rather than individual PayPal subscription for payment. (Tricky to explain)
** What I am are trying to figure out is how to have this action record the Payment ID # that is given by PayPal for each individual subscription when a purchase is completed and when the cron page runs it would pair the user’s (our site user) account to their Payment ID # and take action accordingly. So this way if 9 of the payment ids did not receive a renewal payment those accounts would become inactive and the one payment ID subscription that did receive payment would active properly.
I hope that makes sense and I would really appreciate anyone's help on this. Thanks a ton!
You should be using Instant Payment Notification (IPN) to handle automated updates based on actions that occur on the PayPal account including new profiles, payments, failed payments, canceled profiles, etc.
Any time a transaction occurs on your account (payments, profiles, refunds, disputes, etc.) PayPal's server will POST all of the transaction data to a listener script you have sitting on your server. Within your script you can process that data however you need to, and it happens in real-time.

Subscription system with Paypal

I'm developing a restaurant catalog in which the restaurant owners pay a monthly fee for having their restaurant appear on the site. I was thinking in using Paypal recurring payments but I don't understand exactly how it works. Would Paypal automatically charge the fee each month? (Like auto-renew) or would the users be able to decide if they pay or not? I need that the users decide if they want to continue with the membership instead of being automatically charged. How can I achieve this with Paypal?
I'm using express checkout with instant payment notifications (IPN).
Recurring Payments would be a subscription that would be charged automatically unless the profile was in a canceled or suspended state. So if your customers signed up, they can indeed choose whether to pay or not if you give them a way to suspend their profile, which you can do via the ManageRecurringPaymentsProfileStatus API.
If you would rather setup a way where users have to click a button to approve the payment each month then you could go with a billing agreement and a reference transaction. In your SetExpressCheckout request you would make sure to include the billing agreement parameters to get a valid token, and then when the order is completed with that billing agreement you can use the transaction ID you get back from it in a DoReferenceTransaction request in the future to process any amount using the previous billing info that PayPal has saved, so no additional login auth would be necessary.

Paypal api get success or failed

Ok so I have built my shopping cart system for my site that uses PayPal Parallel Payments to multiple sellers since the site allows users to sell thier own items and when a buyer buys stuff, they can buy from many sellers at once. I then figure out the payment to each seller including fee's and then send the user off to paypal where they would pay.
The part I am not sure of is do I create the order ID and update in the DataBase the order has been created but not paid for yet. Then when the users pays for it in paypal, I would update order in the Database it has been paid. At which point I would allow the user access to the content they paid for.
I guess I am asking how do I check to see if the user has payed in PayPal or if the transaction failed due to insufficient funds or something? Is there way to search by the order ID in paypal to see if the order has been paid for?
edit: I know I could use the return URL but that doesn't seem very safe?
Once a Payment is executed (payKey created, user has been redirected to PayPal, approved payment, and is redirected back to your return URL), you can then use the Adaptive Payments API to call and check the status of the payment to determine if the money has really moved.
Use the PaymentDetails call - the status should be COMPLETED if the payment was successful.

IPN feedback for 2 people

I have a page on my site which sends out payments to more than 1 person. I've been testing this using the paypal sandbox account with a few test accounts.
I am also using ipn to get feedback from paypal when payments are complete, pending etc.
My question is, paypal sends me back info via ipn for just 1 of the payments. Why is that? When I check the payment amount in the ipn, it only shows me the payment for 1 of the people who got paid. For example:
If I pay person 1 and 2, where each person gets paid $10 each, so a total of $20. The ipn page only shows me the details for person 1 and says that the payment amount was $10, when the total payment amount is $20.
This is causing me a problem because I need to know that both payments were successful via ipn. At the moment I can only check the payment for 1 person at a time, even though I am paying 2 people at the same time.
How do I get payment for both people?
#Pete answer is a violation of the Paypal User Agreement (unless you have a separate legal entity for both accounts)
9. Restricted Activities
9.1 Restricted Activities. In connection with your use of our website, your Account, or the Services, or in the course of your interactions with PayPal, a User or a third party, you will not:
a. Breach this Agreement (including, without limitation, opening multiple PayPal accounts or breaching the Card Processing Agreement, the Acceptable Use Policy or any other agreement that you have entered into with PayPal (including a Policy));
What you are looking for is PayPal Adaptive Payments. A note about this though: one account - probably you as the application owner - must have a PayPal business account. The others that receive a payment only need a personal account.
PayPal provides an SDK with samples for the Adaptive Payments on Github. Select Adaptive Payments from the menu on the left. There are samples for multiple languages that should be able to get you started.
My hunch is that IPN is tied to the individual account, not the payment, and you have the IPN set up from just one of the accounts. I think what you need to do is configure the IPN on both accounts and then process the response from PayPal two times... once from the IPN notification of the first account, and once from the IPN notification of the second account.

Catching duplicate PayPal IPN payments

I have a recurring payment solution set up via PayPal's IPN service, basically the user fills in a form, pays the money and via IPN my system gets a ping to grand the user access to the system.
Everything technically works fine, but occasionally on the last day of a user's cycle they forget that it is a recurring payment and complete the form again. PayPal doesn't seem to mind this and creates a second recurring payment profile.
Currently I go in, refund the money and cancel this new payment profile, but obviously this isn't ideal - is there any way I can configure PayPal to not accept new profiles from people with currently active profiles? Or will I need to catch this at my website's end and do some form of lookup before allowing the payment?
Paypal did not recognize the a transaction is a duplicate one, It tackles the transaction as a new transaction. You will have to tackle it from your system.
When implementing payment gateways, It is good approach to save the billing with a status pending or something in your system before sending to payment gateway.
Also in the form user is filling you can implement a field to uniquely identify the user like his email address and you can also save the expiry or second recurring date against the user unique field in your system. Now when the user enter the same unique field and want to submit a form again you can validate that the same user is paying again but its expiry of second billing date is not yet reached, so prompt and restrict him for paying again.
Hope it will help you.

Categories