Prerequisites

Before you begin integrating the API into your systems, you must fulfill three main requirements via our Discord Bot.

  1. Join the Server: Join our Discord Server and register your payout address using the /set_address <your_ltc_address> command.
  2. API Key: Obtain your secret API Key securely using the /view_key command.
  3. Subscription: Ensure you have an active subscription. (Admins grant this via the /grant_sub command).

Note: Never share your secret API key with anyone or expose it in client-side code (like frontend JavaScript). Always make requests to our API from your secure backend server.

Endpoint Authentication

To generate a payment page, you must send a POST request. Our API authenticates you using the API Key headers.

Request Body payload

{
  "amountLtc": 0.05,
  "webhookUrl": "https://your-website.com/api/webhook/ltc-payment"
}

amountLtc: Replace this with the dynamically calculated order total for your specific customer.
webhookUrl: (Optional) The remote URL our servers should ping when the payment is completed.

Example: Node.js / Axios

const axios = require('axios');

async function createPayment(orderTotalLtc) {
    try {
        const response = await axios.post('https://gateway.fluxcord.store/api/payments', {
            amountLtc: orderTotalLtc, 
            webhookUrl: 'https://your-website.com/api/webhook/ltc-payment'
        }, {
            headers: {
                'x-api-key': 'YOUR_SECRET_API_KEY'
            }
        });

        console.log('Payment URL:', response.data.paymentUrl);
        // Redirect your user to response.data.paymentUrl
    } catch (error) {
        console.error('Error creating payment:', error.response.data);
    }
}

Example: Python

import requests

def create_payment(order_total_ltc):
    url = "https://gateway.fluxcord.store/api/payments"
    headers = {
        "x-api-key": "YOUR_SECRET_API_KEY",
        "Content-Type": "application/json"
    }
    data = {
        "amountLtc": order_total_ltc, 
        "webhookUrl": "https://your-website.com/api/webhook/ltc-payment"
    }
    
    response = requests.post(url, json=data, headers=headers)
    
    if response.status_code == 200:
        print("Payment URL:", response.json()["paymentUrl"])
        # Redirect your user to this URL
    else:
        print("Error:", response.json())

How Webhooks Work

Instead of manually polling or checking if a user has paid, you can provide a webhookUrl when creating the payment session. Once the payment is absolutely confirmed on the Litecoin blockchain, our watcher service will instantly send a POST request to your provided URL.

Webhook Payload Example

Your server will receive the following JSON body:

{
  "paymentId": "550e8400-e29b-41d4-a716-446655440000",
  "status": "completed",
  "amountLtc": 0.05,
  "receivingAddress": "ltc1qv..."
}

Express.js Receiver Example

Here is how you handle the incoming confirmation on your own backend system:

app.post('/api/webhook/ltc-payment', express.json(), (req, res) => {
    const { paymentId, status, amountLtc, receivingAddress } = req.body;

    if (status === 'completed') {
        // 1. Verify this paymentId exists in your database
        // 2. Mark the user's order as paid
        // 3. Deliver the product/service automatically

        console.log(`Payment ${paymentId} completed! Delivered product.`);
    }

    res.status(200).send('Webhook received');
});

Using the Public Endpoint

If you prefer not to implement incoming Webhooks on your system, you can constantly check the status of a specific invoice securely via our public GET endpoint.

Response Payload

{
  "paymentId": "550e8400-e29b-41d4-a716-446655440000",
  "status": "completed",
  "amountLtc": 0.05,
  "receivingAddress": "ltc1qv...",
  "expiresAt": "2023-12-31T23:59:59.000Z",
  "businessName": "Your Configured Business Name"
}

Status Enum: Status values can strictly be pending, completed, or expired.