Answers.Body: <p>You can use the Contribution Delete API to delete the contribution.</p>
  <p><a href="https://i.sstatic.net/TdAts.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TdAts.png" alt="enter image description here" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-17T14:22:13.267Z
Answers.Text: Will this also delete the underlying financial data (line items, financial items, transaction items) associated with the contribution or only the contribution itself?
Answers.UserDisplayName: cray146
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-17T16:40:14.930Z
Answers.Text: Yes it should...
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-17T09:39:01.133Z
Answers.LastActivityDate: 2023-10-17T09:39:01.133Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I want to create an extension to delete all financial contributions from the database. The database only contains simple contributions that are not tied to memberships or events.</p>
  <p>The developers guide suggests using the Order API for adding, updating and deleting orders and the underlying financial entities.</p>
  <p>However, when I try to delete an order using APIv3 explorer I get an exception 'Only test orders can be deleted'. In APIv4, the Order entity does not seem to exist.</p>
  <p>What would be the recommended approach to delete the financial contributions via the API?</p>
  
Tags: <civicontribute><api>
Title: How to delete all financial contributions via the API?
ThreadText: # How to delete all financial contributions via the API?
  
  (Asked by: username_0 on 2023-10-17)
  
  I want to create an extension to delete all financial contributions from the database. The database only contains simple contributions that are not tied to memberships or events.
  
  The developers guide suggests using the Order API for adding, updating and deleting orders and the underlying financial entities.
  
  However, when I try to delete an order using APIv3 explorer I get an exception 'Only test orders can be deleted'. In APIv4, the Order entity does not seem to exist.
  
  What would be the recommended approach to delete the financial contributions via the API?
  
  **Tags:** civicontribute, api
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-10-17. Score: 1
  
  You can use the Contribution Delete API to delete the contribution.
  
  [![enter image description here](https://i.sstatic.net/TdAts.png)](https://i.sstatic.net/TdAts.png)
  
  > **Comments:**
  > **username_0**: Will this also delete the underlying financial data (line items, financial items, transaction items) associated with the contribution or only the contribution itself?  
  > **username_1**: Yes it should...  
  
  ---
  
  