Skip to main content

Data Models

This page documents the core data models used throughout the Kulpay API system.

Entity Relationship Diagram

Customer

The Customer is the central entity in the system. Each customer has an embedded Account that links to the BLNK core banking engine.

FieldTypeDescription
customer_idstringUnique ID with cus_ prefix
first_namestringCustomer's first name
last_namestringCustomer's last name
other_namesstringAdditional names (optional)
emailstringUnique email address
phone_numberstringUnique phone number (E.164 format)
accountAccountEmbedded BLNK account link (see below)
addressAddressPhysical address (street, city, country, postal_code)
nationality_idstringNational ID or passport number (encrypted)
tax_idstringTax identification number (encrypted)
nuibstringNational Unified ID Number (encrypted)
customer_segmentenumpersonal or business
kyc_statusenuminitiated, under_review, pending, verified, rejected
statusenumactive, suspended, closed
sexstringCustomer's sex
date_of_birthtimestampDate of birth
nationalitystringNationality
profile_pictureUploadedFileOptional profile image
qrcode_idstringGenerated upon KYC verification
business_namestringBusiness name (for business segment)

Account

The Account is embedded within the Customer model and serves as the bridge between Kulpay API and the BLNK core banking engine.

FieldTypeDescription
identity_idstringBLNK Identity ID — links the customer to their BLNK identity
balance_idstringBLNK Balance ID — links to the customer's wallet balance in BLNK

Technical Decision: Rather than maintaining balances directly, Kulpay API delegates all balance and ledger operations to BLNK. The Account model stores only the references needed to query BLNK. This separation ensures that Kulpay API handles customer lifecycle and business logic while BLNK manages the financial ledger with double-entry accounting guarantees.

PhoneSession

Manages OTP verification during customer onboarding and sensitive operations.

FieldTypeDescription
phone_numberstringPhone number being verified (indexed)
otpstring6-digit one-time password
expires_attimestampOTP expiration time (indexed)
verifiedbooleanWhether the OTP was successfully verified
created_attimestampWhen the session was created
verified_attimestampWhen verification succeeded
attempt_countintegerNumber of verification attempts (max 3 before lockout)

Bill

The Bill model is a comprehensive invoicing structure supporting both simple and complex billing scenarios.

FieldTypeDescription
idstringUnique bill identifier
account_idstringCustomer account ID
typeenuminvoice or recharge
descriptionstringBill description
amountAmountBill amount (value + currency)
statusstringPENDING, COMPLETED, CANCELLED, FAILED
payerPayerPayer details
billerBillerBiller/issuer details
invoice_metadataInvoiceMetadataInvoice-specific metadata
financial_detailsFinancialDetailsLine items, tax, discounts
payment_reconciliationPaymentAndReconciliationPayment and reconciliation tracking
integration_routingIntegrationAndRoutingERP and routing configuration
compliance_auditComplianceAndAuditAudit trail with timestamps
collection_method_detailsarrayCollection methods (NIB, entity number, etc.)
third_party_referencestringExternal reference ID

Biller

FieldTypeDescription
account_idstringBiller's account ID
business_namestringBusiness name
logoUploadedFileBusiness logo
contactContactPhone and email
issuer_nuitstringTax ID (NUIT) of the issuer
billing_addressAddressBiller address

InvoiceMetadata

FieldTypeDescription
invoice_numberstringUnique invoice number
issue_datestringWhen the invoice was issued
due_datestringPayment due date
invoice_typestringType of invoice
source_channelstringChannel the invoice originated from
reference_numberstringExternal reference
payment_linkstringLink for online payment

FinancialDetails

FieldTypeDescription
line_itemsstringDescription of line items
products_infoProductsInformationProduct details
tax_infoTaxInformationTax breakdown
discountnumberDiscount amount
total_amountAmountTotal after tax and discounts
fx_ratestringForeign exchange rate (if applicable)

ComplianceAndAudit

FieldTypeDescription
payer_nuitstringPayer's tax ID (NUIT)
issuer_nuitstringIssuer's tax ID (NUIT)
invoice_validitystringValidity period
attached_contractstringContract reference
user_issuerstringUser who issued the bill
issued_atstringTimestamp of issuance
viewed_atstringWhen the bill was viewed
paid_atstringWhen payment was received
reconciled_atstringWhen reconciliation occurred

Instruction

An Instruction represents a financial operation request that is processed by a payment adapter. It is the core transactional unit in Kulpay API.

FieldTypeDescription
idstringUnique instruction ID
customer_idstringCustomer who initiated the instruction
typeenumtransfer, deposit, pay_in, pay_out, pay_bill, check_balance, get_authorization, validata
statusenumpending, processing, succeeded, failed
payloadPayloadTransaction details (embedded)
adapter_implstringWhich payment adapter processes this instruction
contactsParticipant[]Participants involved (sender, receiver)
retriesintegerNumber of processing retries
processed_attimestampWhen processing completed
notify_customerbooleanWhether to send SMS notification

Payload

FieldTypeDescription
transactionsTransaction[]List of transactions to execute
receive_transactionstringReceiving transaction reference
payment_method_typestringType of payment method used
instruction_value_datetimestampScheduled execution date

Transaction (within Payload)

FieldTypeDescription
idstringTransaction ID
amountnumberTransaction amount
currencystringISO currency code (e.g., MZN)
fromstringSource account/reference
tostringDestination account/reference
descriptionstringTransaction description
allow_overdraftbooleanWhether overdraft is permitted
scheduled_fortimestampScheduled execution time

Participant

FieldTypeDescription
idstringParticipant ID
namestringFull name
emailstringEmail address
phonestringPhone number
addressstringAddress
roleenumsender or receiver
pictureUploadedFileProfile picture

LicenseKey

Controls system-level authorization for the Kulpay API deployment.

FieldTypeDescription
idstringUnique license ID
keystringLicense key value (indexed)
statusenumactive, expired, invalid
issued_tostringPartner/organization the license was issued to
issuerstringLicense issuer (e.g., kulpay)
issued_attimestampWhen the license was issued
expires_attimestampWhen the license expires

Common Types

UploadedFile

Represents a file stored in the Minio-backed file server.

FieldTypeDescription
file_idstringUnique file identifier
file_bucketstringMinio storage bucket name
file_linkstringDownload link (base64)

Money / Amount

FieldTypeDescription
amountstringDecimal amount
currencystringISO 4217 currency code (e.g., MZN)

Error

FieldTypeDescription
codestringMachine-readable error code
messagestringHuman-readable description
request_idstringRequest tracking ID (req_ prefix)
metadatamapAdditional error context