Skip to content

    Payment Cloud

    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( <br>
    val amount: String?,<br>
    val callerTrxId: String?,<br>
    val isSendTicket: Boolean,<br>

    OperationListener

    interface OperationListener { <br>
        fun onSuccess(response: A2ASDKResponse? = null) <br>
    
        fun onFailure(error: A2ASDKResponse? = null) }

    A2ASDKResponse

    data class A2ASDKResponse(     
    @SerializedName("isSuccess") val isSuccess: Boolean,     
    @SerializedName("exception") val exception: A2AException? 
    )

    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
    addInfo1 Additional information fields that can be included with the payment String yes
    addInfo2 Additional information fields that can be included with the payment String yes
    addInfo3 Additional information fields that can be included with the payment String yes
    addInfo4 Additional information fields that can be included with the payment String yes
    addInfo5 Additional information fields that can be included with the payment String yes
    email Represents the email associated with the payment String yes
    sms Represents the SMS information associated with the payment String yes
    autoClose Flag that hides the buttons on transaction result and allows the application to automatically go back to caller application ONLY for not retryable transactions result Boolean no

    *** Available only for MobilePOS

    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 will not affect the flow in this case.

    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.

    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

    Was this helpful?

    What was your feeling about it?