Quickstart
This procedure takes you from a new account to a paid invoice. You need a Zcash wallet that can export an incoming viewing key (UIVK) or a Unified Full Viewing Key (UFVK).
Create your account and connect your wallet
Section titled “Create your account and connect your wallet”-
Open the Lunaz dashboard and go to the sign-in page.
-
Enter your email.
Lunaz sends a one-time code to your email through Magic. A new email creates a new account.
-
Enter the code.
You can set an account name later in Settings.
-
Get the incoming viewing key from your wallet.
With zcash-devtool, run
wallet list-accounts. The command prints the UIVK on theUIVK:line. On mainnet the UIVK starts withuivk1. If your wallet exports only a UFVK (uview1), use the UFVK. Lunaz keeps only its incoming part. -
Make sure that the key is correct.
-
Paste the key in the dashboard onboarding and save it.
-
Open the API keys page and create an API key.
-
Keep the key on your server.
Create your first invoice
Section titled “Create your first invoice”An invoice amount is in zatoshi. 1 ZEC is 100000000 zatoshi.
-
Send this request from your server. Replace the key with your API key.
Create an invoice curl -X POST https://api.example.com/v1/invoices \-H "Authorization: Bearer lz_your_api_key" \-H "Content-Type: application/json" \-d '{"amount_zat": 5000000, "expires_in_secs": 900}'Use the API base URL that Lunaz gave you instead of
api.example.com. -
Read the response.
Response {"id": "8f14e45f-ceea-4672-9b2d-5c1d0a7e3b11","address": "u1q8x4example7shieldedaddress","amount_zat": 5000000,"zip321_uri": "zcash:u1q8x4example7shieldedaddress?amount=0.05&memo=bHVuYXo6OGYxNGU0NWY","status": "pending","expires_at": 1792000900} -
Save the
idwith your order.
Show the QR code
Section titled “Show the QR code”-
Encode the
zip321_urivalue as a QR code. -
Show the QR code to the buyer.
-
Tell the buyer to scan it with a Zcash wallet.
The URI also contains the address and the amount. A wallet fills these fields when the buyer scans the code.
Receive the webhook
Section titled “Receive the webhook”-
Open the webhooks page in the dashboard.
-
Enter the URL of your endpoint.
-
Copy the signing secret.
-
Send a test delivery from the dashboard.
-
Make sure that your endpoint returns a 2xx status.
-
Verify the
X-Lunaz-Signatureheader of each request. See Webhooks. -
Wait for the
invoice.paidwebhook.
When the buyer pays, the status changes to detected and then to paid after one confirmation. Lunaz sends invoice.paid with this body.
{ "type": "invoice.paid", "invoice_id": "8f14e45f-ceea-4672-9b2d-5c1d0a7e3b11", "status": "paid", "amount_zat": 5000000, "received_zat": 5000000, "overpaid_zat": 0, "txid": "3b1c0f9e2a7d4c58b6e1a0f3d9c27b845e6a1f0d2c3b4a59687766554433221f", "swap": null}Next steps
Section titled “Next steps”- Read the Concepts page for the invoice statuses.
- Add other crypto to your checkout.