stripe-php icon indicating copy to clipboard operation
stripe-php copied to clipboard

Get Tax Id List Supported by Stripe

Open talha-core opened this issue 1 year ago • 2 comments

I think it would be nice if just have the function to get the list of supported tax types as an array

talha-core avatar Aug 13 '24 11:08 talha-core

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 13 '24 11:08 CLAassistant

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Aug 13 '24 11:08 CLAassistant

This file is autogenerated and we can't add this method to the TaxId resource. However you could use the following snippet in your code to get the list of all TaxID.

function getTaxIds()
{
    $taxIdClass = new ReflectionClass(\Stripe\TaxId::class);

    return array_filter($taxIdClass->getConstants(), function ($key) {
        // For PHP 8+
        return str_starts_with($key, 'TYPE_');
        // For PHP 7 or older
        // return substr($key, 0, 5 ) === "TYPE_";

    }, ARRAY_FILTER_USE_KEY);
}

prathmesh-stripe avatar Apr 15 '25 19:04 prathmesh-stripe