The following is the ideal flow Zaprite would like to have when using the Ibex Pay API.
Zaprite should have it's own 'partner' API key
that we store as an environment variable in our Next JS app.
1. Create public invoices on a user's behalf
2. Watch for settlement of those invoices
Zaprite users can sign-in to their Ibex accounts and we will save their accountId
in Zaprite's database.
We will generate a Ibex Pay public invoice on the user's behalf, using our partner API key
and the user's Ibex accountId
.
We need to also attach custom metadata
to the POST
request, as follows:
"metadata": {
"userId": "QNmM7hHzi6vjbi15BSu9",
"docId": "M7hNmHzi15Bidi6vjbSQ",
"ref": "l4c9wAxjt8A7QUqZr7Dh"
}
This metadata
should be stored on your side, and sent back with the webhook payload.
We need to have the ability to create a subscription
that watches all invoices that have been generated using our partner API key
.
The webhook should deliver a payload to our endpoint whenever an invoice is settled. This payload should include the custom metadata
that we sent with the original POST
request to create the invoice.