Skip to main content

Create Transaction

Use this endpoint to create a transaction. This endpoint accepts the optional MX-SKIP-WEBHOOK header.

It is recommended that partners only send dates in one format, using either the _on or _at fields, but not both.

POST
/users/{user_id}/members/{member_id}/accounts/{account_id}/transactions

Path Parameters

FieldRequiredType

user_id

Required
String

member_id

Required
String

account_id

Required
String

Request Body

FieldRequiredType

amount

Required
Decimal

category_guid

Optional
String

category

Optional
String

check_image

Optional
String

check_number

Optional
String

currency_code

Optional
String

description

Required
String

id

Required
String

is_international

Optional
String

latitude

Optional
String

localized_description

Optional
String

localized_memo

Optional
String

longitude

Optional
String

memo

Optional
String

merchant_category_code

Optional
String

metadata

Optional
String

posted_at

One of either posted_at or posted_on is required.

Required
String

posted_on

One of either posted_at or posted_on is required.

Required
String

status

Required
String

transacted_at

One of either transacted_at or transacted_on is required.

Required
String

transacted_on

One of either transacted_at or transacted_on is required.

Required
String

type

Required
String

Request sample

Language:

_72
import java.io.BufferedReader;
_72
import java.io.InputStreamReader;
_72
import java.io.OutputStream;
_72
import java.net.URL;
_72
import javax.net.ssl.HttpsURLConnection;
_72
import org.json.JSONObject;
_72
_72
public class MDX_RealTime {
_72
private String BaseUrl, ClientId, ApiKey;
_72
_72
public MDX_RealTime(String BaseUrl, String ClientId, String ApiKey) {
_72
this.BaseUrl = BaseUrl;
_72
this.ClientId = ClientId;
_72
this.ApiKey = ApiKey;
_72
}
_72
_72
public static void main(String[] args) throws Exception {
_72
String base_url = "https://int-live.moneydesktop.com";
_72
String client_id = ":client_id";
_72
String api_key = ":api_key";
_72
_72
MDX_RealTime mdx = new MDX_RealTime(base_url, client_id, api_key);
_72
_72
/// Setup Account Create json object
_72
String user_id = "U-39XBF7";
_72
String member_id = "M-39XBF7";
_72
String account_id = "A-XA5Y4L";
_72
String transaction_id = "T-3QP5X0";
_72
JSONObject transaction = new JSONObject();
_72
JSONObject fields = new JSONObject();
_72
fields.put("id", "T-3QP5X0");
_72
fields.put("amount", 8.20);
_72
fields.put("description", "COSTCO GAS STATION #22299");
_72
fields.put("status", "PENDING");
_72
fields.put("type", "DEBIT");
_72
fields.put("transacted_on", "2017-01-20");
_72
transaction.put("transaction", fields);
_72
_72
mdx.CreateTransaction(user_id, member_id, account_id, transaction);
_72
}
_72
_72
public void CreateTransaction(String user_id, String member_id, String account_id, JSONObject transaction) {
_72
try {
_72
String uri = BaseUrl + "/" + ClientId + "/users/" + user_id + "/members/" + member_id + "/accounts/" + account_id + "/transactions.json";
_72
URL url = new URL(uri);
_72
_72
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
_72
con.setRequestMethod("POST");
_72
con.setRequestProperty("Accept", "application/vnd.moneydesktop.mdx.v5+json");
_72
con.setRequestProperty("Content-Type", "application/vnd.moneydesktop.mdx.v5+json");
_72
con.setRequestProperty("MD-API-KEY", ApiKey);
_72
con.setDoOutput(true);
_72
_72
OutputStream out = con.getOutputStream();
_72
out.write(transaction.toString().getBytes("UTF-8"));
_72
out.close();
_72
_72
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
_72
String inputLine;
_72
StringBuffer response = new StringBuffer();
_72
while ((inputLine = in.readLine()) != null) {
_72
response.append(inputLine);
_72
}
_72
in.close();
_72
con.disconnect();
_72
_72
System.out.println(response.toString());
_72
} catch (Exception e) {
_72
System.out.println(e);
_72
}
_72
}
_72
}

Response sample

200
Language:json

_37
{
_37
"transaction": {
_37
"account_guid": "ACT-a341b026-635c-8318-002c-9f3a58b0eff8",
_37
"account_id": "A-XZ5Y4L",
_37
"amount": 8.2,
_37
"category": "GAS",
_37
"category_guid": "CAT-7829f71c-2e8c-afa5-2f55-fa3634b89874",
_37
"category_name": "Gas",
_37
"check_image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
_37
"check_number": "9543",
_37
"currency_code": null,
_37
"description": "Costco (Gas)",
_37
"guid": "TRN-cd2987fe-9afb-e912-a5e3-2eaabb866e43",
_37
"id": "T-3QP5X0",
_37
"is_international": false,
_37
"latitude": "40.429675",
_37
"localized_description": null,
_37
"localized_memo": null,
_37
"longitude": "-111.891982",
_37
"member_guid": "MBR-3e4f6897-06ae-e08a-29b2-27d62e574978",
_37
"member_id": "M-39XBF7",
_37
"memo": "POS Purchase",
_37
"merchant_category_code": null,
_37
"merchant_guid": "MCH-bcd4eed1-f341-b7bb-4cbd-e2a854205306",
_37
"merchant_location_guid": null,
_37
"metadata": null,
_37
"posted_at": 1382961600,
_37
"posted_on": "2013-10-28",
_37
"running_balance": 345.45,
_37
"status": "POSTED",
_37
"transacted_at": 1382961600,
_37
"transacted_on": "2013-10-28",
_37
"type": "DEBIT",
_37
"user_guid": "USR-fe9bb059-67c4-0e6b-e8cd-3fa00b2b5735",
_37
"user_id": "U-39XBF7"
_37
}
_37
}