customers->page(null, 1)[0]; /* * Generate a unique subscription id for this example. It is important to include this unique attribute * in the webhookUrl (below) so new payments can be associated with this subscription. */ $subscriptionId = \time(); /** * Customer Subscription creation parameters. * * @See: https://docs.mollie.com/reference/v2/subscriptions-api/create-subscription */ $subscription = $customer->createSubscription(["amount" => [ "value" => "10.00", // You must send the correct number of decimals, thus we enforce the use of strings "currency" => "EUR", ], "times" => 12, "interval" => "1 month", "description" => "Subscription #{$subscriptionId}", "webhookUrl" => "{$protocol}://{$hostname}{$path}/webhook.php", "metadata" => ["subscription_id" => $subscriptionId]]); /* * The subscription will be either pending or active depending on whether the customer has * a pending or valid mandate. If the customer has no mandates an error is returned. You * should then set up a "first payment" for the customer. */ echo "
The subscription status is '" . \htmlspecialchars($subscription->status) . "'.
\n"; echo "";
echo '18-cancel-subscription
';
echo "