DPA Flow API
This API allows managing Deferred Payment Agreement (DPA) flows in the system. It provides endpoints to create, read, update, and manage DPA flows, as well as to perform simulations and specific operations such as approval, cancellation, and closure of flows.
The CMS Base URL is used (see introduction).
The Flow Object
The Flow object represents a Deferred Payment Agreement (DPA) flow in the system. This flow describes the financing request, the agreed terms, and the payment plan associated with a specific transaction.
Attributes
| Attribute | Description | Type |
|---|---|---|
flowId | Unique identifier of the DPA flow | String (UUID) |
tenant | Tenant identifier in the system | String |
client | Information about the client associated with the flow | Object |
referenceId | External reference identifier (e.g., purchase order) | String |
terms | Terms of the deferred payment agreement | Object |
schedule | Payment plan of the agreement | Array of Object |
status | Current status of the flow | String |
createdAt | Date and time of flow creation | String (ISO 8601) |
updatedAt | Date and time of the last flow update | String (ISO 8601) |
Detail of nested objects
client Object
| Attribute | Description | Type |
|---|---|---|
clientId | Unique identifier of the client | String (UUID) |
externalId | External identifier of the client | String |
legalName | Legal name of the client | String |
partnerId | Identifier of the partner associated with the client | String (UUID) |
terms Object
| Attribute | Description | Type |
|---|---|---|
principal | Principal amount of the agreement | Object |
repayEvery | Payment frequency in days | Integer |
interestRate | Applied interest rate | Object |
installments | Number of installments | Integer |
amortizationType | Type of amortization | String |
disbursementDate | Disbursement date | String (YYYY-MM-DD) |
interestTax | Interest tax percentage | Number |
timezone | Applicable timezone | String |
calendarType | Calendar type for date calculations | String ("Custom", "BusinessDays", "NaturalDays") |
loanTermDuration | Total loan duration in days | Integer |
schedule Object (Array)
Each element of the schedule array represents an installment and contains:
| Attribute | Description | Type |
|---|---|---|
number | Installment number | Integer |
dueDate | Installment due date | String (YYYY-MM-DD) |
originalAmounts | Original amounts of the installment | Object |
The originalAmounts object contains the following fields, each with amount and currency:
principal: Capital amountinterest: Interest amountfees: Fees amounttaxes: Taxes amounttotal: Total installment amount
Possible statuses (status)
pending: The flow is pending confirmationapproved: The flow has been approved and is ready to generate debtspartially-confirmed: The flow is confirmed and at least one debt has been createdconfirmed: The flow is confirmed and all debts have been createdrejected: The flow has been rejected and no debts were createdclosed: The flow has been closed without creating debtscanceled: The flow has been canceled
Available Operations
List DPA Flows
Retrieves a paginated list of DPA flows with filtering and sorting options.
Query Parameters:
| Parameter | Description | Type |
|---|---|---|
client-id | Specific client IDs | Array |
external-id | Client's external identifier | String |
status | Filter by flow status | Array |
expired-from | Start date for expired flows | String |
expired-to | End date for expired flows | String |
sort-by | Field to sort by | String |
page | Page number | Integer |
per-page | Items per page | Integer |
sort-direction | Sorting direction (asc or desc) | String |
Successful Response:
The response will be a paginated list of Flow objects.
Simulate a DPA Flow
This operation allows performing a simulation of a Deferred Payment Agreement (DPA) for a specific client.
Request Body with productId
Request Body with terms
Input Parameters
| Parameter | Description | Type | Required |
|---|---|---|---|
amount | Agreement amount | Object | Yes |
amount.amount | Amount value | String | Yes |
amount.currency | Amount currency | String | Yes |
clientId | Client ID in the system | String (UUID) | No* |
externalId | Client's external ID in the partner's system | String | No* |
disbursementDate | Proposed disbursement date | String (YYYY-MM-DD) | No |
productId | Credit product ID to use | String (UUID) | No* |
terms | Proposed terms for the agreement | Object | No* |
terms.amortizationType | Amortization type ("equal_total" or French amortization) | String | Yes |
terms.installments | Number of installments | Integer | No |
terms.repayEvery | Payment frequency in days | Integer | No |
terms.interestRate | Interest rate configuration | Object | No |
terms.interestRate.rate | Interest rate value | String | No |
terms.interestRate.period | Interest rate period in days | Integer | No |
terms.interestTax | Interest tax rate | Number | No |
terms.interestCalculateType | Interest calculation type. Defines how and when interests are calculated and applied. (default: period) | String | No |
Detail of term.interestCalculateType:
Possible values:
period: Interests are calculated and applied once at the beginning of the debt for the entire period. The total interest amount is determined at the start and distributed in the installments.lifetime: Interests are calculated and applied continuously throughout the debt's lifetime. The calculation is done periodically (e.g., daily) on the outstanding balance.
Additional explanation:
- With
period, the borrower knows from the start the total interest amount they will pay, regardless of early payments. - With
lifetime, the interest amount may vary if early payments are made, as it is recalculated on the outstanding balance. This interest calculation type is only supported for single-installment debts.
Notes:
- Either
clientIdorexternalIdmust be provided, but not both. - Either
productIdortermsmust be provided, but not both. - If terms are not provided, the configured product values will be used.
Successful Response
The response includes a simulated Flow object.
Specific Errors
| Error Code | Description |
|---|---|
| 400 | Invalid request. This can occur if required parameters are missing or if the provided values are not valid. |
| 404 | Client not found. This occurs if the provided clientId or externalId does not correspond to any client in the system. |
| 409 | Conflict. This can occur if the proposed terms are not compatible with the product's configuration or segmentations see DPA Products. |
In case of an error, the response will include details about the nature of the problem to assist in resolution.
Simulate an Advanced DPA Flow
Performs an advanced simulation of a DPA flow. This simulation returns an array of simulated Flow objects and corresponds to the simulation of a DPA flow with all applicable products, see DPA Products and see DPA Product Segmentations.
Input Parameters:
| Parameter | Description | Type | Required |
|---|---|---|---|
amount | Agreement amount | Object | Yes |
clientId | Client ID | String | No |
externalId | Client's external ID | String | No |
disbursementDate | Disbursement date | String | No |
metadata* | Additional metadata used to evaluate segmentation rules | Object | No |
- Note: The
keyof the metadata must match thekeyof the segmentation rules. If there is overlap between akeyof the metadata and a value obtained from the client'sborrower fields, the value of theborrower fieldwill prevail.
Successful Response:
The response will be an array of simulated Flow objects (the flowId cannot be GET).
Initiate a DPA Flow
Initiates a new Deferred Payment Agreement flow with a product ID.
Request Body
Input Parameters
| Parameter | Description | Type | Required |
|---|---|---|---|
amount | Agreement amount | Object | Yes |
amount.amount | Amount value | String | Yes |
amount.currency | Amount currency | String | Yes |
clientId | Client ID in the system | String (UUID) | No* |
externalId | Client's external ID in the partner's system | String | No* |
disbursementDate | Proposed disbursement date | String (YYYY-MM-DD) | No |
productId | Credit product ID to use | String (UUID) | No* |
terms | Proposed terms for the agreement | Object | No** |
terms.amortizationType | Type of amortization | String ("flat" or "equal_total") | No |
terms.installments | Number of installments | Integer | No |
terms.repayEvery | Payment frequency in days | Integer | No |
terms.interestRate | Interest rate configuration | Object | No |
terms.interestRate.rate | Interest rate value | String | No |
terms.interestRate.period | Interest rate period in days | Integer | No |
terms.interestTax | Interest tax rate | Number | No |
terms.interestCalculateType | Interest calculation type | String ("period" or "lifetime") | No |
- Note: Either
clientIdorexternalIdmust be provided, but not both. - Note: Either
productIdortermsmust be provided, but not both. - Note: If terms are not provided, the configured product values will be used.
Successful Response
The response includes a Flow object.
Specific Errors
| Error Code | Description |
|---|---|
| 400 | Invalid request. This can occur if required parameters are missing or if the provided values are not valid. |
| 404 | Client not found. This occurs if the provided clientId or externalId does not correspond to any client in the system. |
| 409 | Conflict. This can occur if the proposed terms are not compatible with the product's configuration or segmentations see DPA Products. |
In case of an error, the response will include details about the nature of the problem to assist in resolution.
Get a DPA Flow
Retrieves information about a specific DPA flow.
Path Parameters:
| Parameter | Description |
|---|---|
flow_id | ID of the DPA flow to retrieve |
Successful Response:
The response will be a Flow object.
Approve a DPA Flow
Approves a DPA flow. After approval, the credit line is reserved for the final amount. Re-approving is allowed while no debt is yet confirmed — the reservation adjusts to the new amount/date.
Path Parameters:
| Parameter | Description |
|---|---|
flow_id | ID of the DPA flow to approve |
Input Parameters:
| Parameter | Description | Type | Required |
|---|---|---|---|
amount | Final approved amount | Object (Money) | Yes |
disbursementDate | Disbursement date | String (YYYY-MM-DD) | Yes |
externalId | Client's external ID (or use clientId) | String | No* |
clientId | Client ID (or use externalId) | String (UUID) | No* |
referenceId | External reference (e.g., purchase order) | String | No |
- Either
clientIdorexternalIdmust be provided, but not both.
Example Request:
Successful Response:
The response will be an updated Flow object. Note: the returned status is often approval-started while the credit-line reservation settles asynchronously. Poll GET /v1/dpas/:flow_id to see it transition to approved.
Cancel a DPA Flow
Cancels a DPA flow.
Path Parameters:
| Parameter | Description |
|---|---|
flow_id | ID of the DPA flow to cancel |
Input Parameters:
| Parameter | Description | Type | Required |
|---|---|---|---|
reason | Reason for cancellation | String | No |
Successful Response:
The response will be an updated Flow object.
Close a DPA Flow
Closes a DPA flow, indicating that no more invoices will be added.
Path Parameters:
| Parameter | Description |
|---|---|
flow_id | ID of the DPA flow to close |
Successful Response:
The response will be an updated Flow object.
The Invoice Object
The Invoice object represents an invoice associated with a DPA flow in the system.
Attributes
| Attribute | Description | Type |
|---|---|---|
referenceId | Unique identifier of the invoice | String |
invoiceDate | Invoice issue date | String (ISO 8601) |
amount | Total invoice amount | Object |
subTotalAmount | Invoice subtotal amount (optional) | Object |
installments | Invoice payment plan | Array of Object |
notes | Additional notes about the invoice (optional) | String |
debtId | Identifier of the associated debt (optional) | String |
Installment Object
| Attribute | Description | Type |
|---|---|---|
amount | Installment amount | Object |
interest | Installment interest amount | Object |
tax | Installment tax amount | Object |
dueDate | Installment due date | String (ISO 8601) |
Add Invoice to a DPA Flow
Adds an invoice to a DPA flow and confirms it.
Path Parameters:
| Parameter | Description |
|---|---|
flow_id | ID of the DPA flow |
Input Parameters:
| Parameter | Description | Type | Required |
|---|---|---|---|
referenceId | Invoice reference ID | String | Yes |
invoiceDate | Invoice date | String | Yes |
amount | Total invoice amount | Object | Yes |
subTotalAmount | Invoice subtotal amount | Object | No |
installments | Invoice payment plan | Array | No |
notes | Additional notes | String | No |
Example Request:
Successful Response:
The response will be a created Invoice object, including the generated debtId.
Get Invoices Associated with a DPA Flow
Retrieves the list of invoices associated with a specific DPA flow.
Path Parameters:
| Parameter | Description |
|---|---|
flow_id | ID of the DPA flow |
Successful Response:
The response will be a list of Invoice objects related to the DPA flow.
Reopen a Canceled DPA Flow
Reopens a DPA flow that has been canceled due to expiration.
Path Parameters:
| Parameter | Description |
|---|---|
flow_id | ID of the DPA flow to reopen |
Input Parameters:
| Parameter | Description | Type | Required |
|---|---|---|---|
expirationAt | New expiration date | String | Yes |
reason | Reason for reopening the flow | String | Yes |
Example Request:
Successful Response:
The response will be an updated Flow object.
The Flow Event Object
The Flow Event object represents an event that occurs in relation to a DPA flow in the system.
Attributes
| Attribute | Description | Type |
|---|---|---|
type | Event type | String |
timestamp | Date and time the event occurred | String (ISO 8601) |
aggregateType | Type of aggregate the event belongs to | String |
aggregateId | Unique identifier of the aggregate | String |
data | Specific event data | Object |
metadata | Additional event metadata | Object |
Get Events of a DPA Flow
Retrieves the list of events associated with a specific DPA flow.
Path Parameters:
| Parameter | Description |
|---|---|
flow_id | ID of the DPA flow |
Successful Response:
The response will be a list of Event objects related to the DPA flow.
Example Response:
This response provides a history of events related to the DPA flow, allowing tracking of changes and actions performed on the flow over time.
Error Handling
The API may return the following error codes:
| Code | Description |
|---|---|
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 409 | Conflict |
| 500 | Internal Server Error |
Errors will include a descriptive message in the response body.