Adding PayPal payment capability to my website

Jerry_Scannell
Contributor
Contributor

I want to add PayPal payment capability to my website when someone wants to buy my product.  There is so much documentation on the developers' website that I don't know where to begin to find what I think is an easy thing.  I've found some sample HTML code that I have placed on my web page.  However, there seems to be several ways of adding this code.  I would like to whittle these methods down to one that I can use.  So here are my questions:

1. What should the action property of my form be?  I've found a couple.  The one I've currently selected is:  "https://www.sandbox.paypal.com/cgi-bin/webscr"

2. Once PayPal processes the user's payment, how will I be notified that the payment was successful?  I've seen where there is a form element "notify_url" and also a "return" form element.  Both of these have URLs as values.

3. One of the form elements is "business".  What value should I place in there?  Is it my

4.  The sample code I found will handle a single item "item_name" and a single "amount".  I have two products that all users will be buying.  How do I add additional item and amount elements to the form?

5. When I finish the sandbox testing, what has to change in the form?  I assume the "action" value will become something like "https://www.paypal.com/cgi-bin/webscr", but I haven't seen any examples of it.

6. I see references to including the javascript file: "https://www.paypalobjects.com/api/checkout.js".  I've included it on my page but I don't know how to make use of it.

 

Thanks in advance,

Paul

Login to Me Too
6 REPLIES 6

Jerry_Scannell
Contributor
Contributor

I would like to add one more question.  I've found where I have to add some javascript to my page related to performing "paypal.Button.render()" functionality.  In there is a payment function.  I found a real example of this but the amount is hard-coded to be '0.01', which might be good for a basic test, but isn't good in a real situation.  Here's the code:

 

            payment: function(data, actions) {

                // Make a call to the REST api to create the payment
                return actions.payment.create({
                    payment: {
                        transactions: [
                            {
                                amount: { total: '0.01', currency: 'USD' }
                            }
                        ]
                    }
   Since this javascript runs when the page is loaded, how do you change anything?  I haven't run this yet because I don't understand what to do so I am waiting for these questions to be answered.

 

Thanks, Paul 

Login to Me Too

Anonymous_User
Not applicable

Not sure of what product you plan to use - Payments Standard or Express Checkout

 

Per your post, it would seem that Payments Standard would work - it's really easy, you just use the online button creator, generate the type of code you need (Add to Cart or Buy Now for example), copy and paste the code into your web page and your done.   With Payments Standard, there no scripts or APIs, the code is just an HTML Form with will work with most sites unless you're using Wordpress as it won't permit you to insert an HTML form direct.

 

If you're considering Express Checkout, this does require a bit more setup and when customer's go through the checkout process, they are required to have a PayPal Account - whereas Payments Standard allows them to complete the purchase without having to have a PayPal Account.

 

Login to Me Too

Jerry_Scannell
Contributor
Contributor

Thanks GreenGear.  Maybe I will use standard.  Yesterday it was suggested that I use express checkout, but I can change it to standard.

 

I think some of my other questions might still apply though.  How do I know the payment went through successfully?  Do I have to integrate a listener?  or can I just have a "return" form element?  What will I look at in that web page?  Is there something in the Response object that I can look at like you can do with any "post" action from a form ?

 

Thanks,

Paul

Login to Me Too

Anonymous_User
Not applicable

When someone makes a purchase, PayPal will send you an email notification and you will also see a notice of the same in your Account Activity section.   Most people rely on this method as there's no programming needed however, if you have a need for as additional notification for behind the scenes actions, PayPal has a feature called IPN or Instant Payment Notification.  This is a message service that notifies you about updates to your PayPal transactions.   You can use it to automate administrative functions, such as fulfilling orders, tracking shipments, and providing status updates.

Instant Payment Notifications can update you on the following items:

  • Instant payments (including Express Checkout and direct credit card payments).
  • eCheck payments.
  • Pending payments.
  • Recurring payments and subscriptions.
  • Authorizations.
  • Disputes, chargebacks, reversals, and refunds.

Instant Payment Notification is automatically included with PayPal Payment products, Express Checkout, and Standard Checkout.

 

Here's a link to more details.

Login to Me Too

Jerry_Scannell
Contributor
Contributor

I found sample code that is set for classic ASP which is what I'm doing.  However, in the processing of the objHttp response, everything I would need to do is just a set of comments:

 

' Check notification validation
if (objHttp.status <> 200 ) then
' HTTP error handling
elseif (objHttp.responseText = "VERIFIED") then
' check that Payment_status=Completed
' check that Txn_id has not been previously processed
' check that Receiver_email is your Primary PayPal email
' check that Payment_amount/Payment_currency are correct
' process payment
elseif (objHttp.responseText = "INVALID") then
' log for manual investigation
else
' error
end if

 

The examples for other server code like php shows actual code to retrieve this info.  I don't know that programming language so don't know what to do.  I need examples of the code, not just comments like this.

 

Paul

Login to Me Too

Anonymous_User
Not applicable

As you're getting more into the Developer world, you may want to look for additional help in the StackOverFlow community for developers.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.