Skip to main content

Notifications

Announcements

No record found.

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

Payment connector - how to call method "ExecuteTask"

Posted on by 2
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!
 
 
  • 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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 228,914 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,150

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans