> For the complete documentation index, see [llms.txt](https://docs.sensepass.com/sensepay/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sensepass.com/sensepay/transaction-api/terminal-agent/usage/get-last-transaction-status.md).

# Get Last Transaction Status

Terminal Agent expose an API to recover from network issue while using the[ Sync payment API](/sensepay/transaction-api/terminal-agent/usage/synchronous-payment.md),

in event of error or closed connection, you can use this API to fetch the current status of the last transaction created.

### Usage Flow:

1. Call **GET** request to: <http://localhost:8003/api/transactions/last\\>
   Without any request payload
2. **DeviceId field is not required** - Terminal agent will append it automatically
3. Reponse will return immediately according to [Transaction Status](/sensepay/transaction-api/payment-flows/transaction-status.md) schema

### Example

URL: **<http://localhost:8003/api/transactions/last>**

Response body:

```json
{
    "TransactionNumber": "1dde6de24cb4b96678517350c075a3e89a4103ed3132b3444ee055ed",
    "date": "2024-04-17T19:50:33.588Z",
    "amount": "1",
    "baseAmount": "1",
    "currency": "USD",
    "status": 5,
    "statusName": "Transaction Approved",
    "timeoutDate": "2024-04-17T19:58:53.820Z",
    "maxInstallments": 1,
    "reason": null,
    "paymentCommit": {
        "messsage": "Please Commit this payment in 7200 seconds",
        "secondsToCommit": 7200,
        "commitLink": "https://api.sandbox.sensepass.com/api/transactions/commitPayment/1dde6de24cb4b96678517350c075a3e89a4103ed3132b3444ee055ed"
    },
    "methodType": 0,
    "businessId": "91878198955101",
    "businessName": "SensePass",
    "pos": "SensePass",
    "businessOwnerPhone": "113654",
    "businessCountry": "USA",
    "businessCity": "A",
    "businessState": "B",
    "businessStreet": "NY",
    "businessAddress": "NY",
    "locale": {
        "language": "en"
    },
    "products": [],
    "productsSum": {
        "allAmountSum": "0.00",
        "allTipSum": "NaN",
        "allVatSum": "0.00",
        "allTotalSum": "0.00",
        "allDiscountSum": "0.00",
        "allDiscountedAmountSum": "0.00"
    },
    "paymentProcessRequestID": "5330731519",
    "confirmation": {
        "approvedBy": "Shift4 Sandbox",
        "dateApproval": "2024-04-17T19:50:44.964Z",
        "approvalDate": "2024-04-17T19:50:44.964Z",
        "paymentType": "Regular",
        "sensePassReferenceId": "d4t9xyubad5geoj1c2yc",
        "paymentMethodName": "Credit Card (Sensepass PCI)",
        "providerId": "bmU4Ip5koVvi8harpkh5WW50BEQj7FpdNJhWkTMEbqQ=",
        "authNumber": null,
        "acquirer": null,
        "voucher": null,
        "referenceNumber": null,
        "requestID": "5330731519",
        "amount": 1,
        "confirmationNumber": "297-OK522Z",
        "fullConfirmationCode": "297-OK522Z",
        "providerName": "Shift4 Sandbox",
        "cardType": "VISA",
        "lastFourDigits": "1111",
        "cardMask": "411111******1111",
        "expiration": "1234",
        "cardExpiration": "1234",
        "installments": 1,
        "paymentMethod": "Credit Card",
        "Credit Card": {
            "cardType": "VISA",
            "lastFourDigits": "1111",
            "mask": "411111******1111",
            "expiration": "1234"
        },
        "extraDetails": {
            "email": null
        }
    },
    "confirmationNumber": "297-OK522Z",
    "confirmations": [
        {
            "approvedBy": "Shift4 Sandbox",
            "dateApproval": "2024-04-17T19:50:44.964Z",
            "approvalDate": "2024-04-17T19:50:44.964Z",
            "paymentType": "Regular",
            "sensePassReferenceId": "d4t9xyubad5geoj1c2yc",
            "paymentMethodName": "Credit Card (Sensepass PCI)",
            "providerId": "bmU4Ip5koVvi8harpkh5WW50BEQj7FpdNJhWkTMEbqQ=",
            "authNumber": null,
            "acquirer": null,
            "voucher": null,
            "referenceNumber": null,
            "requestID": "5330731519",
            "amount": 1,
            "confirmationNumber": "297-OK522Z",
            "fullConfirmationCode": "297-OK522Z",
            "providerName": "Shift4 Sandbox",
            "cardType": "VISA",
            "lastFourDigits": "1111",
            "cardMask": "411111******1111",
            "expiration": "1234",
            "cardExpiration": "1234",
            "installments": 1,
            "paymentMethod": "Credit Card",
            "Credit Card": {
                "cardType": "VISA",
                "lastFourDigits": "1111",
                "mask": "411111******1111",
                "expiration": "1234"
            },
            "extraDetails": {
                "email": null
            }
        }
    ],
    "balance": 1,
    "paymentMethodImages": {},
    "clientPhoneNumber": null,
    "clientEmail": null
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sensepass.com/sensepay/transaction-api/terminal-agent/usage/get-last-transaction-status.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
