General

Transactions

General Transactions API documentation

Introduction

The transactions API call is used to get all the transactions in a given time frame.

Transactions

List Transactions

This API will retrieve a list of transactions.

Path
GET /transactions

Query Parameters:

ParameterExample
start_dateyyyy-mm-dd
end_dateyyyy-mm-dd
Please note this API will only pull data through for a given agent set in the API Key settings

Response:

{
    "status": true,
    "total": 30862,
    "records": [
        {
            "transaction_number": "c2e8dfd5-5cb8-46f7-dede-8c96df15df1f",
            "amount": "150.00",
            "status": "Paid",
            "transaction_date": "2023-11-04T00:00:00.000Z",
            "id_number": "8812345678901",
            "company_name": "",
            "response_reason": "",
            "reference_number": "B457",
            "member_number": "MEM450045",
            "workflow_reference": "1234-1234"
        },
        ...
    ]
}

Fields:

NameExampleDescription
transaction_numberc2e8dfd5-5cb8-46f7-dede-8c96df15df1fSystem generated transaction number
amount150.00Transaction Amount
statusPaidPlease see list below of statuses
transaction_date2023-11-04T00:00:00.000ZDate the transaction occurred
id_number8812345678901ID number of person associated to the transaction
company_nameInc CorpCompany name associated to the transaction
response_reasonTransaction DisputedDescription of reason transaction was declined
reference_numberB457Reference number of transaction assigned, can be statement reference too
member_numberMEM450045Customer or member number assigned to person or company
workflow_reference1234-1234Referenced passed through from contact centre

Transactions Statuses:

  • Pending
  • Generated
  • Unpaid
  • Updated/Pending
  • Transmission Accepted
  • Transmission Rejected
  • Account Type Corrected
  • Redirected
  • Paid
  • Sent
  • Undelivered
  • Reversed
  • Transmission Accepted (with warnings)
  • Unpaid (Permanent Failure)

All lookup values can be found under: Lookups API

Error Response:

{
    "status": false,
    "error": "Not authorized to make this API call. Requesting Read on General."
}

When you get this API response ensure that under the API keys section your API Key has the correct permissions: API Keys

Get Transaction Details

View transactions by user id or public id. All lookup values can be found under: Lookups API

Path
GET /transactions/{people record_id|companies record_id|people public_id|companies public_id}

Success Response:

{
    "status": true,
    "records": [{
        "id": "{unique record_id}",
        "people_id": "{people record_id}",
        "companies_id": "{companies record_id}",
        "transaction_id": "{custom transaction id}",
        "transaction_time": "YYYY-MM-DD HH:mm:ss",
        "transaction_reference": "{reference as seen on bank statements}","transaction_status_lookups_id": "5c4a9234-c5f4-4bab-9868-b1120df89d96",
        "amount": "100.25",
        "is_debit": true,
        "payment_methods_id": "{payment_methods record_id}",
        "subscriptions_id": "{subscriptions record_id}",
        "cards_id": "{cards record_id}",
        "bank_accounts_id": "{bank_accounts record_id}",
        "interval_lookups_id": "04f6c27d-1eba-4ef1-a023-3baa79cff571",
        "response_reason": "Auth Done",
        "response_code": "990017",
        "response_raw": "{json body of 3rd party payments}",
        "is_reversed": false,
        "is_dispute": false,
        "notes": "notes about this subscription",
        "batches_accounts_id": "{batches_accounts record_id}",
        "documents_id": "{documents id}",
        "fee": "{fee amounts applicable to 3rd party payments}","accounts_currencies_id": "{accounts_currencies record_id}",
        "date_status_updated": "{date payment status updated YYYY-MM-DD HH:mm:ss}"
    }, ...]
}
FieldTypeDescriptionOptionsExample
statusbooleantrue - API request was a success, false - API request failed
recordsArray of ObjectsTransaction records
records .idstringUnique ID associated with the recordUUID"{unique record_id}"
records .people_idstringPeople ID associated with the transactionUUID"{people record_id}"
records .companies_idstringCompanies ID associated with the transactionUUID"{companies record_id}"
records .transaction_idstringCustom ID provided to the transactionABC123
records .transaction_timedatetimeAt what date and time this transaction took place"YYYY-MM-DD HH:mm:ss"2024-09-01 17:15:34
records .transaction_referencestringReference number as seen on bank statementsTST24090100001
transaction_status_lookups_idstringStatus lookups ID of the transactionUUID"5c4a9234-c5f4-4bab-9868-b1120df89d96"
records .amountdecimalAmount that was paid during the transaction100.25
records .is_debitbooleanIf this transaction was debited from the person/company's accounttrue, falsetrue
records .payment_methods_idstringPayment Methods ID related to the transactionUUID"{payment_methods record_id}"
records .subscriptions_idstringSubscription ID related to the transactionUUID"{subscriptions record_id}"
records .cards_idstringCards ID related to the transactionUUID"{cards record_id}"
records .bank_accounts_idstringBank accounts ID related to the transactionUUID"{bank_accounts record_id}"
records .interval_lookups_idstringInterval lookups ID of the transactionUUID"04f6c27d-1eba-4ef1-a023-3baa79cff571"
records .response_reasonstringReason for the payment status (if applicable)"Auth Done"
records .response_codestringResponse code related to the response reason (if applicable)"990017"
records .response_rawStringRaw response received by the payment method (if applicalbe)max 8192 characters"{json body of 3rd party payments}"
records .is_reversedbooleantrue - if this transaction payment has been reversedtrue, falsefalse
records .is_disputebooleantrue - if this transaction has been disputed at the banktrue, falsefalse
records .notesstringNotes associated with this transaction"some notes about this subscription"
records .batches_accounts_idstringBatch Account ID associated with this transactionUUID"{batches_accounts record_id}"
records .documents_idstringDocuments ID associated with this transaction, if a document was uploaded along with this transactionUUID"{documents id}"
records .feedecimalFee paid to the payment method (if applicable)3.24
records .accounts_currencies_idstringAccount currency associated with this transactionUUID"{accounts_currencies record_id}"
records .date_status_updateddateWhen the payment status of this transaction changed"YYYY-MM-DD HH:mm:ss""2024-09-01 14:34:23"

Get Transactions by ID

Retrieve one or more transactions by their transaction record IDs.

Path
GET /transactions/get

Query Parameters:

ParameterExampleNote
transaction_ids{transaction record_id},{transaction record_id}Required. Comma separated list of transaction record IDs

Success Response:

The response is a JSON array of transactions (without a status wrapper).

[
    {
        "id": "{unique record_id}",
        "created_at": "2024-09-01T15:15:34.000Z",
        "updated_at": "2024-09-01T15:15:34.000Z",
        "deleted_at": null,
        "accounts_id": "{accounts record_id}",
        "transaction_id": "ABC123",
        "transaction_time": "2024-09-01T15:15:34.000Z",
        "transaction_reference": "TST24090100001",
        "status": "Paid",
        "currency": "ZAR",
        "amount": "100.25",
        "is_debit": true,
        "abbreviated_name": "SWITCH",
        "bank_reference": "SWITCH DEBIT",
        "batch_reference_code": "B457",
        "provider": "DebitSwitch",
        "subscriptions_id": "{subscriptions record_id}",
        "card_number_obfuscated": null,
        "branch_code": "632005",
        "account_name": "J Doe",
        "account_number": "xxxxxxxx11",
        "interval": "Monthly",
        "document_number": "INV0001",
        "response_reason": "Auth Done",
        "response_code": "990017",
        "is_reversed": false,
        "is_dispute": false,
        "notes": "notes about this transaction"
    },
    ...
]
FieldTypeDescriptionExample
idstringUnique ID of the transaction"{unique record_id}"
created_atdatetimeWhen the transaction record was created"2024-09-01T15:15:34.000Z"
updated_atdatetimeWhen the transaction record was last updated"2024-09-01T15:15:34.000Z"
deleted_atdatetimeWhen the transaction record was deleted, null if not deletednull
accounts_idstringAccount ID the transaction belongs to"{accounts record_id}"
transaction_idstringCustom ID provided to the transaction"ABC123"
transaction_timedatetimeAt what date and time this transaction took place"2024-09-01T15:15:34.000Z"
transaction_referencestringReference number as seen on bank statements"TST24090100001"
statusstringStatus title of the transaction"Paid"
currencystringCurrency code of the transaction, defaults to ZAR"ZAR"
amountdecimalAmount of the transaction"100.25"
is_debitbooleanIf this transaction was debited from the person/company's accounttrue
abbreviated_namestringAbbreviated name of the payment method"SWITCH"
bank_referencestringBank statement reference of the payment method"SWITCH DEBIT"
batch_reference_codestringBatch reference code of the payment method"B457"
providerstringPayment provider of the payment method"DebitSwitch"
subscriptions_idstringSubscription ID related to the transaction"{subscriptions record_id}"
card_number_obfuscatedstringObfuscated card number, if paid by card"4111 xxxx xxxx 1111"
branch_codestringBranch code of the bank account, if paid by debit order"632005"
account_namestringName on the bank account"J Doe"
account_numberstringBank account number with all but the last 20% of the digits masked"xxxxxxxx11"
intervalstringInterval title of the transaction"Monthly"
document_numberstringFinance document number linked to the transaction"INV0001"
response_reasonstringReason for the payment status (if applicable)"Auth Done"
response_codestringResponse code related to the response reason (if applicable)"990017"
is_reversedbooleantrue - if this transaction payment has been reversedfalse
is_disputebooleantrue - if this transaction has been disputed at the bankfalse
notesstringNotes associated with this transaction"notes about this transaction"

Validation Error Response:

{
    "status": false,
    "error": "input validation failed",
    "errors": {
        "transaction_ids": {
            "message": "The transaction ids field is mandatory.",
            "rule": "required"
        }
    }
}

Error Response:

{
    "status": false,
    "error": "Not authorized to make this API call. Requesting Read on General."
}

When you get this API response ensure that under the API keys section your API Key has the correct permissions: API Keys


Copyright © 2024 SwitchTransact