IPN Paypal with javascript -
i want use paypal ipn website, using javascript, not know value of "e" on function dopost(e). how script in place in .html or .js listen.
and please if can way other references?
function dopost(e) { var isproduction = false; var strsimulator = "https://www.sandbox.paypal.com/cgi-bin/webscr"; var strlive = "https://www.paypal.com/cgi-bin/webscr"; var paypalurl = strsimulator; if (isproduction) paypalurl = strlive; var payload = "cmd=_notify-validate&" + e.postdata.contents; payload = payload.replace("+", "%2b"); var options = { "method" : "post", "payload" : payload, }; var resp = urlfetchapp.fetch(paypalurl, options); //handshake paypal - send acknowledgement , verified or invalid response if (resp == 'verified') { if (e.parameter.payment_status == 'completed') { if (e.parameter.receiver_email == 'receiver@email.com') { //implement paid amount validation. if accepting payments in multiple currencies, use e.parameter.exchange_rate convert reference currency (usd) if paid in other currency if (amountvalid) { //all validated - can process payment here if (!(processsuccess)) { //process of payment failed - raise notification check out } } else { //payment not equal expected purchase value } } else { //request did not originate paypal account } } else { //payment status not completed } } else { //paypal response invalid } }
Comments
Post a Comment