To retrieve the details of an existing payment, you will need to send an HTTP GET request to the following endpoint:
GET https://<api-host>/v1/payments/<paymentId>
Replace `<api-host>` with the appropriate API host URL, either `https://api-sandbox.trustistecommerce.com` for the sandbox environment or `https://api.trustistecommerce.com` for the production environment. Replace `<paymentId>` with the unique identifier of the payment you want to retrieve.
Headers:
– `Authorization`: Hawk authentication header (generated using your client ID, private key, and other Hawk authentication parameters)
Example request:
GET https://api-sandbox.trustistecommerce.com/v1/payments/your_payment_id
Authorization: Hawk id=”your-client-id”, ts=”1618886397″, nonce=”a_random_nonce”, hash=”generated_request_hash”, ext=”hawk.1.header”, mac=”generated_mac”
Response:
The API will respond with a JSON object containing the following fields:
– `id`: The unique identifier for the payment
– `status`: The current status of the payment (e.g., “Pending”, “Completed”, “Failed”)
– `amount`: The payment amount as a decimal value
– `reference`: The unique reference for the payment
If successful, the response will have a 200 OK status code. In case of an error, the API will return an appropriate error status code and a message describing the issue.