Document error webhook

Credentials

No credentials are documented for this endpoint.

Webhook callback endpoint for failed document issuance. Called by external invoicing services when document creation fails.

Parameters

Name In Type Required Description
docId path string yes Document ID that failed to issue

Request body

Content type: application/json

Field Type Required Description
docId string yes Document ID that failed to issue
errorCode string yes Error code identifying the type of failure
errorMessage string yes Human-readable error description
failedAt string no Timestamp when the failure occurred

Request example

{
  "docId": "12345",
  "errorCode": "TAX_AUTHORITY_REJECTED",
  "errorMessage": "Document rejected by tax authority - invalid VAT number",
  "failedAt": "2024-01-15T10:30:00Z"
}

Code samples

curl

curl -X POST 'https://sandbox.payme.io/api/partner/api/income-documents/hooks/error/<docId>' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "docId": "12345",
  "errorCode": "TAX_AUTHORITY_REJECTED",
  "errorMessage": "Document rejected by tax authority - invalid VAT number",
  "failedAt": "2024-01-15T10:30:00Z"
}'

Node.js

const response = await fetch("https://sandbox.payme.io/api/partner/api/income-documents/hooks/error/<docId>", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "docId": "12345",
    "errorCode": "TAX_AUTHORITY_REJECTED",
    "errorMessage": "Document rejected by tax authority - invalid VAT number",
    "failedAt": "2024-01-15T10:30:00Z"
  }),
});

console.log(await response.text());

Python

import requests

response = requests.post(
    "https://sandbox.payme.io/api/partner/api/income-documents/hooks/error/<docId>",
    json={
        "docId": "12345",
        "errorCode": "TAX_AUTHORITY_REJECTED",
        "errorMessage": "Document rejected by tax authority - invalid VAT number",
        "failedAt": "2024-01-15T10:30:00Z",
    },
)

print(response.text)

PHP

<?php

$body = <<<'BODY'
{
  "docId": "12345",
  "errorCode": "TAX_AUTHORITY_REJECTED",
  "errorMessage": "Document rejected by tax authority - invalid VAT number",
  "failedAt": "2024-01-15T10:30:00Z"
}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/partner/api/income-documents/hooks/error/<docId>');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

Responses

200 — Webhook processed successfully (success)

400 — Bad Request - Validation failed (error)

Field Type Description
statusCode integer
message string
error string
{
  "statusCode": 400,
  "message": [
    "Validation failed"
  ],
  "error": "Bad Request"
}