Reseller API
Getting started
Use the Reseller API to order and manage services from your own application.
Authentication
Create a key under API Keys in your account. Send it as a Bearer token with every request. Your API base URL ends in /v1.
curl "$LINQIX_API_URL/products" \
-H "Authorization: Bearer $LINQIX_API_KEY" \
-H "Accept: application/json"
Set LINQIX_API_URL to your API base URL and LINQIX_API_KEY to your key. Requests belong to your reseller account; keep the key on your server.
Place your first order
Choose a product, check the price and your available funds, then submit the order.
- Choose the product:
GET /products/{id}returns its available options. - Check the price:
POST /checkout/quotereturns the total and available payment methods. For invoice payment,remaining_credit_minormust coverprice.unit_total_minor. For wallet payment, the offered method must have no remaining amount due. - Order:
POST /ordersreturns your order ID. Start its payment withPOST /orders/{id}/payment. - Check progress: wait for payment authorisation and provisioning to finish before delivering the service.
Prices are in EUR cents: 10000 means €100.00, including the chosen term, setup and tax.
Code examples
These are the entry files. The download includes the HTTP and storage helpers. Set your API URL, API key and private checkout folder, then use an order reference from your own shop.
PHP
<?php
require getenv('LINQIX_SDK_DIR') . '/autoload.php';
use Linqix\Reseller\Client;
// php order.php my-order-1001 /private/order.json
$api = new Client(getenv('LINQIX_API_URL'), getenv('LINQIX_API_KEY'));
$checkout = $api->checkout(getenv('LINQIX_CHECKOUT_DIR'));
$orderDetails = json_decode(file_get_contents($argv[2]), true, flags: JSON_THROW_ON_ERROR);
// Checks the current price and credit facility, then submits the order and payment.
// Reuse your order reference when retrying. The SDK saves the request keys for you.
$order = $checkout->placeOrder($argv[1], $orderDetails, payment: 'invoice', maximumMinor: 10000);
echo 'Order: ' . $order['order_id'] . PHP_EOL;
// Check again later with the same reference. This never creates another order.
$status = $checkout->status($argv[1]);
echo 'Status: ' . $status['status'] . PHP_EOL;
C#
using System;
using System.IO;
using System.Text.Json.Nodes;
// dotnet run -- my-order-1001 /private/order.json
var apiUrl = Environment.GetEnvironmentVariable("LINQIX_API_URL")!;
var apiKey = Environment.GetEnvironmentVariable("LINQIX_API_KEY")!;
var directory = Environment.GetEnvironmentVariable("LINQIX_CHECKOUT_DIR")!;
var details = JsonNode.Parse(await File.ReadAllTextAsync(args[1]))!.AsObject();
using var checkout = new CheckoutFiles(directory, args[0]);
var order = await LinqixOrder.Place(apiUrl, apiKey, details, checkout.Load, checkout.Save);
Console.WriteLine($"Order: {order["order_id"]}");
Console.WriteLine("Payment submitted. Check provisioning before delivering the service.");
JavaScript
import { order } from './order.mjs';
import { openCheckout } from './checkout-files.mjs';
// Call from your backend. Your own shop order number is the retry reference.
export async function createOrder(reference, orderDetails) {
const checkout = await openCheckout(process.env.LINQIX_CHECKOUT_DIR, reference);
try {
// Checks price and available credit, then creates the order and starts payment.
return await order(process.env.LINQIX_API_URL, process.env.LINQIX_API_KEY, orderDetails, checkout);
} finally {
await checkout.close();
}
}
Java
import java.nio.file.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.node.ObjectNode;
public final class RunOrder {
public static void main(String[] args) throws Exception {
// RunOrder my-order-1001 /private/order.json
Order api = new Order(System.getenv("LINQIX_API_URL"), System.getenv("LINQIX_API_KEY"));
ObjectNode details = (ObjectNode) new ObjectMapper().readTree(Files.readString(Path.of(args[1])));
try (CheckoutFiles checkout = new CheckoutFiles(System.getenv("LINQIX_CHECKOUT_DIR"), args[0])) {
ObjectNode order = api.place(details, checkout);
System.out.println("Order: " + order.get("order_id").asText());
System.out.println("Payment submitted. Check provisioning before delivering the service.");
}
}
}
Node.js
import { readFile } from 'node:fs/promises';
import { createOrder } from './create-order.mjs';
// node node-order.mjs my-order-1001 /private/order.json
const [reference, inputFile] = process.argv.slice(2);
const details = JSON.parse(await readFile(inputFile, 'utf8'));
// Checks price and credit, saves the request and starts payment.
const order = await createOrder(reference, details);
console.log('Order:', order.order_id);
console.log('Payment submitted. Check provisioning before delivering the service.');
Ruby
require_relative 'order'
require_relative 'checkout_files'
# ruby run_order.rb my-order-1001 /private/order.json
details = JSON.parse(File.read(ARGV.fetch(1)))
checkout = CheckoutFiles.new(ENV.fetch('LINQIX_CHECKOUT_DIR'), ARGV.fetch(0))
begin
order = place_order(ENV.fetch('LINQIX_API_URL'), ENV.fetch('LINQIX_API_KEY'), details, checkout)
puts "Order: #{order.fetch('order_id')}"
puts 'Payment submitted. Check provisioning before delivering the service.'
ensure
checkout.close
end
Payment and order status
In the PHP SDK, use invoice for your credit facility or wallet for your cash balance. The SDK checks funds before ordering and copies the payment identifier offered by the server.
Call $checkout->status($reference) to read progress. With direct HTTP calls, check the payment operation, then /operations/checkout/{order-id}, then /operations/order/{order-id}. An authorised invoice may still be unpaid. A ready service requires completed provisioning.
Retrying after an error
Reuse the same shop reference and order details. The examples save request keys before submitting a purchase. A new reference creates a new purchase. Keep checkout files private and persistent; keep the API key on your server. A quote does not reserve funds, so the API checks them again during payment.
