#Sudarshanan G

1 messages ยท Page 1 of 1 (latest)

neon oliveBOT
tawny crag
#

I'm trying to create a payment intent with some amount. And I need to add tax for that intent.

#

but couldn't able to add one

#

also tried to create a invoice and capture the payment intent. But payment intent is always null.

cunning plinth
#

Do you want to add a custom tax amount you calculated yourself?

#

Asking because Stripe has StripeTax which offers you auto tax calculation

tawny crag
#

no I created tax in stripe and need to add that tax id to particular payment intent

cunning plinth
tawny crag
#

yes

cunning plinth
#

That's just an API Reference. Which part you followed for the Tax?

tawny crag
#

here is my code

   $invoiceItem = InvoiceItem::create([
        'amount' => $request->amount * 100,
        'currency' => $request->currency,
        'customer' => $request->customer_id,
        'description' => $request->description,
        'tax_rates' => ['txr_1NVaMLDrfiUMVUSSJsSTuhzn'] // Associate the tax rate with the Invoice Item
    ]);

    \Log::info($invoiceItem);

    // Create the Invoice
    $invoice = Invoice::create([
        'customer' => $request->customer_id,
        'collection_method' => 'charge_automatically', // Automatically charge the customer
        // 'due_date' => $invoiceItem->date + (60 * 60 * 24 * 30),
        'auto_advance' => true // Automatically mark the invoice as paid after successful payment
    ]);
neon oliveBOT
full linden
tawny crag
#

I tried to get payment intent from invoice response after creating invoice

full linden
#

You need to wait until the invoice get finalized, or finalize it via the API

tawny crag
#

Oh!! thanks I missed this out.๐Ÿ‘