Paypal integration [closed] - paypal

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am facing a problem with paypal integration. From my site I want the user to go to PayPal's site after selecting their product. But once the user makes a payment they do not return to my site so their order is not saved in my site but payment id going through to paypal.
I am using php to integrate.
Can anyone help me fix this?

I believe you would need to store the details before sending the user to PayPal to make their payment, so you have a record of 'intent' to purchase goods from your store. That record should contain details of who the customer is, what they are buying, and how much it costs.
Then, your customer is redirected from your site to PayPal to make the payment itself. At this point, they can either click 'cancel' if they change their mind (or just close the window down). Or they can make payment. After making payment, they can and should click the 'Return to site' button to go to your store and its confirmation page. Alternatively, at this point again, they COULD close down the window altogether. Having stored the purchase intent beforehand means you still have access to the data in the transaction.
So the following can happen:
The user presses the 'cancel' button. You can return to your site and remove the database record as this purchase will never be completed. If the customer still has their cart and buys later, a new record will be created.
The user closes down the window before making payment. You still have the database record which can be used later. After a certain period of time, when its assumed that the user isn't feasibly coming back to complete this particular order (a few days? a week?) you can delete the 'intent to purchase' record.
The user makes a payment but does NOT return to your store immediately using the 'return to site' button on PayPal. You still have the transaction details, and PayPal will still trigger your IPN script to verify that the payment went ahead and whether it completed or there were problems. You can compare details such as cart contents and total amount with your 'intent to purchase' record to ensure that everything is valid. You can then move this record to a 'completed purchases' table.
The user makes a payment and returns to your store. You can display a 'thank you / order confirmation' page to your user, tell them they have made a payment. PayPal will trigger your IPN script to that the payment went ahead (or what happened to it). As in the above step, you can compare your IPN information with the intent record to ensure its valid and real.
I believe this takes care of all eventualities, doesn't require an uninterrupted session because you're using a database - so the buyer doesn't have to return to your site following payment. Likewise, you won't have a cluttered up sales table that contains all of the people who were about to check out, but for some reason didn't proceed to make a payment. These records will be in 'intent to purchase' and you can periodically clear out old ones (or analyse the data to find out why people are dropping out of the process).
--
I hope this helps. I'm having the same problem today, and I think by actually having to write this answer out has helped me clarify it better for myself.

Integrating with PayPal is very simple.
I especially enjoy doing this with custom made web pages because it allows complete flexibility, as opposed to working with limited options that certain software provides.
Simply create a PayPal business account, create and code your own website, then click the "Buttons" tab when you log on to your PayPal.
You will then receive an HTML code which you can place wherever you want an "Add to Cart" option or a "Buy Now" option.
From there, customers can easily select items to buy and safely and securely checkout using their credit card.
I hope this helps. I will be happy to reply to any further inquiries.

Related

Where's the documentation for integration?

Sounds an odd question since there's a whole PayPal developer section...
About a decade ago I wrote the code to integrate our e-com solution with PayPal.
Customer on merchant site > basket > login or register > checkout > pay using PayPal button > user goes to PayPal site and pays > e-com solution receives background post ("IPN?") to notify it of payment received > customer sent back to merchant site which then shows result.
Was a long time ago. E-com codebase was completely reworked. We didn't include PayPal at that time.
Looking for the documentation for same to do same. PayPal is never used by any of our merchants as the primary payment provider so this is an additional option to be provided at the checkout. So, not interested in the customer leaving the merchant's site at the basket, nor any of the more advanced features, nor uploading the cart contents.
I've spent ages trying to hunt this down. It looks like it's called "PayPal Payments Standard". The documentation argues with itself about whether this is for single items or multiple (e.g. a basket). Not interested in passing across the items, just the amount to pay.
From what I can see, the methodology is the same as it ever was except that I need to create a "button" labelled "Pay Now" - amount is the entire cart, the item is "cart contents" by calling the API to get me back the button code and thus the link that takes the user to PayPal. Every button created this way will say "Pay Now" and a new button is needed for every single transaction. There is however something nagging at me that this is not quite right.
I thought I'd found the documentation - the PDF integration guide. That just comes up with a link saying it's moved. Click that and I get a link saying it's moved. Click that and I'm back at the PayPal site again - no PDF. Round and round we go.
I must just be getting old or going blind.
Can anyone point me at the right solution and where the documentation is. Am an experienced coder so ideally I just want a PDF and sample code.
Thanks,
Mark

Create/UpdateRecurringPaymentsProfile - can clients use their PPal Accounts

I have looked around SO for this but I can't seem to find anything like it.
On my service, I wish to charge on a per-month basis depending on how many users my clients have.
So this question is split up into two parts.
What I want to know is it possible for a client to use their own paypal account (without entering any CC details) with conjunction with CreateRecurringPaymentsProfile via the NVP, I have looked through the documentation and can not discern anything. So clearly it is not possible to do it via NPV - From what I've seen so far.
i. If I do an Express-Checkout Subscription, I can do 20% change on total amount every 180 days (I DO NOT want to do this) - I want to be able to get the Profile via the IPN and then modify the monthly amount on as-need basis
ii. There was some mention of Referenced Transactions, but the Documentation is very confusing.
So say there is a way to create a recurring payment subscription via a PayPal Account on the PayPal website, next step is to be able to update the Subscription via UpdateRecurringPaymentsProfile NVP command.
While I am happy to pass on CC details (which already works great), I am just wondering if it is indeed possible create a button, which would create a Subscription - once on success an IPN request is sent back with the ProfileID which I can modify the Billing Amount by NVP.
So TL;DR;
The current flow I have
Register on our website
Enter CC Details
Backend submits the data to PayPal and if passed - continues on.
On any Account modifications, update Profile Monthly Amount Automatically.
The flow I want
Register on website
Click on an Authorize Button Redirected to PayPal
Login to their PayPal Account Create Recurring Profile.
On any Account modifications, update that Profile Monthly Amount Automatically.
edit to add - this is all working now, had to contact and harass PayPal directly for a lonngg time.
I'm a little confused because it sounds like you answered your own question, but then said that's not what you want..??
Express Checkout does exactly what you outlined at the end of your post, and it triggers an IPN just like any other PayPal transaction. You are indeed limited on how much you can adjust the amounts of profiles created with EC, though, just like you mentioned with the 20% every 180 days. If you create profiles with Payments Pro (DoDirectPayment or PayFlow) then you're not limited and you can adjust the amounts however much you need to whenever you need to.
Reference Transactions and Preapprovals may be something to look into as well. I actually wrote an article about what they are and how they differ from each other awhile back that you might be interested in.

Paypal PDN - What if customer closes window before redirect?

I'm currently using the Paypal's PDN method of data transfer to keep all my transactions made through the Paypal shopping cart in a MySQL database of my own.
However, when Paypal redirects a customer to my handlePayment.php page, it takes about 10 seconds to do so. If the customer closed the window, the payment would still be made but the order wouldn't get posted to my database.
Is there a way where I can either:
a) speed up the redirect so it's instantaneous?
or
b) add a description under the store title in the paypal shopping cart, that says "please wait to be redirected after you complete payment?
Do both. Whichever arrives first wins, and the other gets ignored. The payloads are similar, so there's not much code to add.
If you rely solely on IPN, it might not have arrived by the time the visitor gets back to your site (especially if they click to it rather than waiting for the redirect). But if you rely solely on PDN, you get the problem you describe. So do both.

PayPal IPN and updating database

I understand how IPN works, and the basic idea of the sending of information, verifying etc. But for the life of me I cannot get it to work!!
This is what I'm trying to do...
A user selects a certain part of a product to purchase, once they click it, they are linked to a paypal button which I've added 2 text fields to. First is there User ID and the second the name of their selected part - both of which the value is added in automatically. That all works fine.
They then press Buy Now and fill out their card details and it is purchased and redirected to a success page.
However, I want it so it updates their profile in my database to show they have purchased that product.
I understand that using PayPal's IPN I can send information to a page on my site to check it, and if the payment is complete then take whatever action needed.
I have tried the scripts from the PayPal site itself and I get no response at all. Can someone give me a really, REALLY simple method of achieving what I'm after? Because every tutorial out there is overly complicated or doesn't work, and the examples don't help me in the slightest and they talk to you as if you should know how it's done already.
I've even read the whole PDF and still I'm clueless about how to get this working. Any help?
This really depends on how you have your users stored in a database.
How are they identified, do they have a username?
Are you saving transactions to a database before you submit the information to PayPal?
Basically, you would want to look at the IPN Variables and see what you could use to associate the data with your databases when the IPN message is received by your script.
Lets say you have the following Databases:
Users: ID, email, etc.. etc..
Transactions: ID, emailofUser, invoiceID, Success/Fail(bool)
You want to store information to the database before you send the data to PayPal - "Hey, this guy was sent to PayPal to purchase this".
Then, IPN comes in when you want to ensure that the item was actually purchased. You don't want to offer someone the benefits of purchasing an item just for being sent to PayPal, you want to make sure they actually completed payment. Going off of the IPN variables, you could easily use the 'invoice' variable (as long as you define it appropriately when you send the data to PayPal).
So lets say you send a buyer to PayPal, he completes checkout, and your script gets an IPN message. You'll want to do something like the following:
Verify the IPN
Check what invoice this is for
mysql_query("SELECT * FROM Transactions WHERE invoiceID=$_POST['invoice']");
See if the transaction is successful or not.
if ($_POST['payment_status'] == 'completed')
{
//update whatever information you need to
}
else
{
//something else happened with this transaction, put a flag on it for review by
//an admin
}
You should check out the links below which describe a little more about managing your orders
Order Management Automation
Order Management Guide

What options are available to accept credit card payments through an iPhone? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
What are the options to accept a credit card payment from an iPhone application? This will be a stand alone application, not an iPhone specific web site. Can I integrate with a payment gateway like Authorize.net? What about paypal or Google checkout? I know on some web sites, it will take you to a paypal site for the payment authorization - can this be done over http requests, instead of forcing the user to another website (which won't be available from the app)? Are there any security concerns with these payments from an iPhone as you can't install an SSL certificate?
I don't want to use the Apple micro-payments that will be available in the 3.0 release as there will be many small charges, and I don't want to give 30% to Apple each time.
Is this even possible, or will I need customers to create an account on my web site beforehand, pay with their credit card, and then have the iPhone interact with my database to get their available balance (the amount they charged through the web)?
I think that 30% is well payed...
No need to think about credit card fraud
No need to think about secure certificates
No need to think about server problems like downtimes
No need to thing about creating a nice UI and description of How to use
No credit card needed to buy as the user just need to fill up the iTunes password, so they can buy anywhere, everywhere
No need to spend a lot of time debugging and testing, the SDK is great and works like a charm if you just follow the documentation
And you can always add 5 dollars more to cover the 30% on what are you trying to sell.
Remember that if you have a lower price, you will have much more buyers and you can have much more profit that a few buyers with a higher price.
It's really quite easy to charge money with PayPal. It just depends on what kind of feedback you want from PayPal. See PayPal's Developer site for more info.
EDIT: I really should explain what I mean by "feedback".
When a user is sent to the PayPal site to pay, you can send him there using a fairly simple web-form (yes, a plain <form>...</form>.) If you only have 1 product, then this form can even be static HTML.
The tricky part comes after the user pays.
Option 1: Check you PayPal account manually for the payment. If the user paid, then you e-mail him, and send whatever you wanted to sell him. Easiest method, least amount of code. The downsides are that you'll have to do a lot of manual checking, and basically this is just a drain on your attention.
Option 2: Get automatic confirmation from PayPal in your application. Either by getting post-backs sent to an HTTP server by PayPal, or by actively querying the PayPal server for confirmation after waiting enough time for the transaction to have gone through. This means the user gets immediate feedback once the transaction is complete. You could even automatically send him the product! The downside is that such a solution is a lot more code.
Oh, and every time I said "PayPal"? All the services I just mentioned are provided by every credit-card authorization gateway I've ever seen.