Get Payment
GET {{base-url}}/payment/{{payment-id}}
Returns the current payment data, including the status of the payment and the current workflow step.
Parameters
Path
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The payment ID (UUID) |
Response
{
"merchant": {
"name": "string",
"description": "string",
"logoUrl": "string",
"cssUrl": "string",
"layout": "string"
},
"status": {
"name": "string",
"description": "string",
"failed": "boolean"
},
"workflow": {
"index": "integer",
"name": "string",
"component": "string"
}
}
payload
| Name | Type | Description |
|---|---|---|
| merchant | object | The merchant object |
| status | object | The payment status object |
| workflow | object | The payment workflow object |
merchant
| Name | Type | Description |
|---|---|---|
| name | string | The merchant name |
| description | string | The merchant description |
| logoUrl | string | The merchant logo URL |
| cssUrl | string | The merchant CSS URL |
| layout | string | The merchant layout |
status
| Name | Type | Description |
|---|---|---|
| name | string | The payment status name |
| description | string | The payment status description |
| failed | boolean | The payment failure indicator |
workflow
| Name | Type | Description |
|---|---|---|
| index | integer | The workflow index |
| name | string | The workflow step name |
| component | string | The workflow component |
Example
{
"merchant": {
"name": "Teljoy",
"description": "Teljoy payment gateway",
"logoUrl": "https://example.com/logo.png",
"cssUrl": "https://example.com/style.css",
"layout": "default"
},
"status": {
"name": "Completed",
"description": "Payment has been completed successfully",
"failed": false
},
"workflow": {
"index": 1,
"name": "PaymentStep",
"component": "PaymentComponent"
}
}
Errors
| Code | Description |
|---|---|
| 400 | One or more validation errors have occurred. |
| 404 | Can't find a GetPaymentDTO with the parameters provided. |
| 500 | Server Error |
Bad Request Example
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "22e63b75-a5ce-4ff7-90fc-c88a069947fe",
"errors": {
"id": ["The id field is required."]
}
}
Not Found Example
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.4",
"title": "Can't find a GetPaymentDTO with the parameters provided.",
"status": 404,
"traceId": "3db748ea-230e-4205-af35-72182428ed0f"
}
Internal Server Error Example
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.6.1",
"title": "An error occurred.",
"status": 500,
"traceId": "ced4db70-527d-41d6-9a90-e7eb165df5b6"
}
Example Usage
Here's an example of how to make a GET request to the /api/v1/payment/{payment-id} endpoint using Javascript and the fetch API:
"Accept": "*/*",
"api-key": "your_api_key"
}
let response = await fetch("http://localhost:3000/api/v1/payment/590fbc3e-784e-4519-95b0-08db35c30d2b", {
method: "GET",
headers: headersList
});
let data = await response.text();
console.log(data);
Replace your_api_key with your actual API key.
Expected Response
This is an example of the expected response:
{
"merchant": {
"name": "Masons",
"description": "The merchant account for Masons",
"logoUrl": "https://masons.co.za/wp-content/uploads/2019/05/Masons.png",
"cssUrl": "/themes/masons/styles.css",
"layout": "layout-01"
},
"status": {
"name": "Started",
"description": "",
"failed": false
},
"workflow": {
"index": 1,
"name": "Product Selection",
"component": "product"
}
}