Tax rate applied to Stripe Payment Intent

Is it possible to add a fixed tax rate of 19% to each Payment Intent using the Stripe API?

I have the tax rate stored under txr_9uuad8a9sud89

I create Payment Intents using the following code:

$intent = \Stripe\PaymentIntent::create([
            'payment_method' => $paymentMethods["data"][0]["id"],
            'amount' => 11111,
            'currency' => 'eur',
            'customer' => $user->stripe_id,
            'confirmation_method' => 'automatic',
            'confirm' => true,
        ]);

Can someone help me find a way to automatically apply the 19% tax rate to each Payment Intent?

Yes, it is possible to add a fixed tax rate of 19% to each Payment Intent using the Stripe API. You can do this by adding the tax rate ID to the application_fee_amount parameter in the Payment Intent create call.

Here is the updated code:

$intent = \Stripe\PaymentIntent::create([
            'payment_method' => $paymentMethods["data"][0]["id"],
            'amount' => 11111,
            'currency' => 'eur',
            'customer' => $user->stripe_id,
            'confirmation_method' => 'automatic',
            'confirm' => true,
            'application_fee_amount' => 2110, // This represents the 19% tax on the amount
            'application_fee_currency' => 'eur',
            'transfer_data' => [
                'destination' => 'acct_XXXXXXXXXXXXX', // Replace with your own account ID
            ],
            'tax_rates' => [
                'txr_9uuad8a9sud89', // Replace with your own tax rate ID
            ],
        ]);

Note: The application_fee_amount parameter represents the total amount of the payment, including the tax. In this example, we are adding 19% tax to an amount of 11111, which results in a total of 13221. The application_fee_amount is set to 2110, which is the tax amount (19% of 11111).