Skip to main content
Version: v2alpha1

Enrichment with payment advice using the API

Before you start

  • The payment advices are automatically detected using the email connections configured. Refer to email connectivity guide to connect your mailbox to the getpaid's platform and start ingesting and detecting automatically payment advices.

Steps

1. Get invoices with payment advice

You can retrieve the invoices with or without payment advices by calling GET /invoices endpoint and using the filter has_payment_advices.

Response

200 OK
{
"cursor": "Q3VyaW9zaXR5IGtpbGwgdGhlIGNhdA==",
"data": [
{
"id": "inv_4wt0wrfqwz0vkatave0fkjg046",
"code": "A25000323",
"has_payment_advices": true,
[...]
},
[...]
]
}

2. Get invoice details

When a payment advice contains invoices information, it is linked to the referenced invoices and each invoice has a link to the payment advice in its details. You can get the payment advice linked to an invoice by calling GET /invoices/{invoice_id} endpoint and checking the payment_advices list.

In this scenario the {invoice_id} from the previous step is inv_4wt0wrfqwz0vkatave0fkjg046.

Response

200 OK
{
"id": "inv_4wt0wrfqwz0vkatave0fkjg046",
"code": "A25000323",
"payment_advices": [
{
"id": "pad_4mf87bff6zed114xefstvjwqm0"
},
[...]
],
[...]
}

3. Get payment advice details

For each payment advice linked to an invoice, you can get its details by calling GET /payment_advices/{payment_advice_id} endpoint. In this scenario, the {payment_advice_id} from the previous step is pad_4mf87bff6zed114xefstvjwqm0.

There is a bidirectional link with the related invoices in the invoices list.

The source field includes the details from the origin of the payment advice. For example, an email conversation and the specific email, and optionally its attachments, where the payment advice was detected. The email and its attachments can be downloaded to check the original information.

Response

200 OK
{
"id": "pad_4nmd4fgtv79406k456c7k42sw4",
"invoices": [
{
"status": "linked",
"id": "inv_4wt0wrfqwz0vkatave0fkjg046",
"payment_advice_data": {
[...]
}
},
[...]
],
"source": {
"id": "ecv_4nmd4fgtv79406k456c7k42sw4",
"type": "email_conversation",
"email": {
"id": "eml_49y5ck7p73n31fgye8xfx3dkdj",
"document": {
"id": "doc_4vqch9nf43a5jaymgnrr7r37n7",
"format": "eml"
},
"attachments": [
{
"id": "doc_4hpf92p8aa464c3pr0rg8zgzwp",
"name": "A25000323.pdf",
"format": "pdf"
}
],
[...]
}

}
[...]
}

4. Download payment advice original document

You can download the source email, and the PDFs attached if present, where the payment advice was detected by calling GET /payment_advices/{payment_advice_id}/documents/{document_id} endpoint.

In this scenario, the {payment_advice_id} is again, from previous steps, pad_4mf87bff6zed114xefstvjwqm0 and the {document_id} can be, from the payment advice details:

  • For the original email in eml format is doc_4vqch9nf43a5jaymgnrr7r37n7.
  • For the attached PDF is doc_4hpf92p8aa464c3pr0rg8zgzwp.