Pay Lightning Invoice - Go Lightning

Pay a Lightning Network invoice from a Go Account. See the Guide.

  1. You build a transaction from your Go Account with the Lightning invoice as the recipient address. Pass the Lightning invoice string as the recipient address and the amount in satoshis.

    API Reference

  2. You use your Go Account passphrase to authenticate the transaction. To ensure your passphrase isn't passed over the Internet, use the JavaScript SDK or BitGo Express in external-signing mode.

  3. You send the authenticated transaction to BitGo. Pass the full signed payload from the previous step as the halfSigned object.

    API Reference

// 1. Build Transaction
export COIN="ofctbtc"
export WALLET_ID="<YOUR_GO_ACCOUNT_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export INVOICE="<LIGHTNING_INVOICE_STRING>"
export AMOUNT="<AMOUNT_IN_SATOSHIS>"

curl -X POST \
  https://app.bitgo-test.com/api/v2/$COIN/wallet/$WALLET_ID/tx/build \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "recipients": [
      {
        "amount": "'"$AMOUNT"'",
        "address": "'"$INVOICE"'"
      }
    ]
}'
// 2. Authenticate Transaction
export BITGO_EXPRESS_HOST="<YOUR_LOCAL_HOST>"
export WALLET_PASSPHRASE="<YOUR_GO_ACCOUNT_PASSPHRASE>"

curl -X POST \
  http://$BITGO_EXPRESS_HOST/api/v2/ofc/signPayload \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
   "walletId": "'"$WALLET_ID"'",
   "walletPassphrase": "'"$WALLET_PASSPHRASE"'",
   "payload": "<PAYLOAD_FROM_BUILD_STEP>"
}'
// 3. Send Transaction
curl -X POST \
  https://app.bitgo-test.com/api/v2/$COIN/wallet/$WALLET_ID/tx/send \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "halfSigned": {
      "coin": "ofctbtc",
      "recipients": [
        {
          "address": "lntbs1...",
          "amount": "1000"
        }
      ],
      "fromAccount": "<WALLET_ID>",
      "nonce": "<NONCE>",
      "timestamp": "2026-04-09T12:00:00.000Z",
      "feeString": "0",
      "payload": "<SIGNED_PAYLOAD>",
      "signature": "<SIGNATURE>"
    }
  }'
Response
// 1. Build Transaction Response
{
  "payload": "{\"coin\":\"ofctbtc\",\"recipients\":[{\"address\":\"lntbs1...\",\"amount\":\"1000\"}],\"fromAccount\":\"<WALLET_ID>\",\"nonce\":\"<NONCE>\",\"timestamp\":\"2026-04-09T12:00:00.000Z\",\"feeString\":\"0\"}",
  "feeInfo": { "feeString": "0" },
  "coin": "ofc",
  "token": "ofctbtc"
}

// 2. Authenticate Transaction Response
{
  "coin": "ofctbtc",
  "recipients": [
    {
      "address": "lntbs1...",
      "amount": "1000"
    }
  ],
  "fromAccount": "<WALLET_ID>",
  "nonce": "<NONCE>",
  "timestamp": "2026-04-09T12:00:00.000Z",
  "feeString": "0",
  "payload": "<SIGNED_PAYLOAD>",
  "signature": "<SIGNATURE>"
}

// 3. Send Transaction Response
{
  "transfer": {
    "id": "<TRANSFER_ID>",
    "coin": "ofctbtc",
    "wallet": "<WALLET_ID>",
    "walletType": "trading",
    "enterprise": "<ENTERPRISE_ID>",
    "txid": "<TRANSACTION_ID>",
    "date": "2026-04-09T12:00:01.000Z",
    "type": "send",
    "valueString": "-1000",
    "feeString": "0",
    "state": "signed"
  },
  "txid": "<TRANSACTION_ID>",
  "status": "signed"
}