> ## Documentation Index
> Fetch the complete documentation index at: https://docs.layerfi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete a Payment

> Deleting a payment should be used when a payment was improperly created.

This functionality is for use in case of erroneous payment creation.
Prefer updating existing payments if the payment details have changed.

### Path Parameters

<ParamField path="business_id" type="string">
  Id of the [Business](/api-reference/business/business) the payment is associated with.
</ParamField>

<ParamField path="payment_id" required="true" type="string">
  Id of the [Payment](/api-reference/invoice/payments) to be deleted.
</ParamField>

### Response

Returns the updated [Payment Object](/api-reference/invoice/payments)

<RequestExample>
  ```bash Request theme={null}
  curl -X POST https://sandbox.layerfi.com/v1/businesses/{business_id}/payments/${payment_id}/delete \
    -H "Authorization: Bearer <access_token>" \
    -H "Content-Type: application/json" \
  ```
</RequestExample>

<ResponseExample>
  The API will respond with the previous state of the now deleted payment.

  ```json Response theme={null}
  {
    "data": {
      "type": "Payment",
      "id": "e67c216b-28f4-4a0e-9a21-7f05c19e4c66",
      "external_id": "payment-1",
      "at": "2024-02-27T02:16:40.369432Z",
      "method": "CREDIT_CARD",
      "fee": 20,
      "amount": 90,
      "processor": "STRIPE",
      "imported_at": "2024-02-27T02:16:40.389772Z",
      "allocations": [
        {
          "invoice_id": "57f0fada-bb56-4f3e-9afa-2a222b68009e",
          "payment_id": "e67c216b-28f4-4a0e-9a21-7f05c19e4c66",
          "amount": 90,
          "transaction_tags": [
            {
              "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
              "key": "department",
              "value": "sales",
              "dimension_display_name": "Department",
              "value_display_name": "Sales Team",
              "dimension_id": "d1e2f3a4-b5c6-7890-abcd-ef1234567890",
              "definition_id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
              "created_at": "2024-02-27T02:16:40.389772Z",
              "updated_at": "2024-02-27T02:16:40.389772Z",
              "deleted_at": null,
              "archived_at": null
            }
          ]
        }
      ],
      "transaction_tags": [
        {
          "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
          "key": "department",
          "value": "sales",
          "dimension_display_name": "Department",
          "value_display_name": "Sales Team",
          "dimension_id": "d1e2f3a4-b5c6-7890-abcd-ef1234567890",
          "definition_id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
          "created_at": "2024-02-27T02:16:40.389772Z",
          "updated_at": "2024-02-27T02:16:40.389772Z",
          "deleted_at": null,
          "archived_at": null
        }
      ]
    },
    "meta": {}
  }
  ```
</ResponseExample>
