'Mollie payments with subscription does not work

I use Mollie for payments. A one -off payment works, but if I work with a subscription, I will receive the following error message:

API Call Failed: Error Executing API Call (Request): The Customer ID is Invalid.

I understand the error message, but I can't get it right. Please help me

<?php
session_start();
$totaal = 100;
$sOrderId = 5;
//$betaling = 'single_payment';

require_once "src/Mollie/API/Autoloader.php";
$mollie = new Mollie_API_Client;
$mollie->setApiKey("test_XXXXXXXXXXXXXXXXXXXXXXXXXX");
try
{
    $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http";
    $hostname = $_SERVER['HTTP_HOST'];

    if( $betaling == 'single_payment' )
    {
        $arguments = array(
            "amount" => $totaal,
            "method" => Mollie_API_Object_Method::IDEAL,
            "description" => "OSMC betreft " . $productnaam,
            "redirectUrl" => "{$protocol}://{$hostname}/facturatie_afgehandeld_mt.php",
            "webhookUrl" => "{$protocol}://{$hostname}{$path}/02-webhook-verification.php",
            "metadata" => array(
            "order_id" => $sOrderId,
            ),
            "issuer" => NULL
        );

        $payment = $mollie->payments->create($arguments);
    }
    else // termijn betaling
    {
        // create customer
        $customer = $mollie->customers->create([
              "name" => "Customer A",
              "email" => "[email protected]",
        ]);

        $customer = $mollie->customers->get( sCustomerID );
        $customer->createSubscription([
           "amount" => [
           "currency" => "EUR",
           "value" => "25.00",
           ],
           "times" => 4,
           "interval" => "3 months",
           "description" => "Kwartaal betaling",
           "webhookUrl" => "{$protocol}://{$hostname}{$path}/02-webhook-verification.php",
        ]);

    }

    // header to molliepayment page
    header("Location: " . $payment->getPaymentUrl());
    exit;
} catch (Mollie_API_Exception $e)
{
    echo "API call failed: " . htmlspecialchars($e->getMessage());
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source