Skip to main content

Order Interface - INDIA

Includes deposit/payment on behalf, recharge, settlement, and other order interfaces

Request

Request URL

POST https://DOMAIN/octopus/api/order/new

Basic parameters



Parameter name Type Required Description Format / Example
transaction_type string Transaction type income or expense
amount string Transaction amount "100.00"
merchant_order_id string Merchant’s order ID Merchant-generated unique order ID
merchant_uid string Merchant UID Obtain from administrator
currency string Transaction currency inr
payment string Payment method
india
redirect_url string Redirect URL after transaction completion "https://example.com/redirect"
notify_url string Server notification URL "https://example.com/notify"
response_type string Response type. Currently only supports "json"; empty means 302 redirect Response type. Currently only supports "json"; empty means 302 redirect
country string Country code
India
accounting_type string Accounting type recharge / receive / pay / settle
from string Payer account (income verification) "6660006666789"
from_name string Payer name (income verification)

"John Doe"

To use the blacklist feature, you must provide a unique identifier for the user, such as member_idusername, etc.

from_bank_name string Payer bank name (income verification) UPI
to string Payee account (expenditure verification) "6660006666987"
to_name string Payee name (expenditure verification) "Jane Doe"
to_bank_name string Payee bank name (expenditure verification)

UPI

merchant_id string member id

merchant_id=member id
To use the blacklist feature, you must provide a unique identifier for the user, such as member_idusername, etc.

Signature parameters in headers



Header Type Required Description Example
Content-Type string Yes   application/json
OC-Key string Yes Obtain from support  
OC-Signature string Yes Computed HMAC-SHA256  

Deposit

Java example (building payload, computing HMAC-SHA256 signature, POST with OC-Key and OC-Signature):

import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.util.*;
import org.json.JSONObject;

public class Main {
  private static final String API_KEY = "API_KEY";
  private static final String API_SECRET = "API_SECRET";
  private static final String MerchantUID = "Merchant_UID";
  private static final String API_URL = "https://DOMAIN/octopus/api/order/new";

  public static void main(String[] args) {
    try {
      Map<String, String> data = new TreeMap<>();
      data.put("transaction_type", "income");
      data.put("amount", "100.00");
      data.put("currency", "mmk");
      data.put("payment", "myanmar");
      data.put("to_bank_name", "kbz");
      data.put("merchant_order_id", "123qq");
      data.put("merchant_uid", MerchantUID);
      data.put("redirect_url", "https://example.com/redirect");
      data.put("notify_url", "https://example.com/notify");
      data.put("response_type", "json");
      data.put("country", "myanmar");
      data.put("channel", "myanmar");
      data.put("accounting_type", "receive");

      StringBuilder dataString = new StringBuilder();
      for (Map.Entry<String, String> entry : data.entrySet()) {
        if (dataString.length() > 0) dataString.append("&");
        dataString.append(entry.getKey()).append("=").append(entry.getValue());
      }

      Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
      SecretKeySpec secret_key = new SecretKeySpec(API_SECRET.getBytes(), "HmacSHA256");
      sha256_HMAC.init(secret_key);
      String signature = javax.xml.bind.DatatypeConverter
          .printHexBinary(sha256_HMAC.doFinal(dataString.toString().getBytes()))
          .toLowerCase();

      URL url = new URL(API_URL);
      HttpURLConnection conn = (HttpURLConnection) url.openConnection();
      conn.setRequestMethod("POST");
      conn.setRequestProperty("Content-Type", "application/json");
      conn.setRequestProperty("OC-Key", API_KEY);
      conn.setRequestProperty("OC-Signature", signature);
      conn.setDoOutput(true);

      String jsonInputString = new JSONObject(data).toString();
      try (OutputStream os = conn.getOutputStream()) {
        byte[] input = jsonInputString.getBytes("utf-8");
        os.write(input, 0, input.length);
      }

      // Read the response ...
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

Response (deposit)

  • On success:
    • result"success"
    • data{"payment": {...}, "payment_url": "url"}

Payment

Java example:

import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.util.*;
import org.json.JSONObject;

public class Main {
  private static final String API_KEY = "API_KEY";
  private static final String API_SECRET = "API_SECRET";
  private static final String MerchantUID = "Merchant_UID";
  private static final String API_URL = "https://DOMAIN/octopus/api/order/new";

  public static void main(String[] args) {
    try {
      Map<String, String> data = new TreeMap<>();
      data.put("transaction_type", "expense");
      data.put("amount", "100.00");
      data.put("currency", "mmk");
      data.put("payment", "myanmar");
      data.put("to_bank_name", "kbz");
      data.put("to_name", "aaaaaaa");
      data.put("to", "99999999");
      data.put("merchant_order_id", "123qq");
      data.put("merchant_uid", MerchantUID);
      data.put("redirect_url", "https://example.com/redirect");
      data.put("notify_url", "https://example.com/notify");
      data.put("response_type", "json");
      data.put("country", "myanmar");
      data.put("channel", "myanmar");
      data.put("accounting_type", "pay");

      StringBuilder dataString = new StringBuilder();
      for (Map.Entry<String, String> entry : data.entrySet()) {
        if (dataString.length() > 0) dataString.append("&");
        dataString.append(entry.getKey()).append("=").append(entry.getValue());
      }

      Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
      SecretKeySpec secret_key = new SecretKeySpec(API_SECRET.getBytes(), "HmacSHA256");
      sha256_HMAC.init(secret_key);
      String signature = javax.xml.bind.DatatypeConverter
          .printHexBinary(sha256_HMAC.doFinal(dataString.toString().getBytes()))
          .toLowerCase();

      URL url = new URL(API_URL);
      HttpURLConnection conn = (HttpURLConnection) url.openConnection();
      conn.setRequestMethod("POST");
      conn.setRequestProperty("Content-Type", "application/json");
      conn.setRequestProperty("OC-Key", API_KEY);
      conn.setRequestProperty("OC-Signature", signature);
      conn.setDoOutput(true);

      String jsonInputString = new JSONObject(data).toString();
      try (OutputStream os = conn.getOutputStream()) {
        byte[] input = jsonInputString.getBytes("utf-8");
        os.write(input, 0, input.length);
      }

      // Read the response ...
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

Response (payout)

  • On success:

    • result"success"
    • data{"payment": {...}}
  • On error:

{
  "result": "error",
  "data": "An error occurred processing your request"
}
or

{
  "result": "error",
  "data": {
    "error": "Invalid parameters",
    "details": "The 'amount' field is required."
  }
}

Payment Object Total JSON Field Description

  • from: Sender's account number.
  • from_name: Sender's account name.
  • from_bank_name: Sender's bank name.
  • to: Receiver's account number.
  • to_name: Receiver's account name.
  • to_bank_name: Receiver's bank name.
  • amount: Original amount of the order.
  • final_amount: Final amount of the order.
  • currency: Currency used for the transaction.
  • country: Transaction country.
  • transaction_type: Transaction type (income/expense).
  • accounting_type: Accounting type (for income: receipt, recharge; for expense: payment, settlement).
  • merchant_order_id: Merchant order number.
  • merchant_uid: Merchant's unique identifier.
  • merchant_name: Merchant name.
  • channel: Transaction channel.
  • payment_status: Payment status.
  • payment_fail_reason: Reason for payment failure.
  • payment: Payment method.
  • response_type: Response type.
  • ip: User IP address.
  • user_agent: User agent.
  • distribute_rules: Distribution rules.
  • payment_uid: Unique identifier for the payment.
  • redirect_url: Redirect URL.
  • notify_url: Notification URL.
  • notify_status: Notification status.
  • notify_fail_reason: Reason for notification failure.
  • accounting_status: Accounting status.
  • accounting_fail_reason: Reason for accounting processing failure.
  • signature_key: Signature key.
json

{
  "result": "success",
  "data": {
    "payment": {
      // payment fields...
    },
    "payment_url": "https://example.com/payments/checkout"
  }
}

Error examples:

json
{"result":"error","data":"An error occurred processing your request"}
{"result":"error","data":{"error":"Invalid parameters","details":"The 'amount' field is required."}}


Order Query

Query the status and details of a specific order.

Request URL

POST https://DOMAIN/octopus/api/order/get

Request parameters

  • merchant_order_id: Merchant’s unique order ID used during creation.

Returned JSON fields

  • fromfrom_namefrom_bank_name
  • toto_nameto_bank_name
  • amountfinal_amount
  • currencycountry
  • transaction_type
  • accounting_type (for income: receiverecharge; for expense: paysettle)
  • merchant_order_idmerchant_uidmerchant_name
  • channel
  • payment_statuspayment_fail_reason
  • payment (method)
  • response_type
  • ipuser_agent
  • distribute_rules
  • payment_uid
  • redirect_urlnotify_url
  • notify_statusnotify_fail_reason
  • accounting_statusaccounting_fail_reason
  • signature_key

Java example for order query (sign and send POST with headers):

import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.json.JSONObject;

public class OrderQuery {
  private static final String API_KEY = "API_KEY";
  private static final String API_SECRET = "API_SECRET";
  private static final String API_URL = "https://DOMAIN/octopus/api/order/get";

  public static void main(String[] args) {
    try {
      Map<String, String> params = new HashMap<>();
      params.put("merchant_order_id", "12345611");

      List<String> keys = new ArrayList<>(params.keySet());
      Collections.sort(keys);
      StringBuilder dataToSign = new StringBuilder();
      for (String key : keys) {
        if (dataToSign.length() > 0) dataToSign.append("&");
        dataToSign.append(key).append("=").append(params.get(key));
      }

      Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
      SecretKeySpec secret_key = new SecretKeySpec(API_SECRET.getBytes(), "HmacSHA256");
      sha256_HMAC.init(secret_key);
      String signature = javax.xml.bind.DatatypeConverter
          .printHexBinary(sha256_HMAC.doFinal(dataToSign.toString().getBytes()))
          .toLowerCase();

      String dataString = new JSONObject(params).toString();

      URL url = new URL(API_URL);
      HttpURLConnection conn = (HttpURLConnection) url.openConnection();
      conn.setRequestMethod("POST");
      conn.setRequestProperty("Content-Type", "application/json");
      conn.setRequestProperty("OC-Key", API_KEY);
      conn.setRequestProperty("OC-Signature", signature);
      conn.setDoOutput(true);

      try (OutputStream os = conn.getOutputStream()) {
        byte[] input = dataString.getBytes("utf-8");
        os.write(input, 0, input.length);
      }

      // Read the response...
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}


Common enum field explanations

Payment status (payment_status)

  • none: Default, not set
  • pending: Order created, payment not started
  • preparing: The order is preparing to pay
  • processing: Payment in progress
  • completed: Payment succeeded
  • failed: Payment failed
  • reject: Payment rejected
  • refund: Refunded
  • overdue: Not completed within the allowed time

Notification status (notify_status)

  • none: Default
  • delivered: Notification sent but unacknowledged
  • completed: Notification delivered successfully
  • failed: Notification failed

Accounting status (accounting_status)

  • none: Default
  • delivered: Accounting in progress
  • accounted: Accounting completed
  • failed: Accounting failed

Transaction type (transaction_type)

  • income: Income
  • expense: Expense

Accounting type (accounting_type)

  • recharge: Funds added to the account
  • receive: Funds received from another party
  • settle: Settlement with a merchant or third party
  • pay: Expenditure