To retrieve the status of a payment, the user will call the endpoint using the GET verb like in the example below. The parameter sent to the API is the transaction id.


import requests
url = "https://api.dev.alignet.io/charges/127263" payload={}
headers = {
'ALG-API-VERSION': '1647960431',
'Authorization': 'Efre5z9iHWeAbjur67laFRHJp2tzAO1'
}
response = requests.request("GET", url, headers=headers, data=payload) print(response.text)
CODE

This shall give us a response with the following format

{
"success": true, "result": "notified", "error_code": "00",
"error_message": "Usuario fue notificado", "operation_number": "127263",
"purchase_amount": "10000", "purchase_currency_code": "PEN", "purchase_ip_address": "191.1.1.1", "transaction": {
"meta": { "commerce_id": "10",
"internal_operation_number": "127263", "additional_fields": [],
"metrics": {
"aggregate": {
"start": "1614875661264",
"end": "1614875672681",
"duration": { "milliseconds": "1000",
"seconds": "1"
}}},
"status": { "code": "00",
"message_ilgn": [
{
"locale": "es_PE",
"value": "Se encontró la información solicitada"
}]}},
"lifecycle": [
{
"step": "Payment Intent", "state": "Registered", "start": "1614875666264",
"end": "1614875672681",
"duration": { "milliseconds": "500",
"seconds": "0.5"
},
"meta": {
"status": {
"code": "00", "message_ilgn": [
{
"locale": "es_PE",
"value": "Se registró la transaccion correctamente"
}]}}},
{
"step": "Business Rules", "state": "Registered", "start": "1614875672681",
"end": "1614875673681",
"duration": { "milliseconds": "1000",
"seconds": "1"
},
"meta": {
"status": { "code": "00",
"message_ilgn": [
{
"locale": "es_PE",
"value": "La transaccion paso las reglas de negocio satisfactoriamente"
}]
}}},
{
"step": "Authentication", "state": "Registered", "start": "1614875674681",
"end": " 1614875675681",
"duration": { "milliseconds": "1000",
"seconds": "1"
},
"meta": {
"status": { "code": "00",
"message_ilgn": [
{
"locale": "es_PE",
"value": "Se paso la autenticacion satisfactoriamente"
}]}
}},
{
"step": "Authorization", "state": "Registered", "start": "1614875676681",
"end": " 1614875677181",
"duration": { "milliseconds": "500",
"seconds": "0.5"
},
"meta": {
"status": { "code": "00",
"message_ilgn": [
{
"locale": "es_PE",
"value": "La transaccion se envio correctamente a la procesadora"
}]}}},
{
"step": "Capture", "state": "Authorized",
"start": "1614875677181",
"end": " 1614875679181",
"duration": { "milliseconds": "2000",
"seconds": "2"
},
"meta": {
"status": { "code": "00",
"message_ilgn": [
{
"locale": "es_PE",
"value": "Respuesta satisfactoria de la procesadora"
}]}}},
{
"step": "Notification", "state": "Authorized", "start": "1614875679181",
"end": " 1614875680181",
"duration": { "milliseconds": "1000",
"seconds": "2"
},
"meta": {
"status": { "code": "00",
"message_ilgn": [
{
"locale": "es_PE",
"value": "Se envio la notificacion al comercio satisfactoriamente"
} ] }} }] 
} }
CODE

The response exposes the complete, and ordered, lifecycle of the transaction. To quickly obtain thelast status iterate over the lifecycle array and extract the last value.