Skip to content

Instantly share code, notes, and snippets.

@john-zaprite
Created April 13, 2022 17:24
Show Gist options
  • Save john-zaprite/530d2b07daeca6c0405c38e2dd4f8cd2 to your computer and use it in GitHub Desktop.
Save john-zaprite/530d2b07daeca6c0405c38e2dd4f8cd2 to your computer and use it in GitHub Desktop.
Zaprite integration with the Galoy API.

The following is the ideal flow Zaprite would like to have when using the Galoy API.

API key

Zaprite should have it's own API key that we store as an environment variable in our Next JS app.

Permissions

1. Create public invoices on a user's behalf
2. Watch for settlement of those invoices

User account connection

Zaprite users can sign-up and add their Bitcoin Beach handle to Zaprite's database, via our UI.

Invoice generation

We will generate a Bitcoin Beach public invoice on the Zaprite user's behalf, using our API key and their handle.

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.

Webhook payload

We need to have the ability to create a subscription that watches all invoices that have been generated using our 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment