Skip to main content

Notifications

Dynamics 365 Community / Forums / Commerce forum / Payment connector - ho...
Commerce forum
Unanswered

Payment connector - how to call method "ExecuteTask"

Posted on by 4
Hi,
 
I have a payment connector for a payment device (INamedRequestHandler) and that holds a method called "ExecuteTask".

The description for "ExecuteTask" is as follows:

_This extension request can be invoked from the POS through customizations. It is used to enable additional payment-related flows._
 
I want to create a new button on the POS and when the user pushes that button I want to call this "ExecuteTask" method so that this method can execute a certain task on my payment device.

Can someone please advice me how to approach this or perhaps share a code sample where I can see how this "ExecuteTask" method is called?
 
Any help is welcome.
 
Thx in advance!
 
 
  • LC-01111219-0 Profile Picture
    LC-01111219-0 3 on at
    Payment connector - how to call method "ExecuteTask"
    I would just like to comment and confirm that I have tried out this solution and it works really well! 
    Thank you for this response! 
  • Suggested answer
    Oksana Kovaliova Profile Picture
    Oksana Kovaliova 3,595 on at
    Payment connector - how to call method "ExecuteTask"
    Dear Mica
     
    Please, see a sample below (call it from POS).
    1) taskName is your task name you will define in Payment device class
    2) Input - any input parameters you need to do for task.
     
    import { PaymentTerminalExecuteTaskResponse, PaymentTerminalExecuteTaskRequest } from "PosApi/Consume/Peripherals";

    public async executeTask(taskName: string, input: ClientEntities.IExtensionTransaction): Promise<void> {
            var success = true;
            var taskRequest = new PaymentTerminalExecuteTaskRequest<PaymentTerminalExecuteTaskResponse>(taskName, input);
            var taskResponse = await this.context.runtime.executeAsync(taskRequest);
            var output = [];
            var errorMessage = '';
            var anyResult: any = taskResponse.data.result;
            if (anyResult.ExtensionProperties != undefined) {
                output = anyResult.ExtensionProperties;
                
                //Implement exception handling in a way how it works for you 
            }
            return Promise.resolve(); //Return any data needed for you here
        }

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

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,802 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,133 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,154

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans