Fetch a transaction
Get Transaction Endpoint
Get a transaction from your wallet.
https://sandbox.tickpay.com/api/v1/wallets/transaction/{id}
Request
To access this endpoint, you need to provide a valid access token in the Authorization header.
- cURL
- C#
- JavaScript
- Python
- Java
- PHP
Use the following cURL command to retrieve the wallet transaction:
curl -X 'GET' \
'https://sandbox.tickpay.com/api/v1/wallets/transaction/id' \
-H 'accept: application/json' \
-H 'Authorization: Bearer your_access_token'
Use the following csharp command to retrieve the wallet transaction:
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
string apiUrl = "https://sandbox.tickpay.com/api/v1/wallets/transaction/id";
string token = "your_access_token";
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("accept", "application/json");
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token}");
HttpResponseMessage response = await client.GetAsync(apiUrl);
if (response.IsSuccessStatusCode)
{
string result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
else
{
Console.WriteLine($"Error: {response.StatusCode} - {response.ReasonPhrase}");
}
}
}
}
Use the following javascript command to retrieve the wallet transaction:
const url = 'https://sandbox.tickpay.com/api/v1/wallets/transaction/id';
const headers = {
'accept': 'application/json',
'Authorization': 'Bearer your_access_token'
};
fetch(url, {
method: 'GET',
headers: headers
})
.then(response => response.json())
.then(data => {
console.log('Server Response:', data);
})
.catch(error => {
console.error('Request Error:', error);
});
Use the following python command to retrieve the wallet transaction:
import requests
url = 'https://sandbox.tickpay.com/api/v1/wallets/transaction/id'
headers = {
'accept': 'application/json',
'Authorization': 'Bearer your_access_token'
}
response = requests.get(url, headers=headers)
print(response.json())
Use the following java command to retrieve the wallet transaction:
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Map;
public class Example {
public static void main(String[] args) {
HttpClient httpClient = HttpClient.newHttpClient();
String url = "https://sandbox.tickpay.com/api/v1/wallets/transaction/id";
Map<String, String> headers = Map.of(
"accept", "application/json",
"Authorization", "Bearer your_access_token"
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.headers(headers.entrySet().stream()
.flatMap(e -> Map.entry(e.getKey(), e.getValue()).stream())
.toArray(String[]::new))
.GET()
.build();
try {
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
} catch (Exception e) {
e.printStackTrace();
}
}
}
Use the following php command to retrieve the wallet transaction:
<?php
$apiUrl = "https://sandbox.tickpay.com/api/v1/wallets/transaction/id";
$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPGET, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'accept: application/json',
'Authorization: Bearer your_access_token'
]);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
}
curl_close($ch);
echo $result;
?>
Response
The response will contain a data object, along with additional information:
{
"data": {
"id": "9e8ec046-c2c7-4d9a-9fb1-0d98cdc94ca3",
"callbackUrl": "https://example.com/callback",
"value": 5000,
"tax": 25,
"description": "Cash-in created successfully.",
"operation": "CASH_IN",
"status": "PENDING",
"metadata": {
"key": "value",
"anotherKey": "anotherValue"
},
"externalReference": "ABC123",
"payer": {
"name": "John Doe",
"email": "[email protected]",
"phone": "+5511911111111",
"document": "123456789"
},
"codeCopyPaste": "https://sandbox.tickpay.com/api/v1/simulations/cashin/9e8ec046-c2c7-4d9a-9fb1-0d98cdc94ca3",
"qrcodeImage": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAAAklEQVR4AewaftIAAA+1SURBVO3BUY4kyWIkMDNH",
"createdAt": "2023-12-26T14:19:39.986Z"
},
"messageError": null,
"success": true
}
Response Properties
| Parameter | Description | Default Value |
|---|---|---|
messageError | Error message. | null |
success | Indicates whether the request was successful. | false |
data Properties | ||
id | Unique identifier for the transaction. | |
callbackUrl | URL for callback. | |
value | Specific value in the response, representing cents. | > 0 |
tax | Tax value. | |
description | Description of the operation. | |
operation | Type of operation. Possible properties | |
status | Current status of the transaction. Possible properties | |
metadata | Additional metadata. | |
externalReference | External reference identifier. | |
payer | Information about the payer. | |
codeCopyPaste | URL for copying and pasting the code. | |
qrcodeImage | Data URI for the QR code image. | |
createdAt | Date and time of creation. |
Possible Properties
| Parameter | Description |
|---|---|
operation | CASHIN, CASHOUT, REFUND |
status | PENDING, CANCELED, SUCCEED, FAILED |