Overview

The PayableDetails component renders the interface for creating, uploading, editing, and transitioning a payable. It also displays a copy of the uploaded payable alongside details of a payable, allowing a user to edit these details.

Permissions

To view details of an existing payable, the entity user must have read permissions for the payable object. To create, edit, and delete payables, they must also have create, update, or delete permissions for the payable object. For more information, see List of permissions.

Preview

PayableDetails component preview
PayableDetails component preview

Usage

Use the PayableDetails component to create new payables and view and edit details of an existing payable. To view details of an existing payable, use the PayableDetails component with the id prop as shown:

1import { Dialog, PayableDetails } from "@monite/sdk-react";
2
3// This component must be rendered within the MoniteProvider wrapper
4const PayableDetailsPage = () => {
5 return (
6 <Dialog open fullScreen>
7 <PayableDetails id="PAYABLE_ID" />
8 </Dialog>
9 );
10};

To create a new payable, import the PayableDetails component without providing the id prop as shown:

1import { PayableDetails } from "@monite/sdk-react";
2
3// This component must be rendered within the MoniteProvider wrapper
4const PayableDetailsPage = () => {
5 return <PayableDetails />;
6};

Props

PropTypeDescription
idstringThis prop accepts the UUID of the payable details to be displayed or updated. This prop is not required for the creation of new payables.
onApprovedfunctionThis callback is triggered after a payable is approved by an entity user.
onCanceledfunctionThis callback is triggered after a payable is canceled. It contains one string argument representing the payable UUID.
onClosefunctionThis callback is triggered when the modal form is closed.
onPayfunctionThis callback is triggered after a payable is paid.
onRejectedfunctionThis callback is triggered after a payable is rejected by an approver.
onSavedfunctionThis callback is triggered after the “Save” button is clicked.
onSubmittedfunctionThis callback is triggered after a payable is submitted for approval.
ocr_requiredFieldsobjectThis object is used to set the required fields that are necessary for OCR, e.g. ocrRequiredFields : {invoiceNumber : true}. The fields that were not filled in the OCR scan are marked with a red asterisk.

Customize mandatory fields

You can set the fields counterpart_id, counterpart_bank_account_id, issued_at, and currency as mandatory, in addition to the required fields, for the payable creation. To do this, call PUT /payables/validations:

1curl -X PUT 'https://api.sandbox.monite.com/v1/payables/validations' \
2 -H 'X-Monite-Version: 2024-01-31' \
3 -H 'Authorization: Bearer ACCESS_TOKEN'
4 -d '{
5 "required_fields": [
6 "currency",
7 "issued_at"
8 ]
9 }'

The component will mark the selected mandatory fields with a red asterix and validate them.