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:
Parameter | Meaning | Data Validation |
---|---|---|
limit | The number of orders you want to retrieve (defaults to 10). | Number |
offset | Skips specified number of orders (defaults to 0). | Number |
search_by | Allows setting an order or click ID to find a specific order. | String with order or click ID |
order_by | Allows 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:
Variable | Description |
---|---|
success | Whether the request was successfully processed and produced a result |
data | An object with the orders which were retrieved from the API |
total | The total number of orders which match the criteria for the search |
Each order in the data object will include the following:
Variable | Description |
---|---|
order_id | The unique identifier for the order in Wert's database |
click_id | The identifier you pass to Wert when you initialise the widget |
currency | The base currency for the order |
currency_amount | The value of the order in the base currency |
crypto | The crypto asset which was purchased or sent to the smart contract |
crypto_amount | The amount of the crypto asset which was purchased or sent to the smart contract |
user_id | The unique identifier for the user in Wert's database |
status | The status of the order |
card_id | The unique identifier for the card which was used in Wert's database |
created_at | Timestamp of when the order was created (UTC) |
changed_at | Timestamp of when the order was last updated (UTC) |
partner_fee | The USD amount of fees which were collected as partner revenue |
partner_fee_percent | The percentage of fees which were collected as partner revenue |
wert_fee | The USD amount of fees which were collected as Wert revenue |
wert_fee_percent | The percentage of fees which were collected as Wert revenue |
Order Status
The following order statuses are available:
Status | Description |
---|---|
success | The order was successful and has been sent on the blockchain |
failed | The order has failed and will not be sent on the blockchain |
cancelled | The payment for the order was processed but the order was later cancelled. |
pending | The order is being processed, but it hasn't been sent on the blockchain. |
progress | The order is being processed but payment has not yet been completed. |
created | The order has been created but payment has not yet been processed. |
Updated 3 months ago