Refunds
The following section refers to APIs related to initiating and processing refunds to your customers for previously received payments.
Both full and partial refunds are supported by our platform. In the latter case, we keep track that the total refunded amount of the partial refunds never exceeds the original payment amount.
Certain payment methods do not support refunds out-of-the-box and require additional input either from you or the customer themselves.
N.B Please note that in order to access the following resources, the Refund feature needs to be enabled on your Merchant account
Create Refund
POST /v1/refunds
Create a full or partial refund for a successfully processed payment
Status changes are sent to notificationUrl, see Webhooks.
Requires the X-Api-Key and X-Api-Secret headers.
Parameters
X-Signatureheader · stringX-Signature-Key-Idheader · string
Request body
refundForeignTransactionIdrequired stringYour unique identifier for this refund. Cannot be reused
notificationUrlrequired string · uriHTTPS URL to which refund status notifications are sent
originalTransactionIdstringTransaction ID of the payment to refund. Required if
originalForeignTransactionIdis missingoriginalForeignTransactionIdstringYour
foreignTransactionIdof the payment to refund. Required iforiginalTransactionIdis missingamountstringRefund amount. Omit for a full refund; a smaller amount creates a partial refund
Responses
201 Refund created
transactionIdinteger · int64Platform transaction ID
accountIdinteger · int64ID of the currency account for which the transaction is created
merchantIdinteger · int64ID of the Merchant
parentMerchantIdinteger · int64ID of the Parent Merchant
merchantNamestringName of the Merchant
createdTimestring · date-timeWhen the transaction was created, UTC, ISO 8601 with second precision
lastStatusUpdateTimestring · date-timeWhen the transaction last changed status (confirmation time, or creation time if not yet confirmed), UTC
statusstringStatus of the transaction, see Transaction status above
Allowed values:
INITIALPENDINGSCHEDULEDPROCESSEDCANCELLEDFAILEDbalancenumberAccount balance after this transaction
transactionAmountnumberAmount of the transaction in the account currency, rounded to the currency precision
processingAmountnumberAmount in the processing (payment) currency
transactionCurrencystringCurrency of the transaction
processingCurrencystringProcessing (payment) currency
directionstringDirection of the transaction:
DEPOSIT, money going into your account (credit);WITHDRAW, money going out of your account (debit)Allowed values:
DEPOSITWITHDRAWtypestringHuman-readable type of the transaction. May change; use
categoryfor programmatic handlingcategorystringCategory of the transaction, see Transaction categories above. Not a closed list
paymentMethodstringKey of the payment method used for the transaction
requestIdinteger · int64ID of the payment request (if applicable)
payerNamestringName of the payer
payerEmailstringEmail of the payer
counterpartyEmailstringEmail of the counterparty
counterpartyNamestringName of the counterparty
counterpartyBankstringBank name of the counterparty
counterpartyIbanstringIBAN of the counterparty. For checkout payments only returned when full account info is enabled on your account
counterpartyLast4DigitsstringLast 4 digits of the counterparty bank account
foreignTransactionIdstringUnique identifier passed by the merchant for this transaction
referencestringBank reference/other descriptor used for this transaction
parentTransactionIdinteger · int64ID of the transaction's parent
linkedTransactionsarray of LinkedTransactionsApiResponseTransactions linked to this one. Only returned by Search transactions with
include: [LINKED_TRANSACTIONS]Show fields
linkTypestringFEE: the linked transaction is a fee for this one.FEE_FOR: this transaction is a fee for the linked one.REFUND: this is a refund of the linked transaction.REFUNDED_BY: the linked transaction refunds this oneAllowed values:
REFUNDED_BYFEE_FORREFUNDFEEtransactionTransactionApiResponseTransaction affecting your merchant currency account
Show fields
Recursive reference to TransactionApiResponse
destinationCryptoAddressDetailsCryptoAddressDetailsDeposit address details, only for pending crypto checkout payments
Show fields
addressstringThe address of a crypto transaction
tagstringThe address tag of a crypto transaction
currencystringThe currency of a crypto transaction
expectedAmountnumberThe expected amount of a crypto transaction
statusCodeinteger · int64Status code in case of failed transaction
statusMessagestringStatus message in case of failed transaction
userMessagestringLast message shown to the customer. Only returned when enabled on your account
feebooleanSame as
isFee(kept for compatibility)isFeebooleanWhether this transaction is a fee (transaction, service or otherwise)
400 The request is malformed or failed validation
traceIdstringtimestampstringcodeinteger · int32messagestringcausearray of ValidationCauseShow fields
fieldstringcausestringcauseKeystring
401 Missing or invalid API credentials, or invalid request signature
traceIdstringtimestampstringcodeinteger · int32messagestringcausearray of ValidationCauseShow fields
fieldstringcausestringcauseKeystring
409 The request conflicts with the merchant setup or the current state of the resource
traceIdstringtimestampstringcodeinteger · int32messagestringcausearray of ValidationCauseShow fields
fieldstringcausestringcauseKeystring
429 Rate limit exceeded
traceIdstringtimestampstringcodeinteger · int32messagestringcausearray of ValidationCauseShow fields
fieldstringcausestringcauseKeystring
500 Unexpected error
traceIdstringtimestampstringcodeinteger · int32messagestringcausearray of ValidationCauseShow fields
fieldstringcausestringcauseKeystring
Callbacks
Payment notification
POST notificationUrl
Sent to the request's notificationUrl whenever the transaction changes status. Answer with any 2xx status within 20 seconds, otherwise the notification is retried. The body is signed: check X-Signature against the raw body, see Webhooks.
Headers
X-Signaturerequired header · stringSignature of the raw body
X-Signature-Key-Idrequired header · stringKey ID of the Signature Key used
Body
notificationIdrequired integer · int64Identifier of the notification. A resent notification keeps the same
notificationIdforeignTransactionIdstringYour unique identifier, as sent with the request this notification is for
typerequired stringThe kind of transaction this notification is for
Allowed values:
PAYMENTREFUNDPAYOUTEXTERNAL_TRANSFERINTERNAL_TRANSFERrequestIdinteger · int64ID of the request (payment request, refund, payout or transfer) in The Kingdom Bank's system
transactionIdinteger · int64ID of the The Kingdom Bank transaction that affected your account. Different from
requestIdpaymentMethodstringPayment method of the request
timestamprequired stringTime of the event this notification is for, in RFC 3339 format
statusrequired stringStatus of the transaction
PENDING: Pending confirmation from the customer. The payment may or may not be processedSCHEDULED: The customer has instructed the payment but the money has not yet reached our settlement account, so it is not yet added to your balancePROCESSED: Completed. The money has been added to (or deducted from) your account balanceFAILED: Failed, cancelled by the customer or our backoffice, or timed outOVERPAID,UNDERPAID: Deprecated. Use theoverpaidandunderpaidflags insteadAllowed values:
PENDINGSCHEDULEDPROCESSEDFAILEDOVERPAIDUNDERPAIDunderpaidbooleanThe customer completed the payment, but paid less than the requested amount
overpaidbooleanThe customer completed the payment, but paid more than the requested amount
referencestringPayment reference: the reference generated by the system followed by the one sent with the request, separated by a space
requestAmountstringRequested amount, as a decimal string
requestCurrencystringISO 4217 currency code of
requestAmounttransactionAmountstringAmount added to or deducted from your account. Same as
requestAmountunless otherwise agreed with your integration managertransactionCurrencystringISO 4217 currency code of
transactionAmountpaidAmountstringAmount paid to you. May differ from
requestAmountafter rounding or conversionpaidCurrencystringISO 4217 currency code of
paidAmountprocessingAmountstringAmount that was processed. Crypto payments only
processingCurrencystringCurrency of
processingAmount. Crypto payments onlycustomerAmountstringAmount paid by the customer, before conversion
customerCurrencystringCurrency of
customerAmountexternalUserIdstringThe
externalUserIdsent with the requestoriginalTransactionIdinteger · int64ID of the original transaction. Refunds, chargebacks and other events derived from a transaction only
originalForeignTransactionIdstringforeignTransactionIdof the original transaction. Refunds, chargebacks and other events derived from a transaction onlycustomerPaymentNotificationCustomerDetails of the customer's (sender's) account, as obtained from the bank. Payments only
Show fields
bankHolderNamestringName of the account holder
ibanstringbicstringBIC/SWIFT of the bank
bankNamestringcountrystringISO 3166 alpha-3 country code of the account
accountNumberstringDomestic account number
bankCodestringDomestic bank code
branchCodestringDomestic branch code
typestringType of the account
currencystringISO 4217 currency code of the account
last4CharsstringLast 4 characters of the IBAN or account number
userIdstringUnique identifier of the customer
mobileNetworkstringMobile network. Mobile money payments only
errorPaymentNotificationErrorWhy the transaction failed or was cancelled. The money may still arrive, so don't treat it as final for payments with
manualCheckRecommendedShow fields
codestringError code, listed in the Errors guide
messagestring
feesarray of PaymentNotificationFeeFees applied to the transaction
Show fields
feeTypestringType of the fee
amountnumbercurrencystring
isRecurringbooleanThe payment is a recurring payment
isSubsequentbooleanThe payment is a subsequent payment of a recurring plan
recurringPlanIdinteger · int64ID of the recurring plan in The Kingdom Bank's system
onDemandTokenstringThe customer's on-demand token, to use when requesting subsequent on-demand payments
onDemandNotestringReason for the on-demand payment, as shown to the customer in the payment confirmation
manualCheckRecommendedbooleanThe payment failed, but may still have been paid. Check it manually before retrying
Expected response: 200 Any 2xx status acknowledges the notification; the body is ignored