Comment on page
SDK Models
classes reference
NearPay services compatible with devices running Android API 26 or higher, otherwise UNSUPPORTED_SDK_VERSION will returned.
Kotlin
Json
@Parcelize
@Serializable
data class TransactionReceipt(
@SerialName("id")
val receipt_id: String,
@SerialName("transaction_uuid")
val transaction_uuid: String,
@SerialName("merchant")
val merchant: Merchant,
@SerialName("start_date")
val start_date: String,
@SerialName("start_time")
val start_time: String,
@SerialName("card_scheme_sponsor")
val card_scheme_sponsor: String,
@SerialName("tid")
val tid: String,
@SerialName("system_trace_audit_number")
val system_trace_audit_number: String,
@SerialName("pos_software_version_number")
val pos_software_version_number: String,
@SerialName("retrieval_reference_number")
val retrieval_reference_number: String,
@SerialName("card_scheme")
val card_scheme: NameField<String>,
@SerialName("transaction_type")
val transaction_type: NameField<String>,
@SerialName("pan")
val pan: String,
@SerialName("card_expiration")
val card_expiration: String,
@SerialName("amount_authorized")
val amount_authorized: LabelField<String>,
@SerialName("amount_other")
val amount_other: LabelField<String>,
@SerialName("currency")
val currency: LocalizationField,
@SerialName("status_message")
val status_message: LocalizationField,
@SerialName("is_approved")
val is_approved: Boolean,
@SerialName("is_refunded")
val is_refunded: Boolean,
@SerialName("is_reversed")
val is_reversed: Boolean,
@SerialName("approval_code")
val approval_code: LabelField<String>?,
@SerialName("verification_method")
val verification_method: LocalizationField,
@SerialName("end_date")
val end_date: String,
@SerialName("end_time")
val end_time: String,
@SerialName("receipt_line_one")
val receipt_line_one: LocalizationField,
@SerialName("receipt_line_two")
val receipt_line_two: LocalizationField,
@SerialName("thanks_message")
val thanks_message: LocalizationField,
@SerialName("save_receipt_message")
val save_receipt_message: LocalizationField,
@SerialName("entry_mode")
val entry_mode: String,
@SerialName("action_code")
val action_code: String,
@SerialName("application_identifier")
val application_identifier: String,
@SerialName("terminal_verification_result")
val terminal_verification_result: String,
@SerialName("transaction_state_information")
val transaction_state_information: String,
@SerialName("cardholader_verfication_result")
val cardholader_verfication_result: String,
@SerialName("cryptogram_information_data")
val cryptogram_information_data: String,
@SerialName("application_cryptogram")
val application_cryptogram: String,
@SerialName("kernel_id")
val kernel_id: String,
@SerialName("payment_account_reference")
val payment_account_reference: String?,
@SerialName("pan_suffix")
val pan_suffix: String?,
@SerialName("created_at")
val created_at: String? = "",
@SerialName("updated_at")
val updated_at: String? = "",
@SerialName("qr_code")
val qr_code: String
): Parcelable
{
"id": "19f9524d-407a-4d28-bd1e-89e7fb821598",
"merchant": {
"id": "100000000000001",
"name": {
"arabic": "123455",
"english": "NearPay-Test Terminal INMA"
},
"address": {
"arabic": "4321",
"english": "KAFD"
},
"category_code": "0763"
},
"card_scheme": {
"name": {
"english": "Visa",
"arabic": "فيزا"
},
"id": "VC"
},
"card_scheme_sponsor": "INMA",
"start_date": "06/11/2022",
"start_time": "16:11:09",
"end_date": "06/11/2022",
"end_time": "16:11:09",
"tid": "0200010400000104",
"system_trace_audit_number": "000043",
"pos_software_version_number": "1.0.0",
"retrieval_reference_number": "000000002031",
"transaction_type": {
"name": {
"arabic": "شراء",
"english": "PURCHASE"
},
"id": "00"
},
"is_approved": true,
"is_refunded": false,
"is_reversed": false,
"approval_code": {
"value": "587117",
"label": {
"arabic": "رمز الموافقة",
"english": "Approval Code"
}
},
"action_code": "000",
"status_message": {
"arabic": "مقبولة",
"english": "Approved"
},
"pan": "4639 17** **** 3838",
"card_expiration": "23/02",
"amount_authorized": {
"label": {
"arabic": "مبلغ الشراء",
"english": "PURCHASE AMOUNT"
},
"value": "0.01"
},
"amount_other": {
"label": {
"arabic": "مبلغ النقد",
"english": "NAQD AMOUNT"
},
"value": "0.00"
},
"currency": {
"arabic": "ر.س",
"english": "SAR"
},
"verification_method": {
"english": "NO VERIFICATION REQUIRED",
"arabic": "لا يتطلب التحقق"
},
"receipt_line_one": {
"arabic": "",
"english": ""
},
"receipt_line_two": {
"arabic": "",
"english": ""
},
"thanks_message": {
"arabic": "شكرا لاستخدامكم مدى",
"english": "Thank you for using mada"
},
"save_receipt_message": {
"arabic": "يرجى الاحتفاظ بالفاتورة",
"english": "please retain receipt"
},
"entry_mode": "CONTACTLESS",
"application_identifier": "A0000000031010",
"terminal_verification_result": "2480403800",
"transaction_state_information": "0000",
"cardholader_verfication_result": "1F0000",
"cryptogram_information_data": "80",
"application_cryptogram": "1D6B44271DC4A690",
"kernel_id": "03",
"payment_account_reference": "",
"pan_suffix": "",
"qr_code": "https://sandbox-api.nearpay.io/ui/receipt/19f9524d-407a-4d28-bd1e-89e7fb821598",
"transaction_uuid": "11d91e8b-fe1a-44c8-a4c7-eab8aab9f62a"
}
ID | Network |
---|---|
MC | Mastercard - credit |
DM | Maestro |
P1 | Mada |
VC | Visa |
UP | Union Pay |
DC | Discover |
JC | JCB |
AX | American Express |
GN | GCCNET |
ID | Type |
---|---|
00 | PURCHASE |
20 | REFUND |
sealed class SetupFailure {
object AlreadyInstalled : SetupFailure()
object NotInstalled : SetupFailure()
data class AuthenticationFailed(val message: String) : SetupFailure()
data class InvalidStatus(val status: List<StatusCheckError>) : SetupFailure()
}
sealed class PurchaseFailure {
data class PurchaseDeclined(val receipt: TransactionReceipt?): PurchaseFailure()
data class PurchaseRejected(val message: String): PurchaseFailure()
data class AuthenticationFailed(val message: String): PurchaseFailure()
data class InvalidStatus(val status: List<StatusCheckError>): PurchaseFailure()
object GeneralFailure: PurchaseFailure()
}
sealed class RefundFailure {
data class RefundDeclined(val receipt: TransactionReceipt?): RefundFailure()
data class RefundRejected(val message: String): RefundFailure()
data class AuthenticationFailed(val message: String): RefundFailure()
data class InvalidStatus(val status: List<StatusCheckError>): RefundFailure()
object GeneralFailure: RefundFailure()
}
sealed class ReconcileFailure {
data class FailureMessage(val message: String) : ReconcileFailure()
data class AuthenticationFailed(val message: String): ReconcileFailure()
data class InvalidStatus(val status: List<StatusCheckError>): ReconcileFailure()
object GeneralFailure: ReconcileFailure()
}
sealed class GetDataFailure{
data class FailureMessage(val message: String) : GetDataFailure()
data class AuthenticationFailed(val message: String): GetDataFailure()
data class InvalidStatus(val status: List<StatusCheckError>): GetDataFailure()
object GeneralFailure: GetDataFailure()
object InvalidAdminPin: GetDataFailure()
}
Kotlin
Json
@Parcelize
@Serializable
data class ReconciliationReceipt(
@SerialName("id")
val id: String,
@SerialName("date")
val date: String,
@SerialName("time")
val time: String,
@SerialName("is_balanced")
val is_balanced: LabelField<Boolean>,
@SerialName("details")
val details: ReconciliationDetails,
@SerialName("schemes")
val schemes: List<ReconciliationSchemes> = emptyList(),
@SerialName("currency")
val currency: LocalizationField,
@SerialName("qr_code")
val qr_code: String,
@SerialName("merchant")
val merchant: Merchant,
@SerialName("card_acceptor_terminal_id")
val tid: String,
@SerialName("system_trace_audit_number")
val system_trace_audit_number: String,
@SerialName("pos_software_version_number")
val pos_software_version_number: String,
): Parcelable
@Parcelize
@Serializable
data class ReconciliationDetails(
@SerialName("purchase")
val purchase: ReconciliationLabelField,
@SerialName("refund")
val refund: ReconciliationLabelField,
@SerialName("purchase_reversal")
val purchase_reversal: ReconciliationLabelField,
@SerialName("refund_reversal")
val refund_reversal: ReconciliationLabelField,
@SerialName("total")
val total: ReconciliationLabelField
) : Parcelable
@Parcelize
@Serializable
data class ReconciliationSchemes(
@SerialName("name")
val name: LabelField<String>,
@SerialName("pos")
val pos: ReconciliationSchemesDetails,
@SerialName("host")
val host: ReconciliationSchemesDetails
) : Parcelable
@Parcelize
@Serializable
data class ReconciliationSchemesDetails(
@SerialName("debit")
val debit: ReconciliationLabelField,
@SerialName("credit")
val credit: ReconciliationLabelField,
@SerialName("total")
val total: ReconciliationLabelField,
) : Parcelable
@Parcelize
@Serializable
data class ReconciliationLabelField(
@SerialName("label")
val label: LocalizationField,
@SerialName("total")
val total: String,
@SerialName("count")
val count: Int
) : Parcelable
@Parcelize
@Serializable
data class Merchant(
@SerialName("id")
val id: String,
@SerialName("name")
val name: LocalizationField,
@SerialName("address")
val address: LocalizationField,
@SerialName("category_code")
val category_code: String
): Parcelable
{
"id": "549bd30a-a018-40ba-abec-b28b9c58121f",
"date": "06/03/2023",
"time": "10:46:04",
"is_balanced": {
"label": {
"arabic": "الموازنة إكتملت",
"english": "RECONCILIATION COMPLETED"
},
"value": true
},
"details": {
"purchase": {
"label": {
"arabic": "الشراء",
"english": "Purchase"
},
"total": "0.00",
"count": 0
},
"refund": {
"label": {
"arabic": "المستردة",
"english": "Refund"
},
"total": "0.00",
"count": 0
},
"purchase_reversal": {
"label": {
"arabic": "الشراء المعكوسة",
"english": "Purchase Reversal"
},
"total": "0.00",
"count": 0
},
"refund_reversal": {
"label": {
"arabic": "المستردة المعكوسة",
"english": "Refund Reversal"
},
"total": "0.00",
"count": 0
},
"total": {
"label": {
"arabic": "المجموع",
"english": "Total"
},
"total": "0.00",
"count": 0
}
},
"schemes": [
{
"name": {
"label": {
"arabic": "مدى",
"english": "mada"
},
"value": "P1"
},
"pos": {
"debit": {
"label": {
"arabic": "مدين",
"english": "Debit"
},
"total": "0.00",
"count": 0
},
"credit": {
"label": {
"arabic": "دائن",
"english": "Credit"
},
"total": "0.00",
"count": 0
},
"total": {
"label": {
"arabic": "المجموع",
"english": "Total"
},
"total": "0.00",
"count": 0
}
},
"host": {
"debit": {
"label": {
"arabic": "مدين",
"english": "Debit"
},
"total": "0.00",
"count": 0
},
"credit": {
"label": {
"arabic": "دائن",
"english": "Credit"
},
"total": "0.00",
"count": 0
},
"total": {
"label": {
"arabic": "المجموع",
"english": "Total"
},
"total": "0.00",
"count": 0
}
}
},
{
"name": {
"label": {
"arabic": "فيزا",
"english": "Visa"
},
"value": "VC"
},
"pos": {
"debit": {
"label": {
"arabic": "مدين",
"english": "Debit"
},
"total": "0.00",
"count": 0
},
"credit": {
"label": {
"arabic": "دائن",
"english": "Credit"
},
"total": "0.00",
"count": 0
},
"total": {
"label": {
"arabic": "المجموع",
"english": "Total"
},
"total": "0.00",
"count": 0
}
},
"host": {
"debit": {
"label": {
"arabic": "مدين",
"english": "Debit"
},
"total": "0.00",
"count": 0
},
"credit": {
"label": {
"arabic": "دائن",
"english": "Credit"
},
"total": "0.00",
"count": 0
},
"total": {
"label": {
"arabic": "المجموع",
"english": "Total"
},
"total": "0.00",
"count": 0
}
}
},
{
"name": {
"label": {
"arabic": "ماست ر كارد",
"english": "MasterCard"
},
"value": "MC"
},
"pos": {
"debit": {
"label": {
"arabic": "مدين",
"english": "Debit"
},
"total": "0.00",
"count": 0
},
"credit": {
"label": {
"arabic": "دائن",
"english": "Credit"
},
"total": "0.00",
"count": 0
},
"total": {
"label": {
"arabic": "المجموع",
"english": "Total"
},
"total": "0.00",
"count": 0
}
},
"host": {
"debit": {
"label": {
"arabic": "مدين",
"english": "Debit"
},
"total": "0.00",
"count": 0
},
"credit": {
"label": {
"arabic": "دائن",
"english": "Credit"
},
"total": "0.00",
"count": 0
},
"total": {
"label": {
"arabic": "المجموع",
"english": "Total"
},
"total": "0.00",
"count": 0
}
}
},
{
"name": {
"label": {
"arabic": "امريكان اكسبرس",
"english": "American Express"
},
"value": "AX"
},
"pos": {
"debit": {
"label": {
"arabic": "مدين",
"english": "Debit"
},
"total": "0.00",
"count": 0
},
"credit": {
"label": {
"arabic": "دائن",
"english": "Credit"
},
"total": "0.00",
"count": 0
},
"total": {
"label": {
"arabic": "المجموع",
"english": "Total"
},
"total": "0.00",
"count": 0
}
},
"host": {
"debit": {
"label": {
"arabic": "مدين",
"english": "Debit"
},
"total": "0.00",
"count": 0
},
"credit": {
"label": {
"arabic": "دائن",
"english": "Credit"
},
"total": "0.00",
"count": 0
},
"total": {
"label": {
"arabic": "المجموع",
"english": "Total"
},
"total": "0.00",
"count": 0
}
}
},
{
"name": {
"label": {
"arabic": "الشبكة الخليجية",
"english": "GCCNET"
},
"value": "GN"
},
"pos": {
"debit": {
"label": {
"arabic": "مدين",
"english": "Debit"
},
"total": "0.00",
"count": 0
},
"credit": {
"label": {
"arabic": "دائن",
"english": "Credit"
},
"total": "0.00",
"count": 0
},
"total": {
"label": {
"arabic": "المجموع",
"english": "Total"
},
"total": "0.00",
"count": 0
}
},
"host": {
"debit": {
"label": {
"arabic": "مدين",
"english": "Debit"
},
"total": "0.00",
"count": 0
},
"credit": {
"label": {
"arabic": "دائن",
"english": "Credit"
},
"total": "0.00",
"count": 0
},
"total": {
"label": {
"arabic": "المجموع",
"english": "Total"
},
"total": "0.00",
"count": 0
}
}
}
],
"currency": {
"arabic": "ر.س",
"english": "SAR"
},
"qr_code": "https://staging-api.nearpay.io/ui/reconciliation_receipt/549bd30a-a018-40ba-abec-b28b9c58121f",
"merchant": {
"id": "100000000000001",
"name": {
"arabic": "123455",
"english": "NearPay-Test Terminal INMA"
},
"address": {
"arabic": "4321",
"english": "KAFD"
},
"category_code": "0763"
},
"card_acceptor_terminal_id": "0100030400000304",
"system_trace_audit_number": "000083",
"pos_software_version_number": "1.0.0"
}
@Parcelize
@Serializable
data class ReconciliationList(
@SerialName("total")
val total: Int,
@SerialName("reconciliations")
val reconciliations: List<ReconciliationItem> = emptyList()
) : Parcelable
@Parcelize
@Serializable
data class ReconciliationItem(
@SerialName("id")
val id: String,
@SerialName("date")
val date: String,
@SerialName("time")
val time: String,
@SerialName("is_balanced")
val is_balanced: LabelField<Boolean>,
@SerialName("total")
val total: String,
@SerialName("currency")
val currency: LocalizationField
) : Parcelable
@Parcelize
@Serializable
data class Session(
@SerialName("id")
val id: String,
@SerialName("status")
val status: String,
@SerialName("type")
val type: String,
@SerialName("client_id")
val client_id: String,
@SerialName("amount")
val amount: String,
@SerialName("expired_at")
val expired_at: String,
@SerialName("reference_id")
val reference_id: String?,