JavaScript

Parent Previous Next

When using JavaScript, the easiest (but certainly not the only) way to call the PayGate DDMS REST API is using JQuery:

     

function updateFinalAmount() {

           var json = {

               "Username": "myUserName",

               "Password": "myPassword",

               "ApiKey": "myApiKey",

               "PayerReference": "T1-1000",

               "Amount": 22.22,

               "DateFrom": "1/11/2017"

               };


           var settings = {

               "async": true,

               "crossDomain": true,

           "crossOrigin": true,

               "url": "https://enterprise.paygate.cloud/ddmsapi/api/Payer/UpdateFinalAmount",

               "method": "POST",

               "headers": {

                 "content-type": "application/json",

                 "cache-control": "no-cache",

                 "Access-Control-Allow-Origin": "*",

                 "Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept",

                 "Access-Control-Allow-Methods": "GET, PUT, POST"

               },

               "processData": false,

               "data": JSON.stringify(json)

             }


           $.ajax(settings).done(function (response) {

               console.log(response);

           });

       }