Skip to main content

Order Interface - Myanmar

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 Yes Transaction type One of: income / expense
amount string Yes Transaction amount "100.00"
merchant_order_id string Yes Merchant’s order ID Merchant-generated unique order ID
merchant_uid string Yes Merchant UID Obtain from administrator
currency string Yes Transaction currency mmk
payment string Yes Payment method myanmar
redirect_url string No Redirect URL after transaction completion "https://example.com/redirect"
notify_url string No Server notification URL "https://example.com/notify"
response_type string Yes Response type. Currently only supports "json"; empty means 302 redirect  
country string Yes Country code myanmar
accounting_type string No Accounting type recharge / receive / pay / settle
from string No Payer account (income verification) "6660006666789"
from_name string No Payer name (income verification) "John Doe"
from_bank_name string NoYes Payer bank name (income verification)

kbzwavepay

income This parameter is required.
Please do not enter the wrong bank name.

to string No Payee account (expenditure verification) "6660006666987"
to_name string No Payee name (expenditure verification) "Jane Doe"
to_bank_name string Yes Payee bank name (expenditure verification) kbzwavepay expense This parameter is required. Please do not enter the wrong bank name

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 account number
  • from_name: Sender account name
  • from_bank_name: Sender bank name
  • to: Recipient account number
  • to_name: Recipient account name
  • to_bank_name: Recipient bank name
  • payment_status: Payment status
  • payment_fail_reason: Reason for payment failure
  • final_amount: Final transaction amount
  • currency: Currency used
  • transaction_type: Transaction type (income/expense)
  • payment_uid: Unique payment identifier
  • channel: Transaction channel

Success example:

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
  • 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