Developer Guide
Receiving
15min
This guide explains how to receive Lightning Network payments using the Voltage API.
- A Voltage account with an active wallet
- An API key (get this from the "API Keys" page in your dashboard)
Receiving a payment is a two-step process:
- Create a payment request
- Retrieve the payment details
- id: A unique identifier for the payment
- wallet_id: The ID of the wallet receiving the payment
- amount_msats: Amount to receive in millisatoshis
- currency: Currently only "btc" is supported
- payment_kind: Currently only "bolt11" is supported
- description: Description that will be included in the invoice
The payment_request in the response contains the BOLT11 invoice that should be provided to the payer.
After creating a payment request, monitor its status using the same GET endpoint:
The payment will transition through these states:
- receiving: Waiting for payment
- completed: Payment received successfully
- failed: Payment failed (check error field for details)
Common HTTP status codes:
- 200: Success
- 201: Payment request created
- 400: Invalid request (check error message)
- 403: Authentication error
- 404: Payment not found
- 500: Server error
- Generate unique payment IDs for each request
- Always retrieve the payment details after creation to get the BOLT11 invoice
- Store the payment ID to track the payment status
- Provide clear descriptions for better record keeping
- Monitor payment status changes to update your application accordingly
- Consider implementing webhook notifications for real-time updates