Refund

Handling Refunds with the SDK

Overview: Processing refunds is a crucial functionality for any payment gateway or service. Within our SDK, while the underlying mechanics resemble payment transactions, there are some nuances to consider for refunds. Let's delve into how the Prophius SDK manages refund operations.

1. Preliminary Steps for Refunds:

  • Receipt Collection:

    • Purpose: To have a concrete reference for the transaction being refunded.

    • Action: The merchant must request the payment receipt from the customer. This receipt contains essential transaction details, most crucially, the transaction code.

  • Transaction Search:

    • Purpose: To locate the specific transaction in the system and ensure it's valid for a refund.

    • Action: Using the provided transaction code from the receipt, the merchant searches for the corresponding transaction using refundInquiry function of the SDK.

Transaction Inquiry for Refund

This function is used to search for a specific transaction in the system in order to perform a refund inquiry.


API Method

PayContactlessEmbed.getInstance()
    .refundInquiry(
        transactionCode: String?,
        listener: InquiryListener
    )

Description

Initiates a refund inquiry request using a transaction reference code and returns the result asynchronously via a callback listener.


Method Parameters

Field Name
Data Type
Required
Description

transactionCode

String

false

Unique transaction reference code used to identify the transaction. If null, the system may attempt to resolve the transaction context automatically.

listener

InquiryListener

true

Callback interface to receive the inquiry result or error response.


Inquiry Listener

The InquiryListener interface is used to receive the refund inquiry response.

Kotlin Interface


InquiryListener Callbacks

onSuccess

Field Name
Data Type
Required
Description

transaction

InquiryResult

true

Contains the transaction details returned from the refund inquiry request.

onFailure

Field Name
Data Type
Required
Description

error

Error

true

Error object describing the reason the refund inquiry failed.


Inquiry Result Model

Kotlin Data Class


InquiryResult Fields

Field Name
Data Type
Required
Description

cardNumber

String

false

Masked card number associated with the original transaction.

amount

Double

true

Transaction amount for which the refund inquiry was performed.

currency

Int

true

Numeric ISO 4217 currency code of the transaction (e.g., 566 for NGN).

Last updated