Download OpenAPI specification:
API for merchants to connect to their Swiss Bitcoin Pay's wallet account.
For creating an invoice, you need to provide the api-key
header with your API Key, available in your dashboard (the API Key is not required to read invoice's status with webhook or GET requests).
title required | string What will appear on the client's wallet |
description | string |
amount required | number How much to charge, with decimals. ex: |
unit | string Default: "Your account's default currency" Optionally select a reference currency you want use. All major currencies are supported, along with |
onChain | boolean Default: false If Onchain payment is available |
delay | number Default: 10 How long (in minutes) the client have to pay the invoice before it gets expired |
string A message containing the created invoice will be sent to this email | |
emailLanguage | string Enum: "en" "fr" "de" "it" "es" "pt" "fi" In which language the email should be sent. If language is unknown, will fall back to |
redirect | boolean If the server should directly return a 302 REDIRECT request to force the user's browser to go to the invoice payment page |
redirectAfterPaid | string A URL where the user will be redirected after paid (confirmation page). |
object Our backend will call your webhook with a POST request will all the invoice data once it has been paid (Lightning: instant, Onchain: after 1 confirmation), unconfirmed (when a Onchain payment was just discovered), or expired. | |
object (Device) An optional device info to keep track in your dashboard and exports from which device/software the invoice code was generated. ex. | |
object Any extra parameters that will be returned to you when your webhook is called |
{- "title": "string",
- "description": "string",
- "amount": 0,
- "unit": "Your account's default currency",
- "onChain": false,
- "delay": 10,
- "email": "string",
- "emailLanguage": "en",
- "redirect": true,
- "redirectAfterPaid": "string",
- "webhook": {
- "url": "string",
- "headers": { },
- "body": { }
}, - "device": {
- "name": "string",
- "type": "string"
}, - "extra": {
- "AnyValue": null
}
}
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "pr": "string",
- "checkoutUrl": "string",
- "onChainAddr": "string",
- "amount": 0
}
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "title": "string",
- "description": "string",
- "merchantName": "string",
- "status": "draft",
- "tag": "string",
- "createdAt": 0,
- "paidAt": 0,
- "amount": 0,
- "paymentDetails": [
- {
- "network": "lightning",
- "paymentRequest": "string",
- "hash": "string",
- "preimage": "string",
- "paidAt": 0,
- "amount": 0
}
], - "paymentMethod": "lightning",
- "input": {
- "unit": "sat",
- "amount": 0
}, - "delay": 0,
- "extra": { },
- "device": {
- "name": "string",
- "type": "string"
}, - "redirectAfterPaid": "string",
- "isInit": true,
- "btcAmount": "string",
- "pr": "string",
- "isPaid": true,
- "isExpired": true,
- "hash": "string",
- "fiatAmount": 0,
- "fiatUnit": "string",
- "onChainAddr": "string",
- "minConfirmations": 0,
- "confirmations": 0,
- "txId": "string",
- "isPending": true
}
Get notified when any property of an invoice changes (eg. invoice settled, lightning invoice and sat amount updated)
This endpoint initiates a WebSocket connection.
URL: wss://api.swiss-bitcoin-pay.ch/invoice
To connect, use the WebSocket protocol:
const socket = new WebSocket("wss://api.swiss-bitcoin-pay.ch/invoice");
Once connected, simply send the invoice ID with which you want to be notified as JSON:
{
"id": "INVOICE_ID"
}
id required | string <uuid> ID of invoice |
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "title": "string",
- "description": "string",
- "merchantName": "string",
- "status": "draft",
- "tag": "string",
- "createdAt": 0,
- "paidAt": 0,
- "amount": 0,
- "paymentDetails": [
- {
- "network": "lightning",
- "paymentRequest": "string",
- "hash": "string",
- "preimage": "string",
- "paidAt": 0,
- "amount": 0
}
], - "paymentMethod": "lightning",
- "input": {
- "unit": "sat",
- "amount": 0
}, - "delay": 0,
- "extra": { },
- "device": {
- "name": "string",
- "type": "string"
}, - "redirectAfterPaid": "string",
- "isInit": true,
- "btcAmount": "string",
- "pr": "string",
- "isPaid": true,
- "isExpired": true,
- "hash": "string",
- "fiatAmount": 0,
- "fiatUnit": "string",
- "onChainAddr": "string",
- "minConfirmations": 0,
- "confirmations": 0,
- "txId": "string",
- "isPending": true
}