var ultimatePayParams; var pbcHash; function buy(price, points) { new Ajax.Request('/pbchash.php', { method: 'GET', parameters: {userid: , price: price}, onComplete: function(returned) { pbcHash = returned.responseText; ultimatePayParams = { "method" : "StartOrderFrontEnd", "display" : "Lightbox", "sn" : "SUBU", "userid" : "", "accountname" : "", "livemode" : "T", "currency" : "USD", "sepamount" : price, "amountdesc" : points+" Cash Shop Credits", "mirror" : points, "xdurl" : "//subeta.net/xd_pbc.html", "hash" : pbcHash }; ulp.ultimatePay = true; ulp.upLiveUrl = 'https://www.ultimatepay.com/app/api/live/?'; ulp.displayUltimatePay(); } }); } ulp.on('closeLB',function(data) { ultimatepayPostProcess(data); /* Do your processing here on close Lightbox */ });