$payload = [
"commande" => [
"invoice" => [
"items" => [],
"total_amount" => 5000,
"devise" => "XOF",
"description" => "Pro Subscription — January 2025",
"customer" => "22790000002",
"customer_firstname" => "Idrissa",
"customer_lastname" => "Souley",
"customer_email" => "idrissa@example.com",
"external_id" => "",
"otp" => "",
],
"store" => ["name" => "MyApp", "website_url" => "https://myapp.com"],
"actions" => [
"cancel_url" => "",
"return_url" => "",
"callback_url" => "https://myapp.com/api/callback/ligdicash",
],
"custom_data" => ["transaction_id" => "ORD-2025-00069"],
],
];
$ch = curl_init("https://app.ligdicash.com/pay/v01/straight/checkout-invoice/create");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Apikey: " . $_ENV["LIGDICASH_API_KEY"],
"Authorization: Bearer " . $_ENV["LIGDICASH_API_TOKEN"],
"Accept: application/json",
"Content-Type: application/json",
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);