For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inBook a demo
HomeGuidesAPI ReferenceGlossary
HomeGuidesAPI ReferenceGlossary
      • Creating and Managing Payers (C2s)
      • Creating and Managing Vendors (C3s)
      • Creating Payouts via API
      • Invoices
      • Batch Payments
      • Recurring Payments
      • Approval Policies
      • Email Inbox
      • GL Accounts
      • Vendor Credits
      • Accounting Sync
Logo
Sign inBook a demo
On this page
  • API Reference
  • Creating Vendor Credits
  • Applying Vendor Credits
  • Vendor credits partially cover the invoice
  • Vendor credits fully cover the invoice
  • Estimating Vendor Credit Usage
Accounts Payable

Vendor Credits

Was this page helpful?
Previous

Accounting Sync

Next
Built with

API Reference

Mercoa also supports vendor credit tracking. Vendor credits are credits your users can receive from their vendors that represent the amount of money a vendor owes your user.

Creating Vendor Credits

Vendor credits can be created through Mercoa’s frontend via the entity dashboard or Mercoa’s vendor portal. You can also create vendor credits through the create vendor credit API endpoint.

POST
/entity/:entityId/counterparty/:counterpartyId/vendor-credit
1curl -X POST https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/counterparty/ent_21661ac1-a2a8-4465-a6c0-64474ba8181d/vendor-credit \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "totalAmount": 100,
6 "currency": "USD",
7 "note": "This is a note"
8}'
Try it

Applying Vendor Credits

If a vendor credit between the payer and vendor of an invoice is available, Mercoa allows the payer to apply the credit to the invoice. This deducts the vendor credit amount from the invoice total, reducing the amount transferred through Mercoa.

Mercoa’s frontend automatically applies available vendor credits to invoices created via the <PayableDetails /> React component. You can also apply vendor credits using the vendorCreditIds parameter on the update invoice API endpoint.

POST
/invoice/:invoiceId
1curl -X POST https://api.mercoa.com/invoice/in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9 \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "vendorCreditIds": [
6 "vcr_c3f4c87d-794d-4543-9562-575cdddfc0d7"
7 ]
8}'
Try it

When paying an invoice with vendor credits through Mercoa’s payment rails, there are two scenarios to consider:

Vendor credits partially cover the invoice

If the applied vendor credits sum to less than the invoice total, Mercoa only transfers the remaining invoice amount to the vendor. In this case, the invoice enters the PENDING state and is processed normally.

Vendor credits fully cover the invoice

If the applied vendor credits sum to the invoice total or more, Mercoa doesn’t transfer any funds to the vendor. In this case, the invoice enters the PENDING state and then immediately enters the PAID state. Please note that all the same webhooks are still sent as if the invoice is paid normally.

Estimating Vendor Credit Usage

You can estimate the usage of vendor credits on an invoice of a given amount using the estimate usage endpoint.

GET
/entity/:entityId/counterparty/:counterpartyId/vendor-credits/estimate-usage
1curl -G https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/counterparty/ent_21661ac1-a2a8-4465-a6c0-64474ba8181d/vendor-credits/estimate-usage \
2 -H "Authorization: Bearer <token>" \
3 -d amount=150 \
4 -d currency=USD
Try it