Fetch purchase information for transactions
Using the Finance API and the Purchase API, you can fetch purchase information for transactions. The
originatingTransactionUuid
of a transaction in the Finance API corresponds to the uuid
of payments
in the Purchase API.The Finance API records transactions for payment types that are supported by the Purchase API except
IZETTLE_CASH
, SWISH
, VIPPS
, MOBILE_PAY
, GIFTCARD
, and IZETTLE_INVOICE
.All transactions for supported payment types will have the transaction type
PAYMENT
or PAYMENT_FEE
in the Finance API.Download Postman collection for this user guide and import it in Postman.
- Make sure that authorisation is set up with the following OAuth scope using OAuth API:
READ:FINANCE
READ:PURCHASE
Currently, fetching purchase information is available only for transactions that are made with cards and APMs like PayPal QRC through Zettle.
Before you can find the transaction UUID, you need to specify the transactions types to fetch all transactions of a specific payment method.
- Fetch all transactions of one or more transaction types during a specific period from both the
prelimimary
account and theliquid
account. Then the response will also return transactions that are still being checked by Zettle with the acquiring bank.GET /v2/accounts/{accountTypeGroup}/transactions?start={start}&end={end}&includeTransactionType={includeTransactionType}
Example: The following example fetches all transactions for payments and payment fees of the merchant's Zettle liquid account from 1 June, 2020 to 31 December, 2020.RequestGET /v2/accounts/liquid/transactions?start=2020-06-01T00:00:00-00:00&end=2021-01-01T00:00:00-00:00&includeTransactionType=PAYMENT&includeTransactionType=PAYMENT_FEE
Response - In the response, find and save the value of
originatingTransactionUuid
for transactions for which you want to fetch purchase information.
Using the value of
originatingTransactionUuid
of a transaction in the Finance API, you can use the Purchase API to locate the purchase information for the transaction.- Fetch purchases regularly, for example every midnight, and store the data in a local database. In the request parameters, set the
startDate
to the last time of fetching purchases.GET /purchases/v2?startDate={startDate}
Example: The following request example fetches purchase information from 19 November, 2020.Request/purchases/v2/?startDate=2020-11-19
- In the local database, find the purchase by iterating through each purchase's payments list and searching for a payment with the same
uuid
as the transaction'soriginatingTransactionUuid
that you saved in Step 1: Find the transaction UUID with the Finance API.Example: In the following example response that returns purchase information from 19 November, 2020, search for6820265b-953e-43a7-bb65-abac1ef104bf
that is the value oforiginatingTransactionUuid
of the transaction. It's the same value ofuuid
of thepayments
that belongs to the purchase withpurchaseUUID1
as2252b412-f531-405b-a073-1b3b9f2bbdd4
.