As stated in the issues on Laravel Cashier. It does not state how to add meta data to invoices/charges.
Auth::user()->invoiceFor('Stickers', 500, ['metadata' => ['VAT' => 'TEST']]);
After following how to do this based off the issue, as seen above, it successfully creates the invoice however, the meta data is not added.
How can I add meta data?
You may pass meta data to the fourth parameter of invoiceFor()
.
The third parameter is an array of options for the invoice item whereas the other one is also an array of options but for the invoice itself.
$user->invoiceFor('Stickers', 500, [], [
'tax_percent' => 20,
'metadata' => [
'custom-option' => 'value',
]
]);