web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Payment Gateway API Call

(0) ShareShare
ReportReport
Posted on by

Dear NAV guru,

Have any of you tried writing a code to send payment request to Payment Gateway through REST API?

The idea is to click a button in NAV on the customer ledger entries page to charge customer on a particular invoice and this will send a request to the payment gateway to charge the customer.


I would love to use dynamicsonline however Australia is not in the list of countries that the service is available.

Regards,


Susy

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Andrey Baludin Profile Picture
    3,943 on at

    Hi Susy.

    You need some .Net for it.

    For example:

    LOCAL PROCEDURE SendRequest@1000000001();
        VAR
          _HttpWebRequest@1000000001 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Net.HttpWebRequest" RUNONCLIENT;
          _WebResponse@1000000002 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Net.WebResponse" RUNONCLIENT;
          _XMLRequestDoc@1000000004 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlDocument" RUNONCLIENT;
          _XMLElement@1000000007 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlElement" RUNONCLIENT;
          _XMLNode@1000000010 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlNode" RUNONCLIENT;
          _XMLResponseDoc@1000000006 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlDocument" RUNONCLIENT;
          _MemoryStream@1000000005 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.IO.MemoryStream" RUNONCLIENT;
        BEGIN
          CLEAR(_HttpWebRequest);
          CLEAR(_MemoryStream);
          CLEAR(_WebResponse);
          CLEAR(_XMLElement);
          CLEAR(_XMLNode);
          CLEAR(_XMLRequestDoc);
          CLEAR(_XMLResponseDoc);
    
          _XMLRequestDoc := _XMLResponseDoc.XmlDocument;
    
          _XMLElement := _XMLRequestDoc.CreateElement('ROOT');
    
          _XMLNode := _XMLRequestDoc.CreateElement('myrequest');
          _XMLNode.InnerText := 'request text';
          _XMLElement.AppendChild(_XMLNode);
    
          _XMLRequestDoc.AppendChild(_XMLElement);
    
          _HttpWebRequest := _HttpWebRequest.Create('paste api url here');
          _HttpWebRequest.Timeout := 30000;
          _HttpWebRequest.UseDefaultCredentials(TRUE);
          _HttpWebRequest.Method := 'POST';
          _HttpWebRequest.ContentType := 'application/xml';
          _HttpWebRequest.Accept := 'application/xml';
          _MemoryStream := _HttpWebRequest.GetRequestStream;
          _XMLRequestDoc.Save(_MemoryStream);
          _MemoryStream.Flush;
          _MemoryStream.Close;
    
          _WebResponse := _HttpWebRequest.GetResponse;
          _MemoryStream := _WebResponse.GetResponseStream;
          _XMLResponseDoc := _XMLResponseDoc.XmlDocument;
          _XMLResponseDoc.Load(_MemoryStream);
          _MemoryStream.Flush;
          _MemoryStream.Close;
        END;


    This way you'll get Response XML in _XMLResponseDoc object and you could parse it to get the needed data.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,269 Super User 2026 Season 1 on at

    Please check 1297, 1298 and 1290 codeunits for how to call REST API. Are you trying to write a custom moduel to send the payment information to the payment gateway ? If so , you need to consider PCI Compliance, security....

    You can check for add-ons which provides these services.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans