I got a simple Digital Goods Checkout to work in Sandbox mode. I have a "Pay with PayPal" button that I can click which pops up an window for logging into PayPal. After that it redirects me to my purchasemade.php script, and from there I can successfully download a file.
My problem is that on my website I'm going to sell many products, so I need to know which product they want to download when they finish the purchase. Each product has a unique ID, so I thought I'd pass that ID as the item number in the HTML form as a hidden field named "item_number". However, I don't know how to read that value once I reach the purchasemade.php.
How do I read values passed in POST in the original form? Otherwise, what's the best way of identifying a product? I'm using PHP as my scripting language for this project.
If you're going to stick with Payments Standard I would recommend using IPN to deliver your digital goods. You could use PDT (which is very similar to IPN) to send order data back to the page the user gets redirected to, however, there is no guarantee they will make here even with Auto-Return enabled in your PayPal account.
Alternatively, you could use the Express Checkout API instead of Payments Standard. This method guarantees the user will make it back to your site prior to completing payment. This will allow you to utilize session variables so you can present the download to the user on the thank you/receipt page.
Still, though, I think IPN would be your best bet regardless of which way you go. You can use it to auto-deliver the digital goods, send out general email notifications, update your database, hit third party web services, etc. all in real-time.
Related
I sell a (very cheap and dynamically generated through PHP) file of data online. For the payment, I use a basic PayPal button.
This has two advantages I want to keep:
PayPal is known, and people are not afraid to proceed to payment, as they are on PayPal website when they pay (they get redirected to my website at the end of the process, and the file automatically downloads).
I don't need any SSL certificate on my website (quite expensive).
This has several drawbacks, I would like to be fixing:
As the file is dynamically generated in PHP, I would like to be choosing the price and the currency dynamically (according to many parameters; currently the price is fixed).
In my JavaScript, there is POST action, with a hidden "return" parameter (the URL customer get redirected to once payment is successful). If you know this URL, you can get the file without paying. This is a big security flaw here in my implementation (even if most of my users won't know how to inspect client code)
I understand I should be using the PHP PayPal API rather than the basic PayPal button. The workflow I imagine is:
a PayPal button on the page when clicked, triggers a server side PHP script.
this PHP script decides of the price, contacts PayPal with the return URL (not available on client side) and redirects the client to this payment page on PayPal.
the client pays in PayPal secure environment and, once payment is successful, gets redirected to my website with a temporary authenticated token (?) so he cannot transfer this URL to someone else and the file download happens.
I am a little lost with the PayPal documentation. Could you confirm my architecture principles and provides me some sample PHP codes in order to achieve all that?
Other questions: I currently have a basic PayPal account. Do I need I business account? Do I need an SSL certificate? Do you know good alternatives to PayPal to do all that? Google? Visa?
I'm working on setting up a page that will display some information to the end-user after they make a purchase through PayPal. This page will have quite a few different tasks that it will need to execute to ensure the user receives what they had paid for, this mostly includes displaying information for the user in-case something goes seriously wrong, for example: The email containing product information is never sent.
In this event I would like to instruct the user to fill out "X" form providing their custom transaction id, however I don't know how I'd pass that custom transaction id to the thank-you page from paypal.
I know how to use the IPN, and I'm rather familliar with it. I've always used it to send emails, etc; However here, considering I'm selling a virtual product, I need to make sure it's delivered automatically, and providing enough information so that any problems can be dealt with accordingly.
IPN itself is all you need. You can generate email notifications with a download link or an attachment of the digital item that you're selling and it will be delivered in real-time. It will also help you handle things like e-checks correctly so that the goods aren't delivered until the payment actually clears as opposed to when the first transaction (the pending e-check) comes through.
If you do want to display data on the thank you page (assuming you're working with Payments Standard) then you can use PDT, which is very similar to IPN except that it's intended to send data back to the thank you page. This is for display purposes only and is not recommended to be used for updating the database, sending emails, etc.
Yet another option would be to move to the Express Checkout API. That way the checkout flow will always finish on your site without setting up any auto-return or PDT features, and you can do whatever you need to do in the thank you page code very easily. Again, though, it's still recommended to use IPN for final post-payment processing so that you can handle things like pending payments.
I have been hunting around developer.paypal.com for a couple of days now and have the gist of what I need. But I am still looking on the best way to accomplish my task.
What I need is a way for people to pay a fee for an event from my website. I would prefer to allow Guest Checkout as not all attendees will likely have a paypal account yet. But what I would really like is for the paypal website to handle all of checkout. In ebay, you see the total, a small summary and you pay for it right there. I have looked at express checkout, and it wants to return the user to my website to finalize everything.
So in short:
Allow guest checkout
Show payment total on Paypal webpage
Allow payment to be finalized and 'Captured' from PayPal's website, only coming back to my page to say Thanks.
And if possible, not require an address of the attendee
Can this be done?
I have long used StackOverflow for answers, but I am having a hard time finding this answer (mainly because I don't know exactly what I am looking for).
Thanks in advance
You are describing "standard", and the HTML button integration will be much easier than Express Checkout.
Express Checkout is the most robust API to use. The "return" to your site is a good thing, to give the customer the ability to click a final "Place Order" button. But you can also have this triggered automatically on return -- just run DoExpressCheckout without user interaction and display a thank you / confirmation message. If you are going to run DoEC w/o interaction, your initial redirect to PayPal.com should have &useraction=commit appended to the URL. Then, the final button at PayPal.com will say "Pay Now" instead of the default "Continue"
To allow guest checkout with EC, pass SOLUTIONTYPE=Sole in the initial SetEC call. Note that when customers load a PayPal.com checkout page, it checks their browser cookies to see if they have a PayPal email address stored. If they have one stored in the browser, the top "Log in to PayPal" section will be expanded. If they do not have an address stored -- generally meaning this is a brand new computer or they've never used a PayPal account to check out on this one before -- then the bottom guest checkout section will be expanded.
To not require an address, pass NOSHIPPING=1.
I have a scenario where a user can input the amount he wants to be billed. I use buynow buttons that are created using code. Now in this case what what i had in mind was to:
Set minimum billing amount to 10$
If he enters below that, give error.
Set the amount of buynow button 10$ when form loads.
Once User inputs a number greater than 10 do an ajax request to controller
Check if their is a button saved in DB against that amount that was created earier on PayPal.
If button does not exist, create a new one on PayPal, save button in the DB.
Return the HTML of the newly created button
Replace the existing button with the returned HTML
Problem with this approach is that it might be too heavy. I also do not want to spread form over 2 pages. Are there any alternate and better options? Can i do some tweaks to make this option more robust?
A better option in this case would be to use the API and do the payments via either Express or Payments Pro. Essentially, you're trying to over-complicate this by making the buttons to the job of the API; getting the worst of both worlds in the process.
You could still utilize a "pay now" button graphic, but just submit your own request to the paypal express gateway (exactly what the button does for you) with a couple curl commands.
There are many tutorials available, but PayPal provides PHP code and a complete walkthrough on their site, so best, in my opinion, to go right to the source.
Log into PayPal -> Merchant Services -> Express Checkout
Under "Setting it up", you'll find all the implementation details.
I want to achieve something like this
http://depositfiles.com/en/gold/payment.php
I have normal users signed up. I want them to upgrade to premium user. Once a person pays, how do I know which user he was signed in ? How do i force the user to login first before being able to click the paypal button and make payment ? Otherwise, I would receive money, but wouldn't know which user to mark as "PAID" in my database.
when you click on the paypal button, it redirects you to the paypal page where you can login and pay.
I also want to accept Visa and Mastercards, is it doable through paypal using the same method ?
Paypal's information can be found here:
Part 1
You can create a subscribe button for each type of subscription you want and use the HTML variables in Part 2 to enable you to know what type of product and what user is included in the invoice.
This needs a lot more details than you currently provide. What language have you written your website in? Static HTML? Ruby? PHP? How does PayPal's payment system work?
normally the way it will work is that your site will pass information to paypal (http://paypal.sourceforge.net/ is one toolkit that seems to be made for php, thought I've never used it so I can't really promise its not abandonware).
once the paypal transaction is completed successfully, control is passed back to your site. you can then set the user's flag in your database as a premium user.
as far as I can tell, you tell paypal to handle payments for you, and the user picks a funding source in paypal. if you want to have visa/mastercard separately handled from paypal you'll need another payment gateway to handle it, like mirapay or something else.