Document success webhook

Credentials

No credentials are documented for this endpoint.

Webhook callback endpoint for successfully issued documents. Called by external invoicing services when a document is successfully created.

Parameters

Name In Type Required Description
docId path string yes Document ID that was successfully issued

Request body

Content type: application/json

Field Type Required Description
docId string yes Document ID that was successfully issued
docNumber string no Official document number assigned by invoicing service
docUrl string no URL to download the issued document
issuedAt string no Timestamp when document was issued

Request example

{
  "docId": "12345",
  "docNumber": "INV-2024-001",
  "docUrl": "https://invoicing.service/docs/12345.pdf",
  "issuedAt": "2024-01-15T10:30:00Z"
}

Code samples

curl

curl -X POST 'https://sandbox.payme.io/api/partner/api/income-documents/hooks/success/<docId>' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "docId": "12345",
  "docNumber": "INV-2024-001",
  "docUrl": "https://invoicing.service/docs/12345.pdf",
  "issuedAt": "2024-01-15T10:30:00Z"
}'

Node.js

const response = await fetch("https://sandbox.payme.io/api/partner/api/income-documents/hooks/success/<docId>", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "docId": "12345",
    "docNumber": "INV-2024-001",
    "docUrl": "https://invoicing.service/docs/12345.pdf",
    "issuedAt": "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/success/<docId>",
    json={
        "docId": "12345",
        "docNumber": "INV-2024-001",
        "docUrl": "https://invoicing.service/docs/12345.pdf",
        "issuedAt": "2024-01-15T10:30:00Z",
    },
)

print(response.text)

PHP

<?php

$body = <<<'BODY'
{
  "docId": "12345",
  "docNumber": "INV-2024-001",
  "docUrl": "https://invoicing.service/docs/12345.pdf",
  "issuedAt": "2024-01-15T10:30:00Z"
}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/partner/api/income-documents/hooks/success/<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"
}