AtaraPay Docs

AtaraPay Docs

  • Integration
  • API Reference

›Order Status Automation

Integration Overview

  • Get Started
  • Ground-up Development
  • Framework Development

Authentication

  • Calculation of Auth Token

Payment Plugin

  • Inline Integration
  • Standard Integration
  • Go Live

eCommerce Plugin

  • WooCommerce Payment Plugin
  • Magento Payment Extension
  • Shopify Payment Plugin

Payouts

  • Service Provider API
  • Create Service Provider
  • Get Service Provider
  • Delete Service Provider
  • Update Order Commission (Business Seller)
  • Update Order Commission (Marketplace Operator)

Milestone Payments

  • Overview
  • Create Project
  • Update Project
  • Get Project

Order Status Automation

  • Overview
  • Delivery Completed API.
  • Seller Cancels Order API
  • Buyer Cancels Order API
  • Order Status API

Order Notification

  • Overview
  • Delivery Complete Notification
  • Buyer Accepts Order Notification
  • Buyer Rejects Order Notification
  • Buyer Cancels Order Notification
  • Buyer Cancels Disputed Order Notification
  • Seller Cancels Order Notification
  • Seller Cancels Disputed Order Notification
  • Second Delivery Attempt Notification
  • Generation of Security Token

Resources

  • Status Definition
  • Get Bank Details
  • Marketplace Integration
  • Product Features List

Order Status API


This API is used to get the escrow status of the order. Below are the fields that are to be sent via API using the POST Method to the URL:

For Staging: http://test-api.atarapay.com/api/callback/order
for live: https://api.atarapay.com/api/api/callback/order
Field nameRequiredDescription
authtokenYesThis is calculated using the steps mentioned mentioned here Calculation of Auth Token
orderYesThis is the Order Number from AtaraPay
statusYesThis is the status to be marked. Pass the value order

Successfull Response

{
    "status": "success",
    "message": "Order Fetched",
    "data": {
        "id": 3021,
        "type": 1,
        "customer_id": 278,
        "beneficiary_merchant_id": 117,
        "seller_email": null,
        "seller_phone": null,
        "buyer_email": null,
        "buyer_phone": null,
        "buyer_alt_phone": null,
        "buyer_account_number": null,
        "buyer_bank_code": null,
        "shipping_fee_bearer": null,
        "escrow_fee_bearer": null,
        "tx_fee_bearer": null,
        "is_marketplace": 0,
        "shipping_cost": 0,
        "category": null,
        "product_id": "1447",
        "product_name": "Samsung Galaxy 7s",
        "product_desc": "Samsung Galaxy 7s",
        "product_cost": 400000,
        "started_by": null,
        "amount_payed": 450000,
        "amount_net": 383250,
        "payment_number": 2532,
        "payment_ref": null,
        "gateway_name": "Paystack",
        "callback_url": null,
        "comment": "Testing api  cancelling",
        "delivery_man": 0,
        "delivery_location": "Gombe, NG, 140301",
        "delivery_city": "",
        "delivery_state": "",
        "delivery_country": "",
        "product_delivery_status": 0,
        "transaction_date": "2020-06-27 07:30:54",
        "delivery_date": "0000-00-00",
        "status": {
            "id": 9,
            "title": "Canceled",
            "description": "Order or Person to Person Transaction was Canceled",
            "deleted_at": null,
            "created_at": null,
            "updated_at": null
        },
        "state": 0,
        "shipping_method": null,
        "quantity": null,
        "max_delivery_days": 7,
        "extra": null,
        "is_additional_services": null,
        "additional_service_amount": null,
        "sla": 1,
        "cancellation_fee": 20000,
        "currency": "NGN",
        "conversion_ratio": 1,
        "deleted_at": null,
        "created_at": "2020-06-27 07:30:54",
        "updated_at": "2020-06-27 08:20:14",
        "attempts": null,
        "seller_attempts": "",
        "cron_status": null,
        "sp_order_ref": 0,
        "payment": {
            "id": 2532,
            "payment_ref": "LNG-17a2cc64b84811eab96200163e619ad2",
            "amount": 450000,
            "method": "card",
            "status": "1",
            "payment_date": "2020-06-27 07:30:54",
            "gateway_response": "Successful",
            "narrative": null,
            "deleted_at": null,
            "created_at": "2020-06-27 07:30:54",
            "updated_at": "2020-06-27 07:30:54"
        },
        "additional_services": [],
        "customers": {
            "id": 278,
            "firstname": "Emeka",
            "lastname": "Adeniyi",
            "phone_number": "+2348082094382",
            "phone_number_alt": null,
            "email": "emeka.adeniyi@atarapay.com",
            "otp_date": "2019-11-14 06:32:30",
            "status": 1,
            "deleted_at": null,
            "created_at": "2019-08-28 12:17:37",
            "updated_at": "2020-01-22 21:23:05"
        },
        "delivery_men": null
    }
}

Failure Response

{
    "status": "error",
    "message": "Invalid request to Process, Order has been already Processed"
}

Sample codes

C#

var client = new RestClient("http://test-api.atarapay.com/api/callback/order");
var request = new RestRequest(Method.POST);
request.AddHeader("postman-token", "7eb16eb4-c395-7477-de57-1723ea02f1c6");
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "authtoken=__AUTH_TOKEN_CALCULATED__&order=__Order_NO__&status=rejected&comment=__reason_for_cancelation__", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://test-api.atarapay.com/api/callback/order",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "authtoken=__AUTH_TOKEN_CALCULATED__&order=__Order_NO__&status=rejected&comment=__reason_for_cancelation__",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache",
    "content-type: application/x-www-form-urlencoded",
    "postman-token: 147f6e58-9642-81aa-fc66-e301fd7713a9"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Node Js

var unirest = require("unirest");

var req = unirest("POST", "http://test-api.atarapay.com/api/callback/order");

req.headers({
  "postman-token": "43b9ee82-e77d-f0ee-645d-e658b86ad0ef",
  "cache-control": "no-cache",
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
  "authtoken": "__AUTH_TOKEN_CALCULATED__",
  "order": "__Order_NO__",
  "status": "rejected",
  "comment":"_reason_for_cancelation__"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});

Possible Error Message

Error MessageField namePossible Reason
Invalid authtoken. Does not match any record.authtokenThe authtoken is not calculated correctly. Please refer here for the steps Calculation of Auth Token.
No such order exists for the seller.orderThe order number sent does not belong to the seller associated with the calculated authtoken
Invalid status sent.statusThis field accepts only the following values delivered,cancelled,buyer_cancel,order.Any other value passed would generate the error.
Invalid action. This request has already been processedorderThe order Id passed has been processed earlier.
← Buyer Cancels Order APIOverview →
Docs
IntegrationeCommerce PluginsAPI ReferenceAtaraPay
Other Links
About UsFrequently Asked QuestionsReport a Bug
Merchants
BenefitsOur Merchants
Follow @atarapayonline
AtaraPay
Copyright © 2024 AtaraPay