Anchors - Basic Integration

Describes the basic process for an Anchor to advance its invoices on the Monkey platform.

Understanding the Upload Flow

Invoices

1 - The Anchor makes the request with the invoices to be uploaded to the platform.
2 - The API receives the request and returns the status code 202 Accepted, and the invoices are queued for processing.
3 - The queued invoices are processed, and a duplicate validation is applied.
4 - Non-duplicate invoices are made available on the platform.
5 - Duplicate invoices are returned to the Anchor via webhook.

Uploading Invoices

The first step is to send your invoices to the Monkey platform by making a request to the Invoice Upload API. Upload de Títulos.

How does the API work?

  • The API accepts batches of 150 invoices at a time, so your request will send an array of invoices, and our system will process them in the background.
  • Minimum required payload:
    • invoiceNumber: Invoice Number
    • paymentDate: Payment Date
    • paymentValue: Payment Value
    • supplierGovernmentId: Supplier EIN
  • Validations performed:
    • Invoices with a payment value less than R$ 5.00 are not processed.
    • Duplicates are validated by the key: invoiceNumber, paymentDate, supplierGovernmentId.
    • If the installment field is sent, it will also be used for duplicate validation.
  • In case of duplicates, the Anchor will be notified via Webhook.

Duplicate Invoice Webhook:

Invoices that fail duplicate validation are grouped and returned to the anchor via Webhook, with a payload listing the duplicated invoices from each request.

How does this Webhook work?

  • Monkey's system makes an HTTP request to the URL configured on the platform.
  • The request path is /payables, so your system should have this endpoint exposed.
  • The request contains an array of items as shown in the example below:
{
   "sponsorId":8548754,
   "processId":"haq2gJdZpk",
   "items":[
      {
         "uuid":"BEiMDdBo64",
         "externalId":"vzAsW2cx2O",
         "paymentDate":1605887005033,
         "realPaymentDate":1605887005033,
         "paymentValue":5000,
         "supplierGovernmentId":"12212391010112",
         "supplierName":"SELLER LTDA",
         "invoiceNumber":"vzAsW2cx2O",
         "invoiceKey":null,
         "installment":1,
         "totalInstallment":1
      }
   ],
   "eventType":"PayableDuplicatedEvent",
   "_links":{
      "sponsor":{
         "href":"https://zuul.monkey.exchange/v2/sponsors/40566534",
         "type":"GET"
      }
   }
}

For more details, consult the webhook documentation. webhooks.

Negotiated Invoices Webhook

When a transaction is completed on the platform, our system notifies the anchor via Webhook. In Monkey's platform, an operation always includes an anchor, a supplier, an investor, and one or more invoices. Be prepared to receive a list of invoices in the negotiated invoices webhook.

How does this Webhook work?

  • Monkey's system makes an HTTP request to the URL configured on the platform.
  • The request path is /payables-response, so your system should expose this endpoint.
  • The request contains an array of items and the investor information who won the auction for this transaction. See the example below:
{
  "purchaseId": "parniqQ70k",
  "sponsorId": 4026534,
  "sponsorName": "SACADO S.A",
  "sponsorGovernmentId": "13677912100135",
  "sellerId": 1614639279,
  "sellerName": "CEDENTE S.A",
  "sellerGovernmentId": "35060339000286",
  "buyerId": 540897447,
  "buyerName": "INVESTIDOR S.A.",
  "buyerGovernmentId": "01331122000222",
  "buyerReceivementBank": "341",
  "buyerReceivementAgency": "1234",
  "buyerReceivementAccount": "1234",
  "buyerReceivementAccountDigit": "1",
  "items": [
    {
      "payableUuid": "P7FQZxtGJD",
      "status": "SOLD", [*]
      "detail": "",
      "externalId": "GwQMrDKM0R",
      "invoiceNumber": "soroKFUWbs",
      "installment": 1, [**]
      "totalInstallment": 1, [**]
      "paymentDate": 1585450800000,
      "tax": 1.8,
      "sponsorTax": 0,
      "paymentValue": 99.93,
      "sellerPaymentValue": 98.87,
      "sponsorPaymentValue": 0,
      "_links": {
        "payable": {
          "href": "https://zuul.monkeyecx.com/v2/sponsors/4026534/payables/P7FQZxtGJD",
          "type": "GET"
        }
      }
    },
    {
      "payableUuid": "5xHO6IkIyz",
      "status": "REFUSED", [*]
      "detail": "",
      "externalId": "qTDXKkLZ7b",
      "invoiceNumber": "5Pfb1BEazX",
      "installment": 1, [**]
      "totalInstallment": 1, [**]
      "paymentDate": 1585450800000,
      "tax": 1.8,
      "sponsorTax": 0,
      "paymentValue": 99.93,
      "sellerPaymentValue": 98.87,
      "sponsorPaymentValue": 0,
      "_links": {
        "payable": {
          "href": "https://zuul.monkeyecx.com/v2/sponsors/4026534/payables/5xHO6IkIyz",
          "type": "GET"
        }
      }
    }
  ],
  "_links": {
    "sponsor": {
      "href": "https://zuul.monkeyecx.com/v1/sponsors/4026534",
      "type": "GET"
    },
    "payables": {
      "href": "https://zuul.monkeyecx.com/v2/sponsors/4026534/payables",
      "type": "GET"
    }
  }
}

In the above payload, we have information about which investor (buyer) made the advance (Company Name, EIN, Bank Details).

This payload also contains the IDs (externalId and InvoiceNumber) used for identifying the invoice in your system.