Skip to content

    Payment Cloud-Authentication

    Payment

    Payment

    The payment can be run by calling the pay method.

    pay

    suspend fun pay(    
    
        paymentData: PaymentData, 
        operationListener: OperationListener

    The pay method takes an instance of PaymentData as an argument and an operationListener, which will propagate the operation outcome to the caller application.

    PaymentData

    data class PaymentData( 
    
    val amount: String?,

    OperationListener

    interface OperationListener { 
    
        fun onSuccess(response: A2ASDKResponse? = null)

    A2ASDKResponse

    data class A2ASDKResponse(   
    
    @SerializedName("isSuccess")

    In OnSuccess callback, the exception field will contain a null value.

    In OnFailure callback, the exception will be filled with an A2AException instance. In case of NetworkException, the HTTP error code and reason will be sent through errorCode and errorMessage fields. For any other error, the errorMessage field will be filled with a specific error message.

    PaymentData

    The PaymentData is a class used for holding information related to a payment. Each property in the class corresponds to a different aspect of the payment. PaymentData class properties are detailed below:

    Name parameter Description Type Mandatory
    amount Represents the amount of the payment in cents String yes
    callerTrxId Represents the transaction ID associated with the caller String yes
    isSendTicket Flag that enables the display of the send receipt button on transaction result Boolean yes
    isUrlTicket ***Indicates whether the ticket is a URL link Boolean yes
    callerName Represents the name of the caller initiating the payment String yes
    addInfoMap
    Additional information fields that can be included with the payment Map<String, String>yes
    email Represents the email associated with the payment String yes
    sms Represents the SMS information associated with the payment String yes
    autoClose
    This flag hides the CTA on the payment result screen and allows the user to be automatically redirected back to the merchant app
    Boolean no
    hideRetryFlag that hides the retry button in case of timeout, Wrong PIN and transaction cancelledBooleanno

    *** Available only for MobilePOS

    Additional Parameters Map

    The addInfoMap field allows the caller app to send custom parameters related to the payment as key-value String pairs. Each key-value must be valid. Validation rules: • Length between 1 and 30 characters • Allowed characters are numbers, letters, a set of special characters !$%&()*+-./:;<=>?@[]^_{} • Keys must be unique, otherwise the repeated keys will be ignored. If any invalid pair is found within the request, the app will send the error -1 (Invalid input parameters). In case of successful validation and transaction, additional parameters will be returned inside the response and in Get Last Transaction API response.

    Retryable Transaction Result

    A retryable transaction result occurs when the transaction can be retried. Examples:

    • Transaction canceled
    • Card read timeout
    • Wrong pin

    This result requires a user interaction, more precisely the tap on “Retry”. Hence, the autoClose flag "alone" will not affect the flow in this case, so if the developer wants to redirect automatically has to combine autoClode and hideRetry.

    For not retryable ones, like a successful transaction or denied transaction, if autoClose value is true, the app will show the outcome animation and then close itself automatically. The caller app will receive the transaction data via deeplink.

    Since autoClose flag implies the buttons hiding and the isSendTicket implies the visualization of “send ticket” button, the usage of both together will NOT be allowed. If isSendTicket and autoClose are requested within the same session (both are true), the application will send the error “-21”.

    NB: The default isSendTicket value is true for backward compatibility, so to use the autoClose feature it is mandatory to specify the value isSendTicket false.

    (SoftPOS) Payment response example:

    demonexi://payment?amount=00000000 0500&callerTrxId=316874221216&operationType=PAYMENT&f30=00000000 0500&F42=1000000278548%20%20&f12=171433&f11=000784&f55=9F36020345910A8113BDBAE2392050 0012&CT121=PIAZZA%20ARCOLE%20100%2C%2020143%2C%20MILANO%20(MI)&f13=210901&CT120=LA %20PATENTE%20(E- MAIL%2012)&f38=362077&9F14=1100&f37=424717057296&f39=000&CT118=978&CT117=Online&CT116 =00034&CT115=Contactless&CT114=NEXI%20Core&CT112=************5291&CT111=0&acquirerId=909 517&CT119=Grazie%20e%20arrivederci&f41=02546095&f43=LA%20PATENTE%20(E- MAIL%2012)%20PIAZZA%20ARCOLE%20100%2C%2020143%2C%20MILANO%20(MI)&f42=1000000278548 %20%20&CT110=2024-09- 03T17%3A14%3A36%2B02%3A00&f04=000000000500&CT107=17%3A14&CT106=03%2F09%2F2024&CT10 5=0100&CT104=LA%20PATENTE%20(E- MAIL%2012)%20PIAZZA%20ARCOLE%20100%2C%2020143%2C%20MILANO%20(MI)&CT103=42471705729 6&CT102=A0000000041010&CT101=96&CT123=9F360203459F2608D19D309F9058D6639F37046FCA3A23 95050000008001&CT100=5291&CT109=Mastercard&CT108=Mastercard&result=0&terminalId=02546095

    (MobilePOS) Payment response example: app2appDemo://paymentResult?callerTrxId=1234&operationType=PAYMENT&amount=200&result=0&actionCode=000&pan=************8819&transactionType=CLI&authorizationNumber=870316&timestamp=0407250930&resultDescription=TRANSAZIONE APPROVATA&cardTypeCVM=2&acquirerId=00000000054&stan=000008&operationNumber=000026&acquirerName=NEXI&terminalId=37063169&merchantId=1929312&urlTicket=https://mpos.nexi.it/r?id=DICJHGMNIJKLOTOTAIEIEOJH

    For the complete list of receipt parameters, refer to the Receipt paragraph in the App2App User Authentication section

    Was this helpful?

    What was your feeling about it?