Obtener una orden
Obtiene una orden de pago a partir de un identificador de orden.
El estado de las respuestas puede variar entre los siguientes:
| Estado | Descripción |
|---|---|
| APPROVED | El pago fue exitoso y se desembolsó el dinero en la cuenta bancaria de Ualá. |
| PENDING | Se crea la orden y está pendiente el pago. |
| PROCESSED | La orden fue procesada exitosamente y está pendiente su desembolso. |
| REJECTED | El pago de la orden fue rechazado por algún motivo. |
| REFUNDED | El pago de la orden fue devuelto al comprador. |
Solo aquellas órdenes con estado APPROVED tendrán los campos taxes y commissions con valores asociados.
BASE URL:
https://checkout.stage.developers.ar.ua.la/v2/apihttps://checkout.developers.ar.ua.la/v2/api¡Aviso importante! Para usar este endpoint necesitas un token de autorización.
Parámetros
GET /orders/:uuid
| Params | Tipo | Descripción | Requerido |
|---|---|---|---|
| uuid | string | Identificador único de la orden obtenido de la URL. Este uuid debe estar asociado a una orden paga y aprobada. | Sí |
Ejemplos
Terminal
curl -X GET "https://checkout.developers.ar.ua.la/v2/api/orders/<UUID>" \
-H "Authorization: Bearer <TOKEN>"index.js
class OrderAPI {
constructor(baseURL, token) {
this.baseURL = baseURL;
this.token = token;
}
async getOrder(uuid) {
const url = `${this.baseURL}/orders/${uuid}`;
const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': `Bearer ${this.token}`
}
});
if (!response.ok) {
throw new Error(`Failed to fetch order, status: ${response.status}`);
}
return response.json();
}
}
// Ejemplo de uso
const token = "<TOKEN>";
const uuid = "<UUID>";
const api = new OrderAPI("https://checkout.developers.ar.ua.la/v2/api", token);
api.getOrder(uuid)
.then(orderData => console.log("Order Data:", orderData))
.catch(error => console.error("Failed to fetch order:", error));main.php
class OrderAPI {
private $baseURL;
private $token;
public function __construct($baseURL, $token) {
$this->baseURL = $baseURL;
$this->token = $token;
}
public function getOrder($uuid) {
$url = "{$this->baseURL}/orders/{$uuid}";
$headers = [
"Authorization: Bearer {$this->token}"
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
throw new Exception('Request Error: ' . curl_error($ch));
}
curl_close($ch);
if ($httpCode !== 200) {
throw new Exception("Failed to fetch order, status code: $httpCode");
}
return json_decode($response, true);
}
}
// Ejemplo de uso
$token = "<TOKEN>";
$uuid = "<UUID>";
$api = new OrderAPI("https://checkout.developers.ar.ua.la/v2/api", $token);
try {
$orderData = $api->getOrder($uuid);
echo "Order Data: ";
print_r($orderData);
} catch (Exception $e) {
echo "Error fetching order: " . $e->getMessage();
}main.py
import requests
class OrderAPI:
def __init__(self, base_url: str, token: str):
self.base_url = base_url
self.headers = {
"Authorization": f"Bearer {token}"
}
def get_order(self, uuid: str):
url = f"{self.base_url}/orders/{uuid}"
response = requests.get(url, headers=self.headers)
if response.status_code == 200:
return response.json()
else:
response.raise_for_status() # Levanta una excepción en caso de error
# Ejemplo de uso
token = "<TOKEN>"
uuid = "<UUID>"
api = OrderAPI("https://checkout.developers.ar.ua.la/v2/api", token)
try:
order_data = api.get_order(uuid)
print("Order Data:", order_data)
except requests.exceptions.HTTPError as e:
print("Failed to fetch order:", e)main.go
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
)
type OrderAPI struct {
BaseURL string
Token string
}
func (api *OrderAPI) GetOrder(uuid string) (map[string]interface{}, error) {
url := fmt.Sprintf("%s/orders/%s", api.BaseURL, uuid)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return nil, err
}
req.Header.Set("Authorization", "Bearer "+api.Token)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("failed to fetch order, status code: %d", resp.StatusCode)
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
var result map[string]interface{}
if err := json.Unmarshal(body, &result); err != nil {
return nil, err
}
return result, nil
}
func main() {
api := OrderAPI{
BaseURL: "https://checkout.developers.ar.ua.la/v2/api",
Token: "<YOUR_AUTH_TOKEN>",
}
uuid := "<YOUR_ORDER_UUID>"
orderData, err := api.GetOrder(uuid)
if err != nil {
log.Fatalf("Error fetching order: %v", err)
}
fmt.Printf("Order Data: %v\n", orderData)
}Respuestas
{
"uuid": "34bdfeea-5d87-4878-9601-571xc9b2f076",
"amount": 1001,
"status": "PENDING",
"external_reference": "idFromIntegration",
"commissions": [],
"taxes": [],
"changelog": [],
"created_date": "2024-10-24T21:53:00.256200745Z",
"updated_date": "2024-10-24T21:58:21.376292738Z"
}{
"uuid": "34bdfeea-5d87-4878-9601-571xc9b2f076",
"amount": 1001,
"status": "PROCCESED",
"external_reference": "idFromIntegration",
"commissions": [],
"taxes": [],
"customer": {
"name": "Customer name",
"card": {
"holder_name": "card holder name",
"issuer": "MASTER",
"pan": "501041******9330",
"installments": {
"number": 1,
"total": 1001,
"financial_cost": 0,
"value_per_installment": 1001
}
}
},
"changelog": [
{
"new_status": "PROCCESED",
"old_status": "PENDING",
"updated_date": "2024-10-24T21:58:21.376292738Z"
}
],
"created_date": "2024-10-24T21:53:00.256200745Z",
"updated_date": "2024-10-24T21:58:21.376292738Z"
}{
"uuid": "34bdfeea-5d87-4878-9601-571xc9b2f076",
"amount": 1001,
"status": "REJECTED",
"external_reference": "idFromIntegration",
"commissions": [],
"taxes": [],
"customer": {
"name": "Customer name",
"card": {
"holder_name": "card holder name",
"issuer": "MASTER",
"pan": "501041******9330",
"installments": {
"number": 1,
"total": 1001,
"financial_cost": 0,
"value_per_installment": 1001
}
}
},
"changelog": [
{
"new_status": "REJECTED",
"old_status": "PENDING",
"updated_date": "2024-10-24T21:58:21.376292738Z"
}
],
"created_date": "2024-10-24T21:53:00.256200745Z",
"updated_date": "2024-10-24T21:58:21.376292738Z"
}{
"uuid": "34bdfeea-5d87-4878-9601-571xc9b2f076",
"amount": 1001,
"status": "APPROVED",
"external_reference": "idFromIntegration",
"commissions": [
{
"amount": "",
"percentage": "",
"type": "",
}
],
"taxes": [
{
"percentage": "",
"held_tax": "",
"type": "",
}
],
"customer": {
"name": "Customer name",
"card": {
"holder_name": "card holder name",
"issuer": "MASTER",
"pan": "501041******9330",
"installments": {
"number": 1,
"total": 1001,
"financial_cost": 0,
"value_per_installment": 1001
}
}
},
"changelog": [
{
"new_status": "PROCESSED",
"old_status": "PENDING",
"updated_date": "2024-10-24T21:58:21.376292738Z"
},
{
"new_status": "APPROVED",
"old_status": "PROCCESED",
"updated_date": "2024-10-24T21:58:21.376292738Z"
}
],
"created_date": "2024-10-24T21:53:00.256200745Z",
"updated_date": "2024-10-24T21:58:21.376292738Z"
}{
"uuid": "34bdfeea-5d87-4878-9601-571xc9b2f076",
"amount": 1001,
"status": "REFUNDED",
"external_reference": "idFromIntegration",
"commissions": [],
"taxes": [],
"customer": {
"name": "Customer name",
"card": {
"holder_name": "card holder name",
"issuer": "MASTER",
"pan": "501041******9330",
"installments": {
"number": 1,
"total": 1001,
"financial_cost": 0,
"value_per_installment": 1001
}
}
},
"changelog": [
{
"new_status": "APPROVED",
"old_status": "PROCESSED",
"updated_date": "2024-10-24T21:58:21.376292738Z"
},
{
"new_status": "REFUNDED",
"old_status": "APPROVED",
"updated_date": "2024-10-25T15:10:03.128492738Z"
}
],
"created_date": "2024-10-24T21:53:00.256200745Z",
"updated_date": "2024-10-25T15:10:03.128492738Z"
}{
"code": "request_error",
"message": "Invalid query string request payload.",
"errors": [
"The limit must be less than 50.",
"Provide a valid sort order (Ex: ascending or descending).",
"Provide a valid status.",
"Provide a valid from_date (Ex: YYYY-MM-DD).",
"Provide a valid to_date (Ex: YYYY-MM-DD).",
"Provide a valid last_search_key."
]
}{
"message": "Unauthorized"
}{
"message": "User is not authorized to access this resource with an explicit deny"
}{
"code": "api_error",
"message": "Something bad happened. Please try again."
}Siguiente
Obtener órdenes