orders->get($orderId); $line = $order->lines()->get($lineId); if ($line && $line->isCancelable) { $order->cancelLines([ 'lines' => [ [ 'id' => $lineId, 'quantity' => 1, // optional parameter ] ], ]); $updatedOrder = $mollie->orders->get($orderId); echo 'Your order ' . $order->id . ' was updated:'; foreach ($order->lines as $line) { echo $line->description . '. Status: ' . $line->status . '.'; } } else { echo "Unable to cancel line " . $lineId . " for your order " . $orderId . "."; } } catch (\Mollie\Api\Exceptions\ApiException $e) { echo "API call failed: " . htmlspecialchars($e->getMessage()); }