# How to create accounting script Accounting scripts tell the Pismo platform the details of an accounting entry and how it’s generated. For example, when a certain amount of money is credited to an account or a purchase is confirmed, the platform knows it's necessary to produce an accounting entry. ## Create a script To create an accounting script, use these fields in [Create an accounting script](https://developers.pismo.io/pismo-docs/reference/createaccountingscript). | Parameter | Description | | :-------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | program\_id | The ID of [the program from your org](https://developers.pismo.io/pismo-docs/docs/setup-overview#program-setup). | | [event\_type\_id](https://developers.pismo.io/pismo-docs/reference/geteventtypebyid) | The ID of the accounting event type. | | [entry\_type\_id](https://developers.pismo.io/pismo-docs/reference/getentrytypebyid) | The ID of the entry type the platform generates by the accounting script. | | entry\_name | The name of the accounting entry. | | debit\_accounting\_account\_id | The ID of the debit accounting account. | | credit\_accounting\_account\_id | The ID of the credit accounting account. | | cost\_center | The object with details about [the cost center](https://developers.pismo.io/pismo-docs/docs/accounting-overview#cost-centers) in your organization. Only create a cost center object if your organization requires it. If you need to create one, see [Cost center object parameters](https://developers.pismo.io/pismo-docs/docs/create-an-accounting-script#cost-center-object-parameters). | | processing\_code | The ISO transaction processing code. | > 📘 > > If you don’t need to create a cost center object, then enter 0 in the required fields. ## Cost center object parameters You can include cost centers in the [accounting script](https://developers.pismo.io/pismo-docs/reference/createaccountingscript) to improve its management. This is helpful when you need to create an accounting script for revenue and another for expense. To include cost centers, use these parameters. | Parameter | Description | | :--------------------------------------- | :------------------------------------------------------------------------------------------------------------ | | program\_id | The ID number of [the program from your org](https://developers.pismo.io/pismo-docs/reference/setup-overview#program-setup). | | [event\_type\_id](https://developers.pismo.io/pismo-docs/reference/geteventtypebyid) | The ID number of the accounting event type. | | [entry\_type\_id ](https://developers.pismo.io/pismo-docs/reference/getentrytypebyid) | The ID of the entry type. This entry type comes from the accounting script. | | debit\_org | Your org’s debit accounting account. | | credit\_org | Your org’s credit accounting account. | | debit\_cost | The cost center’s debit accounting account. | | credit\_cost | The cost center’s credit accounting account. | | deactivated\_at | The deactivation date of the cost center. Only use this field if your org’s cost center has been deactivated. | ### Example This response shows a created accounting script with cost centers. ```json { "id": 812046, "program_id": 1, "event_type_id": 101, "entry_type_id": 101, "entry_name": "interest", "debit_accounting": { "id": 1, "description": "ACCOUNTING ACCOUNT CREATION TEST", "cosif": "161200000006", "account": "123123132-x", "program_id": 0, "created_at": "2021-07-22T00:37:20Z", "deactivated_at": null }, "credit_accounting": { "id": 1, "description": "ACCOUNTING ACCOUNT CREATION TEST", "cosif": "161200000006", "account": "123123132-x", "program_id": 0, "created_at": "2021-07-22T00:37:20Z", "deactivated_at": null }, "cost_center": { "debit_org": "TN-ORG1", "credit_org": "TN-ORG2", "debit_cost": "C1", "credit_cost": "C2", "deactivated_at": null }, "processing_code": "00", "deactivated_at": null } ``` ## Search for script To search for an accounting script: 1. Use [Get accounting script](https://developers.pismo.io/pismo-docs/reference/getaccountingscriptbyid). 2. Enter the accounting script’s ID in the **accountingScriptId** field. To get this ID, use the `id` from an existing accounting script. ## Example This response shows a searched accounting script with cost centers. ```json { "id": 54542, "program_id": 499, "event_type_id": 121, "entry_type_id": 2212, "entry_name": "interest", "debit_accounting": { "id": 54645, "description": "INSTALLMENT PURCHASE ISSUER - STOCK - CHARGES", "cosif": "161200000008", "account": "1320003002002", "program_id": 62, "created_at": "2018-12-21T10:44:05Z", "deactivated_at": null }, "credit_accounting": { "id": 54646, "description": "(-) PURCHASE IN INSTALLMENTS ISSUER - STOCK - CHARGES", "cosif": "161200000011", "account": "1320003002003", "program_id": 62, "created_at": "2018-12-21T10:44:05Z", "deactivated_at": null }, "cost_center": { "debit_org": "487892", "credit_org": "487892", "debit_cost": "487892", "credit_cost": "487892", "deactivated_at": null }, "processing_code": "", "deactivated_at": null } ``` ## Deactivate a script To deactivate an accounting script: 1. Use [Deactivate accounting script](https://developers.pismo.io/pismo-docs/reference/deactivateaccountingscript). 2. Enter the accounting script’s ID in the **accountingScriptId** field. To get this ID, use the `id` from the accounting script you want to deactivate. ## Example This response shows a deactivated accounting script with cost centers. ```json { "id": 0, "program_id": 0, "event_type_id": 0, "entry_type_id": 0, "entry_name": "string", "debit_accounting": { "id": 1, "description": "SAMPLE ACCOUNT", "cosif": "161200000006", "account": "123123132-x", "program_id": 12, "created_at": "2021-10-10T10:10:00.000Z", "deactivated_at": "2021-10-10T10:10:00.000Z" }, "credit_accounting": { "id": 1, "description": "SAMPLE ACCOUNT", "cosif": "161200000006", "account": "123123132-x", "program_id": 12, "created_at": "2021-10-10T10:10:00.000Z", "deactivated_at": "2021-10-10T10:10:00.000Z" }, "cost_center": { "debit_org": "999999", "credit_org": "999999", "debit_cost": "999999", "credit_cost": "999999", "deactivated_at": "2021-10-10T10:10:00.000Z" }, "processing_code": "string", "deactivated_at": "2022-06-14T21:05:46.365Z" } ```