API ReferencePayments

DELETE Payment

Delete payments by transaction, visitor, or time range.

DELETE Payment

DELETE https://api.faurya.com/api/v1/payments

Delete payments you recorded with POST Payment. Deleted payments disappear from every revenue report and dashboard. Payments from connected payment providers are never affected. Requires Bearer Token authentication.

Request body

Send at least one filter field. Filters can be combined unless transaction_id or tx_id is provided; transaction deletion takes precedence and deletes a single matching payment.

  • transaction_id (string): Delete one payment by transaction ID.
  • tx_id (string): Alias for transaction_id.
  • faurya_visitor_id (string): Delete the payments of the customer this visitor belongs to.
  • startAt or startDate (string): Start of the deletion range, matched against when each payment happened.
  • endAt or endDate (string): End of the deletion range.

If only one side of the time range is provided, the API uses the site creation time as the missing start or the current time as the missing end.

A deleted transaction_id cannot be recorded again. A payment still being recorded when you delete it is withdrawn before it is stored.

Response

  • 200 OK: Matching payments deleted.
  • 400 Bad Request: No filter was provided or the time range is invalid.
  • 401 Unauthorized: Missing or invalid API key.
  • 404 Not Found: No payment matched.

Delete by transaction

const response = await fetch("https://api.faurya.com/api/v1/payments", {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.FAURYA_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    transaction_id: "payment_456",
  }),
});

const result = await response.json();

Success response

{
  "status": "success",
  "message": "Payment deleted",
  "deleted": 1,
  "transaction_id": "payment_456"
}

Delete by visitor and time range

const response = await fetch("https://api.faurya.com/api/v1/payments", {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.FAURYA_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    faurya_visitor_id: "visitor_123",
    startAt: "2026-06-01T00:00:00.000Z",
    endAt: "2026-06-29T23:59:59.999Z",
  }),
});

const result = await response.json();

Success response

{
  "status": "success",
  "message": "3 payment(s) deleted",
  "deleted": 3,
  "faurya_visitor_id": "visitor_123",
  "timeRange": {
    "start": "2026-06-01T00:00:00.000Z",
    "end": "2026-06-29T23:59:59.999Z"
  }
}