diff --git a/examples/sales-invoices/create-sales-invoice.php b/examples/sales-invoices/create-sales-invoice.php new file mode 100644 index 000000000..ffdc52159 --- /dev/null +++ b/examples/sales-invoices/create-sales-invoice.php @@ -0,0 +1,51 @@ +salesInvoices->create([ + 'currency' => 'EUR', + 'status' => SalesInvoiceStatus::DRAFT, + 'vatScheme' => 'standard', + 'vatMode' => 'inclusive', + 'paymentTerm' => PaymentTerm::DAYS_30, + 'recipientIdentifier' => 'XXXXX', + 'recipient' => [ + 'type' => 'consumer', + 'email' => 'darth@vader.deathstar', + 'streetAndNumber' => 'Sample Street 12b', + 'postalCode' => '2000 AA', + 'city' => 'Amsterdam', + 'country' => 'NL', + 'locale' => 'nl_NL' + ], + 'lines' => [ + [ + 'description' => 'Monthly subscription fee', + 'quantity' => 1, + 'vatRate' => '21', + 'unitPrice' => [ + 'currency' => 'EUR', + 'value' => '10.00' // Corrected the format from '10,00' to '10.00' to match typical API expectations + ] + ] + ] + ]); + + echo "
New sales invoice created with ID: " . htmlspecialchars($salesInvoice->id) . "
"; +} catch (\Mollie\Api\Exceptions\ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); +} diff --git a/examples/sales-invoices/delete-sales-invoice.php b/examples/sales-invoices/delete-sales-invoice.php new file mode 100644 index 000000000..3b154b802 --- /dev/null +++ b/examples/sales-invoices/delete-sales-invoice.php @@ -0,0 +1,25 @@ +salesInvoices->delete($invoiceId); + + echo "Sales invoice deleted with ID: " . htmlspecialchars($invoiceId) . "
"; +} catch (\Mollie\Api\Exceptions\ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); +} diff --git a/examples/sales-invoices/list-sales-invoices.php b/examples/sales-invoices/list-sales-invoices.php new file mode 100644 index 000000000..49d6d3611 --- /dev/null +++ b/examples/sales-invoices/list-sales-invoices.php @@ -0,0 +1,28 @@ +'; + $salesInvoices = $mollie->salesInvoices->page(); + foreach ($salesInvoices as $invoice) { + echo 'Sales invoice updated with ID: " . htmlspecialchars($updatedInvoice->id) . "
"; +} catch (\Mollie\Api\Exceptions\ApiException $e) { + echo "API call failed: " . htmlspecialchars($e->getMessage()); +}