Data API

This page will help you get started with the Data API.

Wert's Data API allows partners to retrieve information regarding any orders which have been associated with your Partner ID. The API is available at https://partner.wert.io/api/external/orders.


API Authentication

The Data API expects your API key to be included in the header of all requests. It looks as follows:

 X-API-KEY: wert-prod-aaaaaaaaaaaaaaa

ℹ️

You must replace 'wert-prod-aaaaaaaaaaaaaaa' with your personal API key. You can request this from your account manager.


Example: Retrieving the 10 most recent orders

curl -X GET 'https://partner.wert.io/api/external/orders' \ 
-H 'X-API-KEY: wert-prod-aaaaaaaaaaaaaaa'

Parameters

The Data API can make use of the following parameters:

ParameterMeaningData Validation
limitThe number of orders you want to retrieve (defaults to 10).Number
offsetSkips specified number of orders (defaults to 0).Number
search_byAllows setting an order or click ID to find a specific order.String with order or click ID
order_byAllows setting the order as ascending or descending (defaults to desc).asc / desc

Example: Retrieving the 20 orders which were made after the first 10 orders

curl -X GET -G 'https://partner.wert.io/api/external/orders' \
-H 'X-API-KEY: wert-prod-aaaaaaaaaaaaaaa'\ 
-d 'limit=20' \
-d 'offset=10' \
-d 'order_by=asc'

Example: retrieving an order using the click ID

curl -X GET -G 'https://partner.wert.io/api/external/orders' \
-H 'X-API-KEY: wert-prod-aaaaaaaaaaaaaaa'\ 
-d 'search_by=click_id'

Response

Request will return JSON formatted responses such as:

{
    "success": true,
    "data": [
        {
            "order_id": "01GMAPHCFE06G3Y8FG2KW9BAM0",
            "click_id": "2fdd7b84-2a2f-4c2c-9727-763da6db1ccd",
            "currency": "usd",
            "currency_amount": 4.79,
            "crypto": "matic.sc.polygon",
            "crypto_amount": 5,
            "user_id": "01GJMAVBKQYNKGCFSPE4QTN4AC",
            "status": "success",
            "card_id": "01GJMAYZ7M4GYWNDFST2HE8F46",
            "created_at": "2022-12-15 10:51:02",
            "changed_at": "2022-12-15 10:55:47",
            "partner_fee": 0.05,
            "partner_fee_percent": 0.01,
            "wert_fee": 0.18,
            "wert_fee_percent": 0.04
        },
        {
            "order_id": "01GJN55J8K6J2HPREJ6HQKLQDR",
            "click_id": "2fdd7b84-2a2f-4c2c-9727-763da6db1ccd",
            "currency": "usd",
            "currency_amount": 9.15,
            "crypto": "matic.sc.polygon",
            "crypto_amount": 10,
            "user_id": "01GJMAVBKQYNKGCFSPE4QTN4AC",
            "status": "failed",
            "card_id": "01GJMAYZ7M4GYWNDFST2HE8F46",
            "created_at": "2022-11-24 15:47:44",
            "changed_at": "2022-11-24 15:52:48",
            "partner_fee": 0.09,
            "partner_fee_percent": 0.01,
            "wert_fee": 0.35,
            "wert_fee_percent": 0.04
        }
    ],
    "total": 2
}

Definitions

The response contains the following:

VariableDescription
successWhether the request was successfully processed and produced a result
dataAn object with the orders which were retrieved from the API
totalThe total number of orders which match the criteria for the search

Each order in the data object will include the following:

VariableDescription
order_idThe unique identifier for the order in Wert's database
click_idThe identifier you pass to Wert when you initialise the widget
currencyThe base currency for the order
currency_amountThe value of the order in the base currency
cryptoThe crypto asset which was purchased or sent to the smart contract
crypto_amountThe amount of the crypto asset which was purchased or sent to the smart contract
user_idThe unique identifier for the user in Wert's database
statusThe status of the order
card_idThe unique identifier for the card which was used in Wert's database
created_atTimestamp of when the order was created (UTC)
changed_atTimestamp of when the order was last updated (UTC)
partner_feeThe USD amount of fees which were collected as partner revenue
partner_fee_percentThe percentage of fees which were collected as partner revenue
wert_feeThe USD amount of fees which were collected as Wert revenue
wert_fee_percentThe percentage of fees which were collected as Wert revenue

Order Status

The following order statuses are available:

StatusDescription
successThe order was successful and has been sent on the blockchain
failedThe order has failed and will not be sent on the blockchain
cancelledThe payment for the order was processed but the order was later cancelled.
pendingThe order is being processed, but it hasn't been sent on the blockchain.
progressThe order is being processed but payment has not yet been completed.
createdThe order has been created but payment has not yet been processed.