{"id":4166,"date":"2024-05-01T13:30:23","date_gmt":"2024-05-01T11:30:23","guid":{"rendered":"https:\/\/modulus.help\/kb\/docs\/documentation\/cash-apis-v1\/api-create-transaction\/"},"modified":"2024-12-26T14:48:54","modified_gmt":"2024-12-26T12:48:54","slug":"api-create-transaction","status":"publish","type":"docs","link":"https:\/\/modulus.help\/kb\/docs\/documentation\/cash-apis-v1\/api-create-transaction\/","title":{"rendered":"API: Create Transaction"},"content":{"rendered":"<p>The purpose of this API is to create new transaction.<\/p>\n<h4>Request<\/h4>\n<table style=\"width: auto;\">\n<tbody>\n<tr>\n<th style=\"text-align: left;\">URL<\/th>\n<td>https:\/\/your_account.modulus.biz\/api\/csh\/v1\/Transaction?token=YOUR_TOKEN<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">API Name<\/th>\n<td>Transaction<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">Method<\/th>\n<td>POST<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">Source<\/th>\n<td>Third Party Server<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">Recipient<\/th>\n<td>modulus\u00ae Server<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">Content Type<\/th>\n<td>application\/json<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Query String Parameters<\/h4>\n<table style=\"width: auto;\">\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Required<\/th>\n<th>Type<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th style=\"text-align: left;\">token<\/th>\n<td>Yes<\/td>\n<td>Text<\/td>\n<td>Your authentication token.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Payload Parameters<\/h4>\n<table style=\"width: auto;\">\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Required<\/th>\n<th>Type<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th style=\"text-align: left;\">account_code<\/th>\n<td>Yes<\/td>\n<td>Text<\/td>\n<td>The code of the cash account used in the transaction.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">date<\/th>\n<td>Yes<\/td>\n<td>Date<\/td>\n<td>Date format must be ISO 8601 (Example: \u201c2020-01-10\u201d) and can not be in the future.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">amount<\/th>\n<td>Yes<\/td>\n<td>Decimal<\/td>\n<td>The amount of the the transaction in account currency.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">cash_book_id<\/th>\n<td>Yes<\/td>\n<td>Number<\/td>\n<td>Refers to cash book used for the transaction.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">\n<div>\n<div>transaction_nature<\/div>\n<\/div>\n<\/th>\n<td>Yes<\/td>\n<td>Text<\/td>\n<td>Refers to the transaction nature of the transaction, possible values ( LKP_ENUM_CASH_IN, LKP_ENUM_CASH_OUT)<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">counter_party<\/th>\n<td>Yes<\/td>\n<td>Text<\/td>\n<td>Refers to other party of the transaction.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">related_party<\/th>\n<td>No<\/td>\n<td>Object<\/td>\n<td>Object with the info of counter party provided either customer or supplier. The structure explained here.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">account_exchange_rate<\/th>\n<td>No<\/td>\n<td>Decimal Number<\/td>\n<td>The exchange rate of the account currency when the transaction is created. Mandatory if the account has foreign currency.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">\n<div>\n<div>counter_party_exchange_rate<\/div>\n<\/div>\n<\/th>\n<td>No<\/td>\n<td>Decimal Number<\/td>\n<td>The exchange rate of the pay party currency when the transaction is created. Mandatory if the pay party has foreign currency differs the account currency.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">reference<\/th>\n<td>No<\/td>\n<td>Text<\/td>\n<td>Transaction reference.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">description<\/th>\n<td>No<\/td>\n<td>Text<\/td>\n<td>Transaction description.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u00a0<\/h3>\n<h3>Customer Parameter details<\/h3>\n<table style=\"width: auto;\">\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Required<\/th>\n<th>Type<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th style=\"text-align: left;\">code<\/th>\n<td>Yes<\/td>\n<td>Text<\/td>\n<td>The code of the related party used in the transaction.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">name<\/th>\n<td>Yes<\/td>\n<td>Text<\/td>\n<td>The name of the related party used in the transaction.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">type<\/th>\n<td>Yes<\/td>\n<td>Text<\/td>\n<td>The Type of the related party used in the transaction.<br \/>Possible values are: <strong>individual<\/strong> or <strong>organization<\/strong>.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">tax_registration_number<\/th>\n<td>No<\/td>\n<td>Number<\/td>\n<td>Related party&#8217;s Tax Registration Number.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">account_code<\/th>\n<td>No<\/td>\n<td>Text<\/td>\n<td>The code of the cash account of the related party.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">price_list_code (for counter parties of type customer)<\/th>\n<td>No<\/td>\n<td>Number<\/td>\n<td>The code of the price list of the related party.<br \/>It must have the same currency as the customer and account.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">address<\/th>\n<td>No<\/td>\n<td>Object<\/td>\n<td>The address of the related party. The structure is explained elsewhere.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">contact<\/th>\n<td>No<\/td>\n<td>Object<\/td>\n<td>The contact of the related party. The structure is explained elsewhere.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u00a0<\/h3>\n<h3>Address Parameter details<\/h3>\n<table style=\"width: auto;\">\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Type<\/th>\n<th>Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th style=\"text-align: left;\">label<\/th>\n<td>Text<\/td>\n<td>Yes<\/td>\n<td>The label of the address.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">country_code<\/th>\n<td>Text<\/td>\n<td>Yes<\/td>\n<td>The country code of the address (Example: &#8220;EG&#8221;).<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">city<\/th>\n<td>Text<\/td>\n<td>Yes<\/td>\n<td>The name of the city in the specified country.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">address<\/th>\n<td>Text<\/td>\n<td>No<\/td>\n<td>Additional info of the address.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u00a0<\/h3>\n<h3>Contact Parameter details<\/h3>\n<table style=\"width: auto;\">\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Type<\/th>\n<th>Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th style=\"text-align: left;\">type<\/th>\n<td>Text<\/td>\n<td>Yes<\/td>\n<td>The type of the contact provided. Possible values are: <strong>mobile<\/strong>, <strong>phone<\/strong>, <strong>email<\/strong>, <strong>fax<\/strong>, <strong>website<\/strong>, or <strong>other<\/strong>.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">label<\/th>\n<td>Text<\/td>\n<td>Yes<\/td>\n<td>The label of the contact.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">value<\/th>\n<td>Text<\/td>\n<td>Yes<\/td>\n<td>The value of the contact.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u00a0<\/h3>\n<h4>Responses<\/h4>\n<table style=\"width: auto;\">\n<thead>\n<tr>\n<th>HTTP Status<\/th>\n<th>result<\/th>\n<th>title<\/th>\n<th>message<\/th>\n<th>object<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th colspan=\"5\">Success Responses<\/th>\n<\/tr>\n<tr>\n<td>200 OK<\/td>\n<td>true<\/td>\n<td>Success<\/td>\n<td>Transaction added successfully.<\/td>\n<td>\n<pre><code class=\"json\">{\n    \"transaction_id\": xxx,\n    \"transaction_serial\": \"YYY_ZZZZ\",\n    \"creation_date_time\": \"yyy-mm-dd hh:MM:ss\"\n}<\/code><\/pre>\n<\/td>\n<\/tr>\n<tr>\n<th colspan=\"5\">Failure Responses<\/th>\n<\/tr>\n<tr>\n<td>400 Bad Request<\/td>\n<td>false<\/td>\n<td>Error<\/td>\n<td>Error message as elaborated here.<\/td>\n<td>\n<pre><code class=\"json\">{\n    \"error_code\": xxx\n}<\/code><\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>500 Internal Server Error<\/td>\n<td>false<\/td>\n<td>Error<\/td>\n<td>Error message as elaborated here.<\/td>\n<td>\n<pre><code class=\"json\">{\n    \"error_code\": xxx\n}<\/code><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Example 1<\/h4>\n<table style=\"width: auto;\">\n<tbody>\n<tr>\n<th>Request<\/th>\n<td>\n<pre><code class=\"json\">curl --request POST 'https:\/\/your_account.modulus.biz\/api\/csh\/v1\/Transaction=YOUR_TOKEN' \\\n  --header 'Content-Type: application\/json' \\\n  --data-raw '{\n    \"account_code\": \"1.6.2.5\",\n    \"account_exchange_rate\": 50,\n    \"date\": \"2024-01-01\",\n    \"cash_book_id\": 4,\n    \"amount\": 300,\n    \"transaction_type_code\": \"3\",\n    \"counter_party\": \"Customer\",\n    \"related_party\": {\n      \"code\": \"1\",\n      \"name\": \"Test name\",\n      \"type\": \"individual\",\n      \"account_code\": \"1.6.10.2\",\n      \"price_list_code\": \"1\",\n      \"tax_registration_number\": \"1\",\n      \"contact\": {\n        \"type\": \"mobile\",\n        \"label\": \"\u0627\u0644\u0642\u0627\u0647\u0631\u0629 \u0627\u0644\u062c\u062f\u064a\u062f\u0629\",\n        \"value\": \"0102224791\"\n      },\n      \"address\": {\n        \"label\": \"HEADOFFICE\",\n        \"country_code\": \"EG\",\n        \"city\": \"Alexandria\",\n        \"address\": \"Test Address\"\n      }\n    },\n    \"party_exchange_rate\": 20,\n    \"reference\": \"Test Reference\",\n    \"description\": \"Test Description\"\n  }'<\/code><\/pre>\n<\/td>\n<\/tr>\n<tr>\n<th>200 OK<\/th>\n<td>\n<pre><code class=\"json\">{\n    \"result\": true,\n    \"title\": \"Success\",\n    \"message\": \"Transaction added successfully\",\n    \"object\": {\n      \"transaction_id\": 631,\n      \"transaction_serial\": \"RCT-2024-0055\",\n      \"creation_date_time\": \"2024-05-01 13:48:43\"\n    }\n  }<\/code><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Example 2<\/h4>\n<table style=\"width: auto;\">\n<tbody>\n<tr>\n<th>Request<\/th>\n<td>\n<pre><code class=\"json\">curl --request POST 'https:\/\/your_account.modulus.biz\/api\/csh\/v1\/Transaction=YOUR_TOKEN' \\\n  --header 'Content-Type: application\/json' \\\n  --data-raw '{\n    \"account_code\": \"1.6.4.2\",\n    \"date\": \"2024-9-26\",\n    \"amount\": 1000.00,\n    \"cash_book_id\": 26,\n    \"counter_party\": \"Customer\",\n    \"transaction_type_code\": \"1\",\n    \"reference\": \"Test Reference\",\n    \"description\": \"Test Description\",\n    \"related_party\":{\n        \"code\":\"20\",\n        \"account_code\":\"1.6.10.2\",\n        \"price_list_code\":\"1\",\n        \"name\":\"Test Customer\",\n        \"tax_registration_number\":\"\",\n        \"type\": \"individual\",\n        \"contact\":{\n            \"type\": \"mobile\",\n            \"label\": \"\u0627\u0644\u0642\u0627\u0647\u0631\u0629 \u0627\u0644\u062c\u062f\u064a\u062f\u0629\",\n            \"value\": \"1\"\n        },\n        \"address\": {\n            \"label\": \"HEADOFFICE\",\n            \"country_code\": \"EG\", \n            \"city\": \"Alexandria\", \n            \"address\": \"Test Address\"\n        }\n    }\n  }'<\/code><\/pre>\n<\/td>\n<\/tr>\n<tr>\n<th>400 Bad Request<\/th>\n<td>\n<pre><code class=\"json\">{\n    \"result\": false,\n    \"title\": \"Error\",\n    \"message\": \"Invalid Currency\",\n    \"object\": {\n      \"error_code\": \"5609\"\n    }\n  }<\/code><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n\n<p><\/p>\n","protected":false},"featured_media":0,"parent":4165,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"comment_count":0,"_links":{"self":[{"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/docs\/4166"}],"collection":[{"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/comments?post=4166"}],"version-history":[{"count":17,"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/docs\/4166\/revisions"}],"predecessor-version":[{"id":4352,"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/docs\/4166\/revisions\/4352"}],"up":[{"embeddable":true,"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/docs\/4165"}],"next":[{"title":"API: Update Transaction","link":"https:\/\/modulus.help\/kb\/docs\/documentation\/cash-apis-v1\/api-update-transaction\/","href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/docs\/4340"}],"wp:attachment":[{"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/media?parent=4166"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/doc_tag?post=4166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}