Once you did initiate your transactions successfully on your account, you will still have a connection to it. With the already existing transactions in your account, you can perform a number of operations/actions on them like Query, Refund, Void, Capture, etc…


In this article you will be going to know about:


Postman Endpoint Collection


For the purposes of this article, you will need to use the following postman endpoints collection for testing and integrating, for proceeding with this please click here.



Query Transaction


If you have a transaction that you want to fetch its details, to know more about its status, type, etc.. you can use this endpoint as it will return the details of the requested transaction


Sample Request Payload

Post{{domain}}/payment/query


{
  "profile_id": "profile_id",
  "tran_ref": "TST2016700000692"
}

Sample Response Payload

{
  "tran_ref": "TST2105900091468",
  "tran_type": "Sale",
  "cart_id": "Sample Payment",
  "cart_description": "Sample Payment",
  "cart_currency": "EGP",
  "cart_amount": "1",
  "customer_details": {
    "name": "ALiaa Shafie",
    "email": "[email protected]",
    "phone": "01005417901",
    "street1": "Alexandria",
    "city": "Alexandria",
    "state": "ALX",
    "country": "EG",
    "ip": "40.123.210.168"
  },
  "payment_result": {
    "response_status": "A",
    "response_code": "G15046",
    "response_message": "Authorised",
    "transaction_time": "2021-02-28T12:24:06Z"
  },
  "payment_info": {
    "card_type": "Credit",
    "card_scheme": "Visa",
    "payment_description": "4111 11## #### 1111"
  }
}

Refund Transaction


Refund request is available for those Authenticated Sale transactions or Authenticated Capture transactions. In which the tran_type should be refund” and the requested transaction id to be refunded should be passed to tran_ref parameter in the request.


A new transaction (with new refernce) with type refund will be created for the refund process and will be linked to the original sale/capture transaction


Sample Request Payload

Post{{domain}}/payment/request


{
  "profile_id": "profile_id",
  "tran_type": "refund",
  "tran_ref": "TST2111000149148",
  "tran_class": "ecom",
  "cart_id": "cart_66666",
  "cart_currency": "USD",
  "cart_amount": 10,
  "cart_description": "Refund reason"
}

Sample Response Payload (Successful Refund)

{
  "tran_ref": "TST2111100150559",
  "tran_type": "Refund",
  "cart_id": "cart_66666",
  "cart_description": "Refund reason",
  "cart_currency": "USD",
  "cart_amount": "10.00",
  "customer_details": {
    "name": "first last",
    "email": "[email protected]",
    "phone": "0522222222",
    "street1": "address street",
    "city": "dubai",
    "state": "DU",
    "country": "AE",
    "ip": "196.219.200.200"
  },
  "payment_result": {
    "response_status": "A",
    "response_code": "G97111",
    "response_message": "Authorised",
    "transaction_time": "2021-04-21T09:25:11Z"
  },
  "payment_info": {
    "card_type": "Credit",
    "card_scheme": "Visa",
    "payment_description": "4111 11## #### 1111"
  }
}

Sample Response Payload (Failed Refund)

{
  "tran_ref": "TST2111100150570",
  "tran_type": "Refund",
  "cart_id": "cart_66666",
  "cart_description": "Refund reason",
  "cart_currency": "USD",
  "cart_amount": "10.00",
  "customer_details": {
    "name": "first last",
    "email": "[email protected]",
    "phone": "0522222222",
    "street1": "address street",
    "city": "dubai",
    "state": "DU",
    "country": "AE",
    "ip": "196.219.145.121"
  },
  "payment_result": {
    "response_status": "D",
    "response_code": "320",
    "response_message": "Unable to refund",
    "transaction_time": "2021-04-21T09:33:54Z"
  },
  "payment_info": {
    "card_type": "Credit",
    "card_scheme": "Visa",
    "payment_description": "4111 11## #### 1111"
  }
}

Capture Transaction


Capture request is available for successfully Authenticated Authorize transactions, to process a capture request tran_type should be capture” and the transaction id of the original Authorize transaction that you want to capture should be passed in the tran_ref parameter.


Sample Request Payload

Post{{domain}}/payment/request


{
  "profile_id": "profile_id",
  "tran_class": "ecom",
  "tran_type": "capture",
  "tran_ref": "TST2111100150565",
  "cart_id": "cart_11111",
  "cart_currency": "USD",
  "cart_amount": 200,
  "cart_description": "Description of the items/services",
  "callback": "https://webhook.site/4b3af623-085f-4b82-ab22-cb6cedeba218"
}

Sample Response Payload 

{
  "tran_ref": "TST2111100150569",
  "tran_type": "Capture",
  "cart_id": "cart_11111",
  "cart_description": "Description of the items/services",
  "cart_currency": "USD",
  "cart_amount": "200.00",
  "callback": "https://webhook.site/4b3af623-085f-4b82-ab22-cb6cedeba218",
  "customer_details": {
    "name": "first last",
    "email": "[email protected]",
    "phone": "0522222222",
    "street1": "address street",
    "city": "dubai",
    "state": "DU",
    "country": "AE",
    "ip": "1.1.1.1"
  },
  "payment_result": {
    "response_status": "A",
    "response_code": "G97564",
    "response_message": "Authorised",
    "transaction_time": "2021-04-21T09:32:44Z"
  },
  "payment_info": {
    "card_type": "Credit",
    "card_scheme": "Visa",
    "payment_description": "4111 11## #### 1111"
  }
}

Void Transaction


Void requests are available for Authenticated Authorize transactions that are not fully captured yet. To process a void request tran_type should be void” and the transaction id of the original Authorize transaction that you want to capture should be passed in the tran_ref parameter.


Sample Request Payload

Post{{domain}}/payment/request


{
  "profile_id": "profile_id",
  "tran_class": "ecom",
  "tran_type": "void",
  "tran_ref": "TST2111100150606",
  "cart_id": "cart_11111",
  "cart_currency": "EGP",
  "cart_amount": 100,
  "cart_description": "Void reason"
}

Sample Response Payload 

{
  "tran_ref": "TST2111100150608",
  "tran_type": "Void",
  "cart_id": "cart_11111",
  "cart_description": "Void reason",
  "cart_currency": "EGP",
  "cart_amount": "100.00",
  "customer_details": {
    "name": "first last",
    "email": "[email protected]",
    "phone": "0522222222",
    "street1": "address street",
    "city": "dubai",
    "state": "DU",
    "country": "AE",
    "ip": "196.219.145.121"
  },
  "payment_result": {
    "response_status": "A",
    "response_code": "G98948",
    "response_message": "Authorised",
    "transaction_time": "2021-04-21T09:55:48Z"
  },
  "payment_info": {
    "card_type": "Credit",
    "card_scheme": "Visa",
    "payment_description": "4111 11## #### 1111"
  }
}