Paypal response code - how to properly handle - php

I'm very new with ecommerce sites and making payments online. I'm building a website for a racetrack company. I built my customer a website where you can order subscriptions, rent gear & rent track days. I got paypal to the point where it is returning to me an IPN and I'm getting the response code coming back as either "Pending" or "Completed".
Once a customer makes a payment I need to update in the database the spots they took up, the gear they rented etc to keep inventory correct.
My question is what is the proper protocol for handling this? Should I assume the payment is good if it comes back as "Pending" & fill up all of the spots in my database & if it later comes back as anything other than "Completed" undo everything? Or is there a better way of handling this?
Also, is there other repsonse codes I should be concerned with from the Paypal IPN?
Finally, is there a way for me to only allow instant payments that I know for sure have gone through so I don't have to deal with 'pending' payments?
Any and all advice on Paypal IPN repsonses and anything related to this is very helpful as I need to release this site in 2 weeks and I want to make sure I don't do something wrong with this.

is there a way for me to only allow instant payments
There is an account level setting (Payment Receiving Preferences):
In REST API:
the intent set to sale "is for immediate payment"
payment_options of transaction (INSTANT_FUNDING_SOURCE)
For good measure, you should still check the status though (for other reasons that might set the status to pending - in the link referenced in comments above, e.g. currency/fraud settings, etc.) and handle according to your business rules..
Hth..

Related

Why are the funds in a transaction not transferred to the account automatically?

I have setup a Paypal payment environment, for the purpose of selling a certain service. I used Laravel to setup the API endpoints in the server for the creation and the approval of the order.
Whereas in the frontend, I used the paypal buttons, specifying the aforementioned API URL endpoints for the purpose of creating and capturing orders (onCreate and onApprove parameters of the button).
Everything is working as intended, the order is correctly created and verified before the payment is processed, but there's a small problem. For every new order, I have to go to the transaction log of my business account and manually click "Get your money" in order to actually transfer the funds to the account. (Refer to image with a couple of test payments).
With the increasing number of orders, this becomes a very tedious process. I don't quite understand why it is even implemented this way.
Is there a way to automatically transfer the funds to the account when a new order is made?
Have I made a mistake (or missed something) in the implementation of the payment gateway, or is there a default setting in the business account that I have to change?
Any help is greatly appreciated. Please let me know if you require any additional information.
Thank you in advance
Why is the payment pending? The screenshot does not show the details.
Is it a currency issue? If you don't have a balance of EUR on the account, open one if you want to receive payments as EUR, or change your payment receiving preferences to automatically convert to your primary currency balance.
Is the payment an authorization? If so the integration facilitating the creation of these transactions needs to be changed to create transactions that are of type "sale" or immediate capture, rather than authorizations for later capture.

php express checkout recurring created profile successfully but recurring not working

we have implemented express checkout very well.
we get ipn response for each transaction.
we done these thing in sandbox.
now we are making recurring payment with express checkout.
here the recurring profile is creating proper,
But i am not getting any ipn notification for transaction and also not any transaction is done for that profile.
Can anyone suggest me solution for this issue.
Help will be highly appreciated.
Thanks
vijay
Recurring Payments transactions send IPN's just fine, so my guess is your IPN script must not be handling them correctly or maybe just "doing nothing" with them. For example, if you're only handling a specific txn_type, then you might be missing out on other stuff.
Log in to your PayPal account and check your IPN History and you should see a list of all the IPN's it's been sending. You can see if it's returning Success or Fail, there, because another possibility is that your IPN script is simply failing when a certain txn_type hits it.
Your own web server logs can be a big help when troubleshooting that sort of thing, too. If you are getting some IPN's, though, it would be sending them all, so something must be going on to make you think they're not sending when they are.

Does Paypal API has got any updates regarding NOSHIPPING issues? I am unable to unset shipping info prompts at paypals

I just wanted to know if it is possible using paypal REST api that we can disable the shipping information form on paypal site. I am currently working on a site to implement cart checkouts, For fist time, I found paypal saying "We dont allow US merchants to make shippings to countries outside US". So I started saving our shipping data to my own database and left paypal to process shipping amount (which is calculated on my end) only. now, issue is that I want paypal to not to ask for the shipping address at their's end as it would be confusing for a user. Any suggestions regarding this?
I'm not sure you can do that unless you flag all your products as digital (and hope Paypal doesn't notice). That might be a violation of their TOS, however.
Another option is to use Payments Pro and do your own checkout process, where you control what data is collected and passed along (and shipping data is definitely optional).

How do I get data back from Paypal so I can alter my MySQL database accordingly?

I'm just starting out with Paypal, so this is a newbie question.
I've been going through the instructions for setting up Paypal subscription service, but I think I'm looking at the wrong thing.
What I want to acheive is to get back some kind of response from Paypal so that I can update the database on my web site to mark a registered user as having paid. Basically I have a flag in the database that says if the user is subscribed or not. I want to ensure that the user is marked as paid so long as their Paypal subscription is maintained.
While the instructions linked above do say how to set up a button to receive a payment, there's nothing there about getting any data back from Paypal.
I know there are terms like IPN and sandbox that are related to what I'm trying to do, but I can't find clear instructions for how to get started on this process. I'm just circling around and not getting anywhere.
Where do I start on setting this up? Where is there a clear beginner's tutorial?
Also, I'm using PHP/Javascript/MySQL on my website.
PayPal's IPN service is what you want to use. I've used it myself to do just what you're looking to do.
Instant Payment Notification (IPN) is PayPal's message service that
sends a notification when a transaction is affected. Once IPN is
integrated, sellers can automate their back office so they don’t have
to wait for payments to come in to trigger order fulfillment. IPN can
send notifications for these transactions:
Instant payments, including Express Checkout and direct credit card payments
eCheck payments and pending, completed, or denied status payments
Pending payments
Recurring payments and subscriptions
Authorizations
Disputes, chargebacks, reversals, and refunds
You can also view notifications on PayPal’s IPN History page and
resend them if you need to. As PayPal’s interface for handling
purchase confirmation and server-to-server communications, IPN can
also be used to manage and customize a variety of APIs and
communications, including:
Customize your website's response to customer purchases in seconds
Track customers via IPN "pass-through" variables
Notify sellers who deal mostly in software downloads and other digital, online goods
Track affiliate sales and commissions
Store transaction information in your own database
For more about IPN:
Technical Overview (link to new html version of docs on developer central)
Instant Payment Notification Guide (PDF)
Code Samples
I'm not sure if its the same thing, but I just setup my friends website with Express Checkout, and I wanted to add all paid orders to an orders table in my database.
After I call SetExpressCheckout, and the user is returned to my site after going through the purchase flow on Paypal's side,
I used the information from GetExpressCheckoutDetails.
Then, if DoExpressCheckoutPayment
is successful (also called from the "callback" page) I then do the appropriate work in my database as far as logging the order details. For you in this case, it could be updating a record for the user in the database.
Hope that helps a little.

PHP - Paypal product timeout

I have finally got my paypal system working using IPN and a reservation system to ensure that two people do not buy the same product.
The problem is, the reservations last for 10 mins on my application. If a user reserves the product the 'timer' starts, he clicks pay and ends up on paypals website. He then leaves the computer for 10 mins and comes back. He then buys it. By now though the reservation is up and it is possible that someone else could have already bought it.
Is it possible to send a time limit with the paypal IPN request to stop this happening?
As far as I know, you cannot specify that a transaction has to close within a certain amount of time with paypal.
However, I see two options you can use:
Offer a full refund if they purchase and the product is not available. You would check during the ipn notification of the purchase and if it is not available, then refund. You might be penalized by paypal if this happens a lot, but I don't have a lot of experience with offering refunds.
You can specify that the button needs to check inventory see "Step 2 – Tracking Inventory With Your Buy Now Button" in the standard payments guide. Once the product becomes sold out, you use the api to notify paypal the inventory is zero (if there is an api, you might have to use the website for this), and they should be able to notify the user there is zero inventory. I don't have experience with this either, but it seems more complicated than #1, and I would probably go with #1 if this didn't happen a lot. I think in the end you still end up having to issue a refund if the user goes through with the transaction even after seeing there is zero inventory, but I'm not sure about the wording in the docs.

Categories