Making Lightning Payments

In order to make a Lightning Payment, you must pass a few attributes to the PayInvoice API call. A Payment accepts the following attributes:

AttributeStatusDescription
invoiceStringThe Lightning invoice that is meant to be paid.
descriptionStringThe Payment description (only used for internal record-keeping).
internalIdStringAn optional free-use attribute. Usually used by setting the Player/User ID of your Game/Application in order to link specific Payments to specific Players.
callbackUrlStringThe URL ZEBEDEE services will make a POST HTTP request to with information about the Payment's status updates.

To effect a Payment, use the API (or leverage one of our SDKs) by passing the correct attributes:

// Using ZEBEDEE's NodeJS SDK
import { makePayment, initAPI } from 'zebedee-nodejs';
// Instantiate the API
const apiOptions = { apiKey: 'API_KEY_HERE' };
initAPI(apiOptions);
// Set the payload
const payload = {
description: 'My Payment Description',
callbackUrl: 'https://yourapp.com/callback',
internalId: '11af01d092444a317cb33faa6b8304b8',
invoice: 'lnbc450n1p0yeytspp55yrs0j42wnkw0qutr8e0tgsf2yplxs9986t5gqmfpn7mfd0ckc8sdzq2pshjmt9de6zqen0wgsrgdfqwp5hsetvwvsxzapqwdshgmmndp5hxtnsd3skxefwxqzjccqp2sp5pyccqt6apxelz62d2ndrt0ssahndpcua4wklea80glaczx80t3wqrzjqfn4cln8jwe4dh4dmscddrmd6sdw6hzkn702l6ghwvr8lhad0ez5vzt8vyqqf2sqqqqqqqlgqqqqqqgq9q9qy9qsqqeft09gryr80aaghm7rmh7eeqfl7hxlcynp99730yk7qh534d9nyfwp0nc628rp8hpgp23fxzj5l2aet4y6sc4t79uj3wyjxffejmvgqrmxkvr',
};
// Make Payment
try {
const response = await makePayment(payload);
} catch(error) {
console.log({ error });
}

If the submitted request suceeds, you can expect a JSON API response that resembles the following:

{
"message": "Successfully made Payment.",
"data": {
"id": "31d60de1-efe0-4e55-9942-910934efe7a3",
"fee": "1000",
"unit": "msats",
"amount": "10000",
"status": "completed",
"description": "My Payment Description",
"processedAt": "2020-01-01T19:34:42.794Z",
"invoice": "lnbc450n1p0yeytspp55yrs0j42wnkw0qutr8e0tgsf2yplxs9986t5gqmfpn7mfd0ckc8sdzq2pshjmt9de6zqen0wgsrgdfqwp5hsetvwvsxzapqwdshgmmndp5hxtnsd3skxefwxqzjccqp2sp5pyccqt6apxelz62d2ndrt0ssahndpcua4wklea80glaczx80t3wqrzjqfn4cln8jwe4dh4dmscddrmd6sdw6hzkn702l6ghwvr8lhad0ez5vzt8vyqqf2sqqqqqqqlgqqqqqqgq9q9qy9qsqqeft09gryr80aaghm7rmh7eeqfl7hxlcynp99730yk7qh534d9nyfwp0nc628rp8hpgp23fxzj5l2aet4y6sc4t79uj3wyjxffejmvgqrmxkvr"
}
}

Payment Updates

There are cases where Lightning Payments can get stuck in transit (e.g. a network node on the path to the payment's destination suddenly goes offline). ZEBEDEE aims to provide cutting edge Lightning Network infrastructure with high availability and liquidity. That said, due to the possibility of running into stuck payment cases, the recommended method of getting Payment updates is through the callbackUrl attribute. By providing a callbackUrl when making the Payment, the ZEBEDEE services are able to make a POST request to that URL and pass along Payment updates as they happen.