Snippet

Stripe VAT Tax configuration

php
collect(Http::get('https://raw.githubusercontent.com/ibericode/vat-rates/master/vat-rates.json')->json()['items'])->map(fn ($rate) => $rate[0]['rates']['standard'])->each(function ($percentage, $country) {
    \Stripe\TaxRate::create([
        'display_name' => 'VAT',
        'percentage' => $percentage,
        'inclusive' => false,
        'jurisdiction' => $country,
        'description' => 'VAT for ' . locale_get_display_region('-' . $country, 'en')
    ]);
});

Context

Stripe offers a simple tax system to apply taxes to your products, so simple that it doesn't include any default values. Running this snippet adds each country's VAT data to your Stripe account, so you can start handling VAT payments with their system.

Enjoyed the article? Consider sharing it on Twitter so others can enjoy it too :)

Share on Twitter

Receive project updates, article drafts & thoughts on your inbox every saturday.

Subscribe →