# How to force operation You can force a credit or a debit operation for a specified account, and the Pismo platform guarantees idempotence and integrity of this operation. A forced operation uses a `processing_code`, generates a new authorization, and directly impacts the account balance. However, it does not include any of the validations that are performed in the [Transfer funds](https://developers.pismo.io/pismo-docs/reference/post-payments-v1-payments) endpoint, such as validating the account status, account balance, or flexible transaction controls. You can choose to include or exclude a forced operation from the account timeline. The [Force operation](https://developers.pismo.io/pismo-docs/reference/post-payments-v1-force) API is recommended for all new implementations that need to force some anticipated operations, such as cashback credits or transaction fees. For differences between a forced operation and an adjustment, see the [comparison table](https://developers.pismo.io/pismo-docs/docs/force-operation#forced-operation-vs-adjustment) in this guide. # Force operation To force an operation, use the [Force operation](https://developers.pismo.io/pismo-docs/reference/post-payments-v1-force) endpoint and provide the required `account_id`, `processing_code`, and `amount`. In the request header, you can provide a value for the `x-skip-timeline` parameter. If set to `true`, this prevents the generation of timeline events in the customer timeline. ```json POST payments/v1/payments/force ``` ## Forced credit example In the following example, the `processing_code` `090907` defines a credit type. The following payload executes a forced credit operation. ```json Forced credit example - request { "tracking_id": "ba7f42b9-9bd1-4840-a747-f1b59037b798", "account_id": 1234, "amount": 40.25, "processing_code": "090907", "currency": "USD", "descriptor": "Forced single credit operation ", "metadata": { "any-key": "any-value" } } ``` ### Sample request details | Field | Type | Optional or required | Description | | :---------------- | :----------- | :------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | | `tracking_id` | string | optional | The unique 36-character identifier of the forced operation. If you don't provide an identifier, the Pismo platform generates one for you. | | `account_id` | integer | required | The unique identifier of an account in the Pismo platform. | | `amount` | float number | required | The credit or debit amount. | | `processing_code` | string | required | The 6-character processing code that identifies the credit or debit operation. | | `currency` | string | optional | Currency code of the requested operation, in ISO 4217. | | `descriptor` | string | optional | The description of the created operation. | | `metadata` | object | optional | Any valid JSON key-value object that allows you to add complementary custom information. | ### Sample response details If the operation is successful (status code `201`), the response returns the following three parameters. ```json Forced credit example - response { "authorization_id": 31812823, "tracking_id": "ba7f42b9-9bd1-4840-a747-f1b59037b798", "event_date": "2022-02-02T14:05:51.688" } ``` | Field | Type | Description | | :----------------- | :------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `authorization_id` | integer | The generated identifier for the authorization. | | `tracking_id` | string | The unique 36-character identifier for the forced operation. If you didn't provide an identifier, then the Pismo platform automatically generates and includes one in the response. | | `event_date` | string | The date and time of the transaction, in the UTC-0 (RFC3339) format. | If the operation is accepted but there is a delay in processing (status code `202`), the response shows the corresponding `code` and the `message`. The request will process and finish asynchronously. If the operation fails (status codes `400`, `500`), the response returns the `code` and the corresponding `message` that describes the error. If a tracking ID is already in use (status code `409`), in addition to the `code` and the `message`, the response also returns the related `authorizations` object. # Cancel forced operation To cancel a forced operation, use the [Cancel forced operation](https://developers.pismo.io/pismo-docs/reference/post-payments-v1-force-cancel) endpoint. This endpoint allows you to cancel the total or partial amount of an existing forced operation. ```json POST payments/v1/payments/force/cancel ``` In the request header, you can provide a value for the `x-skip-timeline` parameter. If set to `true`, this prevents generation of timeline events in the customer timeline. In the request body, provide one of the following required identifiers of the original forced operation: * `authorization_id`, the authorization ID which was returned in the forced operation response (`v1/payments/force`) as `authorization_id`. * `original_tracking_id`, the tracking ID which was returned in the forced operation response (`v1/payments/force`) as `tracking_id`. By default, the request to this endpoint cancels the full amount of the original forced operation. Optionally, you can provide the partial amount to cancel in the `amount` field. This value should be less than or equal to the amount of the original operation, and greater than 0. By default, whenever a total or a partial cancellation of an operation with a fee occurs , the platform doesn't cancel this fee automatically (the `cancel_fees` field is set to `false`). To cancel the associated fee, set the `cancel_fees` field to `true`. You can also optionally provide the `tracking_id`, `descriptor`, and any `metadata` in the request. ## Cancel forced operation examples The following example request cancels the full amount of the forced credit operation from the previous example. ```json Cancel forced credit example - request { "authorization_id": 31812823, "tracking_id": "1ff51e99-3a05-448a-bc19-7b5c05274174", "original_tracking_id": "ba7f42b9-9bd1-4840-a747-f1b59037b798", "descriptor": "Cancel forced single credit operation", "metadata": { "my-custom-key": "my-custom-value" } } ``` The following example request cancels the partial amount of the forced credit operation and any associated fees. ```json Cancel forced credit example - request { "authorization_id": 31812823, "tracking_id": "1ff51e99-3a05-448a-bc19-7b5c05274174", "original_tracking_id": "ba7f42b9-9bd1-4840-a747-f1b59037b798", "amount": 20.00, "cancel_fees": true, "descriptor": "Cancel forced single credit operation", "metadata": { "my-custom-key": "my-custom-value" } } ``` ### Response details If the cancel forced operation is successful (status code `200`), the response returns `authorization_id`, `tracking_id`, and `event_date` of the cancellation. If the operation is accepted but there is a delay in processing (status code `202`), the response shows the corresponding `code` and the `message`. The request will process and finish asynchronously. If the operation fails (status codes `400`, `404`, `500`), the response returns the `code` and the corresponding `message` that describes the error. If a tracking ID is already in use (status code `409`) and the operation has been canceled already, the response returns the `authorization_id`,`tracking_id`, and `event_date` of the previously generated cancellation operation. # Related pages [API reference / Force operation](https://developers.pismo.io/pismo-docs/reference/post-payments-v1-force)\ [API reference / Cancel forced operation](https://developers.pismo.io/pismo-docs/reference/post-payments-v1-force-cancel)\ [Guides / Payments and transfers](https://developers.pismo.io/pismo-docs/docs/payments)