Approve Transaction

This API is used to approve a transaction by validating the provided merchant ID, token, and payment ID. If the transaction is valid and the website is active, it will be marked as used.

Endpoint Details

  • URL: /api/transaction/approve

  • Method: POST

  • Content-Type: application/json

Request Parameters

Parameter

Type

Required

Description

merchant_id

string

Yes

The unique identifier of the merchant's website. Must exist in the websites table.

token

string

Yes

The transaction token associated with the payment.

payment_id

string

Yes

The unique identifier of the payment transaction.

Validation Rules

  • merchant_id must exist in the websites table.

  • token and payment_id must be valid strings.

Response

Success Response

Status Code: 200 OK

Error Responses

403 Forbidden - Inactive Website

Status Code: 403

404 Not Found - Invalid or Used Transaction

Status Code: 404

400 Bad Request - Unsuccessful Transaction

Status Code: 400

Notes

  • The approveTransaction API ensures that the transaction belongs to an active website.

  • If the transaction is already used, it cannot be approved again.

  • The updated_at field in the success response indicates when the transaction was marked as used.

Example Request

Example Implementation

Last updated