Using (migrating from

(Rahul Varshney ) #1

Hello, I am trying to port my code over from (which was using lua) to which uses javascript and node-js (and many other node modules ) . I was using my app ( – this is an html version and not the original lustache version that was hosted on webscript) to make payments (in production mode) as recently as November 30, 2017. Webscript shut down on December 15, 2017, so here I am.

The code below is what I have so far ported over as a webtask script; this is the portion of the code that was called when “Pay with Bank” was clicked, originally calling the webscript endpoint This will now be calling once I get it working.

The result *** is the following error:
{“Result”:“Failure”,“Message”:“Invalid destination user.”}

I have seen this article:

and have tried the different endpoints mentioned, but no luck.

Any help is greatly appreciated.

====Begin code at ****
var request = require(‘request’);

return function (context, callback) {

var destinationId;
var url;
var client_id;
var client_secret;

destinationId = ‘8127418252’;
url = ‘’;

client_id = 'CLIENT ID';
client_secret = 'CLIENT SECRET';

var checkout = {
orderId : 1,
purchaseOrder : {
destinationId : destinationId,
total : ‘11.26’

var payload = {
url: url,
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’//;charset=utf-8’
json: true,
body: {
Key : client_id,
Secret : client_secret,
callback : “”,
redirect : “”,
purchaseOrder : checkout,
allowGuestCheckout : “true”,
allowFundingSources : “true”,
orderId : checkout.orderId

request(payload, function (error, res, body) {
if (error) console.log('ERROR: ', error);
else console.log(‘SUCCESS’);

callback(error, body);


(Spencer Hunter) #2

@RahulVarshney, purchaseOrder is an object that contains destinationId and total. Take a look at the example raw HTTP request below. I included the latest request URL that you should be calling as well.

Content-Type: application/json

  "client_id": "CLIENT ID",
  "client_secret": "CLIENT SECRET",
  "allowFundingSources": true,
  "allowGuestCheckout": true,
  "redirect": "",
  "callback": "",
  "purchaseOrder": {    
    "destinationId": "812-xxx-xxxx",
    "total": 9,
    "notes": "A note on this order",
	"metadata": {
        "foo": "bar",
        "bar": "baz"

(Rahul Varshney ) #3



Love u guys. Thought this bug was going to set me back another week.

Happy new Years folks! :fireworks::sparkler::tada: