![]() |
|
| |||||||
| Notices |
| PayPal Shopping Cart Creator This section is dedicated to setting up your PayPal shopping cart in the BlueVoda Website Builder for single item purchases, multi-item shopping cart purchases, subscription creations and donations. |
![]() |
| | Thread Tools |
|
#1
| |||
| |||
|
To execute a simple NVP Operation to paypal such as: Code: https://www.sandbox.paypal.com/webscr &cmd=_express-checkout&token=tokenValue &AMT=amount &CURRENCYCODE=currencyID &RETURNURL=return_url &CANCELURL=cancel_url Code: Executing NVP API Operations You execute an PayPal NVP API operation by submitting an HTTP POST request to a PayPal API server. Code: http://www.w3schools.com/ajax/ajax_xmlhttprequest.asp
<html>
<body>
<script type="text/javascript">
function SubmitOrderToPaypal()
{
var xmlhttp;
var strUrl;
strCmd = "https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token=tokenValue&AMT=amount
&CURRENCYCODE=currencyID&RETURNURL=return_url&CANCELURL=cancel_url";
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
alert("Your browser does not support XMLHTTP!");
}
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
{
document.myForm.time.value=xmlhttp.responseText;
}
}
xmlhttp.open("POST",strURL,true);
xmlhttp.onreadystatechange=handleResponse;
xmlhttp.send(null);
}
function handleResponse()
{
if (xmlhttp.readyState==4)
{
// TODO: How to parse Paypal response? Is this how response from Paypal is communicated?
document.getElementById("txtPaypalResponse").innerHTML=xmlhttp.responseText;
}
}
</script>
<form name="myForm">
<input type="image" name="submit" onclick="SubmitOrderToPaypal();" border="0"
src="https://www.paypal.com/en_US/i/btn/btn_buynow_**.gif"
alt="PayPal - The safer, easier way to pay online">
</form>
</body>
</html> Many thanks REF: Web Site Pro Integration Guide https://cms.paypal.com/cms_content/U...ationGuide.pdf |
|
#2
| |||
| |||
|
Seems like Paypal response is also in form of POST/NVP formatted query string: Code: Interpret the Response PayPal processes your request and posts back a reponse in NVP format. Add code to your web application to do the following tasks: 1. Receive the HTTP post response, and extract the NVP string. 2. URL-decode the parameter values as described in “URL-Encoding” on page 14. 3. Take appropriate action for successful and failed reponses. |
|
#3
| |||
| |||
|
Paypal doc here: https://cms.paypal.com/us/cgi-bin/?c..._documentation |
|
#4
| ||||
| ||||
|
What are you trying to integrate to? This isnt a button code that you just generate.. this is for incorporation to a database driven cart system. Karen
__________________ KMAC Enterprise Missouri Free Classified Ads Charming Noveltees~Sports Logos Charms ![]() ![]() I've learned that artificial intelligence is no match for natural stupidity! |
|
#5
| |||
| |||
|
thanks, and yes my app/shopping cart is database driven but i don't see how this has to do with above code fragment. I'm using "Pro Integration" as supposed to "Standard Integration" - I *think* [Am I right?] it allows Direct Payment - i.e. accept credit card without leaving my site. Now, with Pro Integration {whether "Direct Payment API" or "Express"} you'd need to send request to Paypal and receive response from Paypal. I suppose you're NOT going to navigate away from your site [Am I right?], which is why AJAX comes in. Send a request via POST, then AJAX handler will invoke "handleResponse" (then parse response query string to stripped out Paypal Name-value pairs response code). Now, this should be same whether your cart items are hard coded on your webpage or dynamically rendered as driven by database. |
|
#6
| ||||
| ||||
|
So.. what are you using for your site? This will determine how you set up the AJAX handler. If you are using blue voda then you will have to have this CUSTOM done and use a data base driven system for the cart to sum totals, hold those totals and checkout on your site and transmit the information to paypal. This can be done on a form for EACH and every product.. but again.. you will need special programming for this. You will also need ssl and dedicated ip. Karen
__________________ KMAC Enterprise Missouri Free Classified Ads Charming Noveltees~Sports Logos Charms ![]() ![]() I've learned that artificial intelligence is no match for natural stupidity! |
|
#7
| |||
| |||
|
Thanks and sorryi just got started with paypal after reading for a day I think I know how to do standard integration/request/IPN and encrypted website payments now... i would have hoped paypal doc be more straight forward in certain places. Couple of examples which don't compile (bad ref to capicom dll or needing a header buffer.h from OpenSSL). And "Encrypt button code" in their doc was so misleading because it really is form hidden param which you're encrypting in Website Payment Encryption, not button code. And doc don't get me started fast it was overall a time consuming experience forsomething simple. Particularly their code samples is a waste of time glad i found samples (documented too) elsewhere so I don't need to re-engineer the wheel. and why you say you need fix IP? Can I use dynamic ip with mapped domain? Anyway thanks. |
|
#8
| ||||
| ||||
|
In order to process credit cards onsite it is a REQUIREMENT. You must have dedicated ip for encryption and ssl. You also must comply with PCI requirements set forth by the credit card industry itself for accepting and recieving payment for your services or products. This requires a background investigation and a credit check! Since you have paypal pro set up.. i suggest you read their information on what is required for maintaining their services for ONSITE payments Theres much more to it than simply integrating it and jumping on the band wagon Karen
__________________ KMAC Enterprise Missouri Free Classified Ads Charming Noveltees~Sports Logos Charms ![]() ![]() I've learned that artificial intelligence is no match for natural stupidity! |
|
#9
| |||
| |||
|
great so this is actually compliance issue. Thanks for tip, I'm now doing Standard Integration as supposed to Direct Payments and have spotless credit record (up to now!) biz registration will come soon. SSL and perhaps dedicated IP after... |
|
#10
| ||||
| ||||
| Quote:
Karen
__________________ KMAC Enterprise Missouri Free Classified Ads Charming Noveltees~Sports Logos Charms ![]() ![]() I've learned that artificial intelligence is no match for natural stupidity! |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |