White-label App SDK
API Reference
HeadlessService

HeadlessService

Overview

The HeadlessService object provides some methods for performing network action, such as requesting actions or retrieving transactions.

The service would fetch the request provided in the background and return the result. No UI will be shown.

Methods

createAction

This is a suspended method and should be called within a coroutine.

Creates an action using the provided PoiRequest.

Parameters

NameTypeConditionDescription
actionPoiRequestRequiredThe point of interaction request.

Returns

Return TypeDescription
Result<Transaction>The result of the transaction creation.

Usage

// in coroutine scope
val voidAction = PoiRequest.ActionVoid("tran_123456")
val actionResult = HeadlessService.createAction(voidAction)
// Result<Transaction>

getTransaction

This is a suspended method and should be called within a coroutine.

Retrieves a transaction based on the provided reference.

Parameters

NameTypeConditionDescription
referenceReferencableRequiredThe reference to identify the transaction.

Returns

Return TypeDescription
Result<Transaction>The result of the transaction retrieval.

Usage

// in coroutine scope
 
val tranId = Referencable.TranId("tran_123456")
val getTranByTranId = HeadlessService.getTransaction(tranId)
// Result<Transaction>
 
val posReference = Referencable.PosReference("your-pos-reference")
val getTranByPosReference = HeadlessService.getTransaction(posReference)
// Result<Transaction>