Solved

VBScript Submit to Paypal

Posted on 2013-02-01
12
416 Views
Last Modified: 2016-03-24
I'm desperate, so I am going to approach this issue a little differently and more directly. It has been recommended that I handle my submit to Paypal in a VBScript page that also updates a db and generates emails.  The number of items submitted ranges from one to ten; each include an item name, quantity and amount. I'm looking for some sample code to help me figure out how to accomplish this.
0
Comment
Question by:sherleon
  • 7
  • 3
12 Comments
 

Author Comment

by:sherleon
ID: 38891530
I don't want to shoot myself in the foot, but I have to ask, "What in the world has happened to this website?" Several years ago your experts helped me through building my first website, and it was worth every penny. I recently rejoined in hopes of getting help wwithwith
0
 

Author Comment

by:sherleon
ID: 38891548
with some updates. So far I've asked four questions. To the first I received I received a very broad hint from which I was able to track down the solution myself. Something similar happened with the fourth. The second and third were the specific reasons I joined. I received a thoughtful response to the seco

ons I joined. I received a thoughtful respons
e to the third
0
 

Author Comment

by:sherleon
ID: 38891613
Sorry...I received a thoughtful response to the second, but I have no experience with CURL, so I requested a little more help and direction - nada. So I submitted another question with a specific request - a very valid one I might add. It not only was never answered, it never even got one expert's attention. Do you think I will be even remotely inclined to contine with my subscription??
0
 

Author Comment

by:sherleon
ID: 38920332
I respectfully ask why this question has never been addressed. It is a valid, timely, pertinent question begging for an answer. WHERE ARE YOU?
0
 
LVL 11

Expert Comment

by:G_H
ID: 38921029
Hi Sherleon,

OK, let's try and sort this out...

What stage have you got to? - Maybe to put this a better way, what data do you have and where.

I suspect you have a form which is submitted to another page - and you then need to deal with the data from the form?

If this is correct, can you please show us the form.

If not, can you let us know what data you have, where, and what you need to do with it next...

GH
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:sherleon
ID: 38921723
I've been looking for an answer to this question for years. When I submitted this , I still did not have a solution but subsequently found one that works but not as elegantly as it should. Here is how it now works.

All the form data is saved in a hidden form and all the entry charges are saved in a hidden Paypal form:

      <form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="paypalForm" target="paypal" id="paypalForm">
        <input type="hidden" name="nam1" value="European Championship - Early Registration" />
        <input type="hidden" name="amt1" value="250.00" />
        <input type="hidden" name="qty1" size="1" value="" />
        <input type="hidden" name="nam2" value="European and International Masters' Championships - Early Registration" />
        <input type="hidden" name="amt2" value="250.00" />
        <input type="hidden" name="qty2" size="1" value="" />
        <input type="hidden" name="nam3" value="World Championship - Early Registration" />
        <input type="hidden" name="amt3" value="500.00" />
        <input type="hidden" name="qty3" size="1" value="" />
        <input type="hidden" name="nam4" value="European Championship - Late Registration" />
        <input type="hidden" name="amt4" value="300.00" />
        <input type="hidden" name="qty4" size="1" value="" />
        <input type="hidden" name="nam5" value="European and International Masters' Championships - Late Registration" />
        <input type="hidden" name="amt5" value="300.00" />
        <input type="hidden" name="qty5" size="1" value="" />
        <input type="hidden" name="nam6" value="World Championship - Late Registration" />
        <input type="hidden" name="amt6" value="600.00" />
        <input type="hidden" name="qty6" size="1" value="" />
        <!--  The part sent to PayPal  -->
        <input type="hidden" name="cmd" value="_cart" />
        <input type="hidden" name="upload" value="1" />
        <input type="hidden" name="business" value="office@lightningclass.org" />
        <input type="hidden" name="currency_code" value="USD" />
        <input type="hidden" name="lc" value="US" />
        <input type="hidden" name="item_name_1" value="" />
        <input type="hidden" name="quantity_1" value="" />
        <input type="hidden" name="amount_1" value="" />
        <input type="hidden" name="item_name_2" value="" />
        <input type="hidden" name="quantity_2" value="" />
        <input type="hidden" name="amount_2" value="" />
        <input type="hidden" name="item_name_3" value="" />
        <input type="hidden" name="quantity_3" value="" />
        <input type="hidden" name="amount_3" value="" />
      </form>
      <form action="../../../../scripts/processWorldform.asp" method="post" name="emailForm" target='_self' id="emailForm">
        <input type="hidden" name="currentDate" value="" />
        <input type="hidden" name="title" value="" />
        <input type="hidden" name="firstName" value="" />
        <input type="hidden" name="midInit" value="" />
        <input type="hidden" name="lastName" value="" />
        <input type="hidden" name="suffix" value="" />
        <input type="hidden" name="sex" value="" />
        <input type="hidden" name="birthYear1" value="" />
        <input type="hidden" name="email" value="" />
        <input type="hidden" name="address" value="" />
        <input type="hidden" name="address2" value="" />
        <input type="hidden" name="city" value="" />
        <input type="hidden" name="stateProvince" value="" />
        <input type="hidden" name="country" value="" />
        <input type="hidden" name="zipCode" value="" />
        <input type="hidden" name="mobilePhone" value="" />
        <input type="hidden" name="affil" value="" />
        <input type="hidden" name="crewName1" value="" />
        <input type="hidden" name="crewEmail1" value="" />
        <input type="hidden" name="birthYear2" value="" />
        <input type="hidden" name="crewName2" value="" />
        <input type="hidden" name="crewEmail2" value="" />
        <input type="hidden" name="birthYear3" value="" />
        <input type="hidden" name="personsNo" value="" />
        <input type="hidden" name="arrivalDate" value="" />
        <input type="hidden" name="hullNo" value="" />
        <input type="hidden" name="boatName" value="" />
        <input type="hidden" name="hullColor" value="" />
        <input type="hidden" name="natLetters" value="" />
        <input type="hidden" name="sailNo" value="" />
        <input type="hidden" name="euroChamp" value="" />
        <input type="hidden" name="euroImasters" value="" />
        <input type="hidden" name="worlds" value="" />
        <input type="hidden" name="euroChamp2" value="" />
        <input type="hidden" name="euroImasters2" value="" />
        <input type="hidden" name="worlds2" value="" />
        <input type="hidden" name="signature" value="" />
        <input type="hidden" name="printInd" value="" />
        <input type="hidden" name="cmd" value="_cart" />
        <input type="hidden" name="upload" value="1" />
        <input type="hidden" name="business" value="office@lightningclass.org" />
        <input type="hidden" name="currency_code" value="USD" />
        <input type="hidden" name="lc" value="US" />
        <input type="hidden" name="item_name_1" value="" />
        <input type="hidden" name="quantity_1" value="" />
        <input type="hidden" name="amount_1" value="" />
        <input type="hidden" name="item_name_2" value="" />
        <input type="hidden" name="quantity_2" value="" />
        <input type="hidden" name="amount_2" value="" />
        <input type="hidden" name="item_name_3" value="" />
        <input type="hidden" name="quantity_3" value="" />
        <input type="hidden" name="amount_3" value="" />
        <input name="redirect" type="hidden" id="redirect" value="" />
        <input name="mailfrom" type="hidden" id="mailfrom" value="office@lightningclass.org" />
        <input name="mailto" type="hidden" id="mailto" value="office@lightningclass.org" />
        <input name="subject" type="hidden" id="subject" value="Website Form Submission: World Championship Entry Form" />
        <input name="template" type="hidden" id="template" value="" />
        <input name="html" type="hidden" id="html" value="yes" />
        <input name="testmode" type="hidden" id="testmode" value="no" />
      </form>

The way I've now programmed it, the Paypal descriptions and charges are determined and then stored in the "emailForm." This form is passed to a VBScript page that does four things:
1.  Logs all the information to a text file.
2.  Emails all the information to the applicant(s) and the executive secretary.
3.  Saves the data in an Access table.
4.  Submits information to Paypal for payment.

Storing the information in a database is a newly added function and may replace the logging. The question I've submitted relates to the Paypal submission. Someone recommended that I use a CURL command, but I haven't been able to figure out how that is supposed to work. After hours of searching the web (as I have many times in the past) I found others searching for the same solution but with few workable answers. What I finally found that worked is this:
      
      paypalurl = "https://www.paypal.com/cgi-bin/webscr?cmd=_cart&upload=1&business=office@lightningclass.org&lc=US&item_name_1="+item1+"&quantity_1="+quant1+"&amount_1="+amt1+"&item_name_2="+item2+"&quantity_2="+quant2+"&amount_2="+amt2+"&item_name_3="+item3+"&quantity_3="+quant3+"&amount_3="+amt3+"&item_name_4="+item4+"&quantity_4="+quant4+"&amount_4="+amt4+"&item_name_5="+item5+"&quantity_5="+quant5+"&amount_5="+amt5+"&item_name_6="+item6+"&quantity_6="+quant6+"&amount_6="+amt6+"&item_name_7="+item7+"&quantity_7="+quant7+"&amount_7="+amt7+"&item_name_8="+item8+"&quantity_8="+quant8+"&amount_8="+amt8+"&item_name_9="+item9+"&quantity_9="+quant9+"&amount_9="+amt9+"&item_name_10="+item10+"&quantity_10="+quant10+"&amount_10="+amt10+"&item_name_11="+item11+"&quantity_11="+quant11+"&amount_11="+amt11+"&currency_code=USD&cancel_return=http://www.lightningclass.org/racing/calendar/entryForms/2013/socirThankyou.asp&target='_self'"
      response.write ("<meta http-equiv=" & chr(34) & "refresh" & chr(34) & " content=" & chr(34) & "0;url=" & paypalurl & chr(34) & ">")

As far as I can tell, this is working in all browsers. The only remaining problem is that the response.write appears to cause the log data to flash on the screen prior to the handoff to Paypal. I apologize for my frustration, but there have to be thousands of sights doing this exact thing, but I still don't have a clean submit. Any suggestions would be greatly appreciated.
0
 
LVL 11

Accepted Solution

by:
G_H earned 500 total points
ID: 38922878
There are two forms in the code you provided, which one of these is intended to be submitted, and to where? - You can only submit ONE form at a time...

Also, for the PayPalURL which you create, a neater way would be to do a redirect, rather than the Meta-Refresh:

NOT: response.write ("<meta http- blah blah

INSTEAD: response.redirect PayPalURL

Let me know about the forms...

GH
0
 

Author Comment

by:sherleon
ID: 38923657
You know what - you did it! I think I tried the redirect several weeks ago and couldn't get it to work - probably because I did it wrong.

Just to summarize, this has been the crux of the problem - needing to submit two forms. When I put the application together several years ago I was doing 2 submits: one to Paypal and one to generate emails. That still works fine in IE but not in all the other browsers, notably Chrome. So I concluced that the only solution would be to log, save to db, email and submit to Paypal in the VBScript. And that was the question - how to accomplish the submit in VBScript. After days of searching, I found a post from someone seeking the same type of solution and I followed his suggestions. The response.write works but not as I'd like it to.

In VBScript, I'm not submitting an actual form. I'm assembling the Paypal information in the application page and then passing the values in the email form to the VBScript. Here is what is working:

paypalurl = "https://www.paypal.com/cgi-bin/webscr?cmd=_cart&upload=1&business=office@lightningclass.org&lc=US&item_name_1="+item1+"&quantity_1="+quant1+"&amount_1="+amt1+"&item_name_2="+item2+"&quantity_2="+quant2+"&amount_2="+amt2+"&item_name_3="+item3+"&quantity_3="+quant3+"&amount_3="+amt3+"&item_name_4="+item4+"&quantity_4="+quant4+"&amount_4="+amt4+"&item_name_5="+item5+"&quantity_5="+quant5+"&amount_5="+amt5+"&item_name_6="+item6+"&quantity_6="+quant6+"&amount_6="+amt6+"&item_name_7="+item7+"&quantity_7="+quant7+"&amount_7="+amt7+"&item_name_8="+item8+"&quantity_8="+quant8+"&amount_8="+amt8+"&item_name_9="+item9+"&quantity_9="+quant9+"&amount_9="+amt9+"&item_name_10="+item10+"&quantity_10="+quant10+"&amount_10="+amt10+"&item_name_11="+item11+"&quantity_11="+quant11+"&amount_11="+amt11+"&currency_code=USD&cancel_return=http://www.lightningclass.org/racing/calendar/entryForms/2013/socirThankyou.asp&target='_self'"

response.redirect paypalurl

Frustration and desperation do strange things to the thought process. I'm going to do some more testing, but I think the problem is solved.
0
 
LVL 11

Expert Comment

by:G_H
ID: 38923953
Great news!

From a "best practice" point of view, I always put the info into a database to stop people tampering with the hidden form elements. But if it's not broke...

GH
0
 

Author Closing Comment

by:sherleon
ID: 38932385
I find this interesting that I'm being pressed to close. I asked the question on 2/1. On 2/14 it hadn't even yet been addressed. I got a hint of an answer on 2/22.  In the end I found the solution myself. My specific question was never addressed.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Are you using email marketing software? If not, you're missing out on effortless marketing and the reaching of desired conversion rates through email marketing software.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now