> For the complete documentation index, see [llms.txt](https://docs.payshield.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payshield.ai/transaction-processing/integrations-and-apis/rest-api/transaction-ptxid.md). Agents can also search and read this documentation through its [MCP server](https://docs.payshield.ai/~gitbook/mcp).

# Transaction - ptxid

Most of the following API's will require a PTXID(Parent Transaction ID) and are based around handling transactions once they have been created.\
\
For information on how to create a transaction via a REST call, see the [SID Section](https://docs.payshield.ai/transaction-processing/integrations-and-apis/rest-api/site-sid-payments.md)

#### Request Header

`Authorization: Bearer <token>`

## GET /{ptxid}/getstatus

> Get the latest status of the transaction

```json
{"openapi":"3.0.0","info":{"title":"Txshield Api Version 1","version":"1.0"},"servers":[{"url":"/api/v1/index.php"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Personal API token of a user associated with the site. "}},"schemas":{"statusResponse":{"properties":{"tid":{"type":"string","description":"tid sent through with the transaction"},"txid":{"type":"integer","format":"int64","description":"Transaction id"},"parent_txid":{"type":"integer","format":"int64","description":"Each Transaction has a unique id. The parent transaction is the transaction that groups all transaction together."},"status":{"type":"string","description":"Has the value \"OK\" for a successful transaction, \"EXC\" for a failed transaction, \"PEND\" for a transaction in progress."},"tx_action":{"type":"string","description":"The state change txaction, e.g. \"PAYMENT\", \"REFUND\""},"amount":{"type":"number","description":"The amount of the transaction"},"currency":{"type":"string","description":"The currency of the transaction"},"reference":{"description":"Merchant reference","type":"string"},"ref1":{"type":"string","description":"your reference 1"},"ref2":{"type":"string","description":"your reference 2"},"ref3":{"type":"string","description":"your reference 3"},"ref4":{"type":"string","description":"your reference 4"},"vrfy":{"type":"string","description":"This is a sha256 hash so the data can be verified. Generate sha256 hash of the string of sid;rcode;txid;status;amount;currency;txaction"}}},"errorModel":{"required":["code","message"],"properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}},"paths":{"/{ptxid}/getstatus":{"get":{"description":"Get the latest status of the transaction","parameters":[{"name":"ptxid","in":"path","description":"Parent txid of the transaction","required":true,"schema":{"type":"string"}},{"name":"hash","in":"query","description":"sha256 hash of sid and rcode(this is a new version)","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Lookup result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/statusResponse"}}}},"default":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorModel"}}}}}}}}}
```

## POST /{ptxid}/requery

> Requery the status of the transaction from gateway\[Gateway dependant]

```json
{"openapi":"3.0.0","info":{"title":"Txshield Api Version 1","version":"1.0"},"servers":[{"url":"/api/v1/index.php"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Personal API token of a user associated with the site. "}},"schemas":{"statusResponse":{"properties":{"tid":{"type":"string","description":"tid sent through with the transaction"},"txid":{"type":"integer","format":"int64","description":"Transaction id"},"parent_txid":{"type":"integer","format":"int64","description":"Each Transaction has a unique id. The parent transaction is the transaction that groups all transaction together."},"status":{"type":"string","description":"Has the value \"OK\" for a successful transaction, \"EXC\" for a failed transaction, \"PEND\" for a transaction in progress."},"tx_action":{"type":"string","description":"The state change txaction, e.g. \"PAYMENT\", \"REFUND\""},"amount":{"type":"number","description":"The amount of the transaction"},"currency":{"type":"string","description":"The currency of the transaction"},"reference":{"description":"Merchant reference","type":"string"},"ref1":{"type":"string","description":"your reference 1"},"ref2":{"type":"string","description":"your reference 2"},"ref3":{"type":"string","description":"your reference 3"},"ref4":{"type":"string","description":"your reference 4"},"vrfy":{"type":"string","description":"This is a sha256 hash so the data can be verified. Generate sha256 hash of the string of sid;rcode;txid;status;amount;currency;txaction"}}},"errorModel":{"required":["code","message"],"properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}},"paths":{"/{ptxid}/requery":{"post":{"description":"Requery the status of the transaction from gateway[Gateway dependant]","parameters":[{"name":"ptxid","in":"path","description":"Parent txid of the transaction","required":true,"schema":{"type":"string"}},{"name":"sid","in":"query","description":"sid of site","required":true,"schema":{"type":"integer"}},{"name":"rcode","in":"query","description":"Rcode of the sid","required":true,"schema":{"type":"string"}},{"name":"reference","in":"query","description":"Reference","required":false,"schema":{"type":"string"}},{"name":"postback_url","in":"query","description":"url to which a postback should be sent","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Lookup result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/statusResponse"}}}},"default":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorModel"}}}}}}}}}
```

## POST /{ptxid}/sendauth

> request to continue transaction submission with auth

```json
{"openapi":"3.0.0","info":{"title":"Txshield Api Version 1","version":"1.0"},"servers":[{"url":"/api/v1/index.php"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Personal API token of a user associated with the site. "}},"schemas":{"statusResponse":{"properties":{"tid":{"type":"string","description":"tid sent through with the transaction"},"txid":{"type":"integer","format":"int64","description":"Transaction id"},"parent_txid":{"type":"integer","format":"int64","description":"Each Transaction has a unique id. The parent transaction is the transaction that groups all transaction together."},"status":{"type":"string","description":"Has the value \"OK\" for a successful transaction, \"EXC\" for a failed transaction, \"PEND\" for a transaction in progress."},"tx_action":{"type":"string","description":"The state change txaction, e.g. \"PAYMENT\", \"REFUND\""},"amount":{"type":"number","description":"The amount of the transaction"},"currency":{"type":"string","description":"The currency of the transaction"},"reference":{"description":"Merchant reference","type":"string"},"ref1":{"type":"string","description":"your reference 1"},"ref2":{"type":"string","description":"your reference 2"},"ref3":{"type":"string","description":"your reference 3"},"ref4":{"type":"string","description":"your reference 4"},"vrfy":{"type":"string","description":"This is a sha256 hash so the data can be verified. Generate sha256 hash of the string of sid;rcode;txid;status;amount;currency;txaction"}}},"errorModel":{"required":["code","message"],"properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}},"paths":{"/{ptxid}/sendauth":{"post":{"description":"request to continue transaction submission with auth","parameters":[{"name":"ptxid","in":"path","description":"Parent txid of the transaction","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"authtype":{"description":"The authentication method.","type":"string","enum":["SMS","PASSWORD"]},"authvalue":{"description":"The authentication value, either the SMS Code or Password.","type":"string"},"miscdata":{"description":"Additional data required for processing. eg) Name|Card Number","type":"string"},"hash":{"description":"sha256(sid+rcode)","type":"string"}},"required":["authtype","authvalue","miscdata","hash"]}}}},"responses":{"200":{"description":"Lookup result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/statusResponse"}}}},"default":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorModel"}}}}}}}}}
```

## GET /{ptxid}/resendauth

> request to resend the auth

```json
{"openapi":"3.0.0","info":{"title":"Txshield Api Version 1","version":"1.0"},"servers":[{"url":"/api/v1/index.php"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Personal API token of a user associated with the site. "}},"schemas":{"statusResponse":{"properties":{"tid":{"type":"string","description":"tid sent through with the transaction"},"txid":{"type":"integer","format":"int64","description":"Transaction id"},"parent_txid":{"type":"integer","format":"int64","description":"Each Transaction has a unique id. The parent transaction is the transaction that groups all transaction together."},"status":{"type":"string","description":"Has the value \"OK\" for a successful transaction, \"EXC\" for a failed transaction, \"PEND\" for a transaction in progress."},"tx_action":{"type":"string","description":"The state change txaction, e.g. \"PAYMENT\", \"REFUND\""},"amount":{"type":"number","description":"The amount of the transaction"},"currency":{"type":"string","description":"The currency of the transaction"},"reference":{"description":"Merchant reference","type":"string"},"ref1":{"type":"string","description":"your reference 1"},"ref2":{"type":"string","description":"your reference 2"},"ref3":{"type":"string","description":"your reference 3"},"ref4":{"type":"string","description":"your reference 4"},"vrfy":{"type":"string","description":"This is a sha256 hash so the data can be verified. Generate sha256 hash of the string of sid;rcode;txid;status;amount;currency;txaction"}}},"errorModel":{"required":["code","message"],"properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}},"paths":{"/{ptxid}/resendauth":{"get":{"description":"request to resend the auth","parameters":[{"name":"ptxid","in":"path","description":"Parent txid of the transaction","required":true,"schema":{"type":"string"}},{"name":"hash","in":"query","description":"sha256(sid+rcode)","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Lookup result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/statusResponse"}}}},"default":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorModel"}}}}}}}}}
```

## POST /gettoken

> get access token

```json
{"openapi":"3.0.0","info":{"title":"Txshield Api Version 1","version":"1.0"},"servers":[{"url":"/api/v1/index.php"}],"security":[],"paths":{"/gettoken":{"post":{"description":"get access token","requestBody":{"content":{"application/json":{"schema":{"properties":{"username":{"description":"Username","type":"string"},"password":{"description":"Password","type":"string"}},"required":["username","password"]}}}},"responses":{"200":{"description":"Lookup result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/statusResponse"}}}},"default":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorModel"}}}}}}}},"components":{"schemas":{"statusResponse":{"properties":{"tid":{"type":"string","description":"tid sent through with the transaction"},"txid":{"type":"integer","format":"int64","description":"Transaction id"},"parent_txid":{"type":"integer","format":"int64","description":"Each Transaction has a unique id. The parent transaction is the transaction that groups all transaction together."},"status":{"type":"string","description":"Has the value \"OK\" for a successful transaction, \"EXC\" for a failed transaction, \"PEND\" for a transaction in progress."},"tx_action":{"type":"string","description":"The state change txaction, e.g. \"PAYMENT\", \"REFUND\""},"amount":{"type":"number","description":"The amount of the transaction"},"currency":{"type":"string","description":"The currency of the transaction"},"reference":{"description":"Merchant reference","type":"string"},"ref1":{"type":"string","description":"your reference 1"},"ref2":{"type":"string","description":"your reference 2"},"ref3":{"type":"string","description":"your reference 3"},"ref4":{"type":"string","description":"your reference 4"},"vrfy":{"type":"string","description":"This is a sha256 hash so the data can be verified. Generate sha256 hash of the string of sid;rcode;txid;status;amount;currency;txaction"}}},"errorModel":{"required":["code","message"],"properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}}}
```

#### processrefund

processrefund uses your Bearer token for Authentication and takes in JSON data.\
\
If the transaction is still a PREAUTH that hasn't been settled, the transaction will be VOID instead.\
\
It should be noted that you can't do a partial VOID, a VOID is for the full transaction amount. You can however do a partial refund.

## POST /txprocess/transaction/{parentxid}/processrefund

>

```json
{"openapi":"3.0.1","info":{"title":"TxShield api V3.0","version":"3.0"},"tags":[{"name":"Transactions","description":"Call related to transactions in txshield core."}],"servers":[{"url":"<?=PROTOCOL?>://<?=SITE_DOMAIN?>/api/v3"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"RefundActionResponse":{"type":"object","properties":{"sid":{"type":"integer"},"status":{"type":"string"},"parent_txid":{"type":"integer"},"txid":{"type":"integer"},"tx_action":{"type":"string"},"amount":{"anyOf":[{"type":"string"},{"type":"number"}]},"currency":{"type":"string"},"tid":{"type":"string"},"ref1":{"type":"string"},"ref2":{"type":"string"},"ref3":{"type":"string"},"ref4":{"type":"string"},"comment":{"type":"string"},"descriptor":{"type":"string"},"pay_method":{"type":"string"}}},"Error":{"type":"object","properties":{"msg":{"type":"string"},"details":{"type":"string"}}}}},"paths":{"/txprocess/transaction/{parentxid}/processrefund":{"post":{"tags":["Transactions"],"parameters":[{"name":"parentxid","in":"path","description":"Parent Transaction Id to get the tx_Action list","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"amount":{"type":"number"},"currency":{"type":"string"}}}},"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"number"},"currency":{"type":"string"}}}}}},"responses":{"200":{"description":"Successfully refunded response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundActionResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.payshield.ai/transaction-processing/integrations-and-apis/rest-api/transaction-ptxid.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
