#marcus_api

1 messages ยท Page 1 of 1 (latest)

frozen aspenBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1397843179633512568

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

tawdry mica
#

I don't think API version matters, but can you provide the Payment Intent Id pi_xxx you are looking at?

viral kiln
#

I am not looking at any payment intent. I am trying to find out if a refund amount is with or without tax.

#

the api docs do not say that

#

{
"id": "re_1Nispe2eZvKYlo2Cd31jOCgZ",
"object": "refund",
"amount": 1000,
"balance_transaction": "txn_1Nispe2eZvKYlo2CYezqFhEx",
"charge": "ch_1NirD82eZvKYlo2CIvbtLWuY",
"created": 1692942318,
"currency": "usd",
"destination_details": {
"card": {
"reference": "123456789012",
"reference_status": "available",
"reference_type": "acquirer_reference_number",
"type": "refund"
},
"type": "card"
},
"metadata": {},
"payment_intent": "pi_1GszsK2eZvKYlo2CfhZyoZLp",
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": null
}

#

This is a sample from the docs

tawdry mica
#

The PI didn't have any tax, so the Refund doesn't too

viral kiln
#

ah! And if the PI has tax.. will there be a separate tax field?

#

My question is just if the amount is - potentially - with tax, the GROSS amount, or the net amount

tawdry mica
#

There isn't any tax here, so that's the gross amount. You customer get back exactly $10 as they paid

viral kiln
#

to repeat. This was just an example.

tawdry mica
#

However, your Stripe fee $0.59 doesn't come back, so it's a net minus on your side

viral kiln
#

Assume there was tax involved, will it still be the gross amount?

tawdry mica
#

If PI was tax-included amount, refund would be so too. Refund amount is always = the amount customer paid

viral kiln
#

ok so the gross amount. Does the refund show somewhere the tax part.. I guess not?
How do I find the default tax rate of the customer starting from the refund, in the best/easiest way?

#

so that I can calculate the next amount from the given refund gross amount

tawdry mica
#

It's going back to the PaymentIntent. You can find the linked PaymentIntent and the Tax information there if any. It also depends on how you use Tax on PaymentIntent in the first place

viral kiln
#

{
"id": "pi_3MtwBwLkdIwHu7ix28a3tqPa",
"object": "payment_intent",
"amount": 2000,
"amount_capturable": 0,
"amount_details": {
"tip": {}
},
"amount_received": 0,
"application": null,
"application_fee_amount": null,
"automatic_payment_methods": {
"enabled": true
},
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic",
"client_secret": "pi_3MtwBwLkdIwHu7ix28a3tqPa_secret_YrKJUKribcBjcG8HVhfZluoGH",
"confirmation_method": "automatic",
"created": 1680800504,
"currency": "usd",
"customer": null,
"description": null,
"last_payment_error": null,
"latest_charge": null,
"livemode": false,
"metadata": {},
"next_action": null,
"on_behalf_of": null,
"payment_method": null,
"payment_method_options": {
"card": {
"installments": null,
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
},
"link": {
"persistent_token": null
}
},
"payment_method_types": [
"card",
"link"
],
"processing": null,
"receipt_email": null,
"review": null,
"setup_future_usage": null,
"shipping": null,
"source": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "requires_payment_method",
"transfer_data": null,
"transfer_group": null
}

#

so where is the tax rate there.. can't find it in this example

#

Can't find it in the whole doc either for payment intent

tawdry mica
#

I don't see any tax rate here. You probably didn't create it with tax rate

viral kiln
#

to repeat. this is just an example. I am reading the general docs.. and Payment Intent for basil 2025-06 does not mention the existance of anything tax related on payment intent

tawdry mica
#

Yes because basically PaymentIntent and tax is not directly related. Tax rate or Stripe Tax is only applicable to Checkout Session, for example.

viral kiln
#

so.. How can I get the tax rate.. starting from the refund...

#

Do I have to get the invoice maybe?

tawdry mica
#

Find the PaymentIntent of the Refund, then find the Invoice of the PaymentIntent (if existed)

viral kiln
#

Can there ever be a refund without an invoice??

tawdry mica
#

Can, if you just created a standalone PaymentIntent.

#

There is only one case you will have tax information in that case, thay you are using Tax Calculation API with PaymentIntent. You will find it in the PaymentIntent

frozen aspenBOT
viral kiln
#

ok.. I never create a standalone Payment Intent (in the given context).

So if I have the invoice - How can I find out:

  1. The Taxrate the customer is bound to - in my case no tax - 0 or full tax - 19.
  2. The id of the tax object.

I need this for - from the refund gross amount, I want to calculate the next amount, then calculate the taxt amound and tax rate
and tax stripe object id - so that I can build a new credit note and attach it to the standalone refund (which is stanalone in my case as I found out earlier)

drowsy lodge
#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

viral kiln
#

There are many fields related to tax as I can see in the stripe api docs:

automatic_tax
customer_tax_exempt
customer_tax_ids
default_tax_rates
total_taxes

drowsy lodge
viral kiln
#

I don't understand. I have an invoice, I want to know which tax ids it used, which tax rate and which tax amountds

drowsy lodge
#

it depends on whether you're using Stripe Tax (automatic) or Tax Rates

viral kiln
#

I think I am using tax rates

drowsy lodge
#

if you just want the amount of taxes paid on an invoice it's the total_taxes field

viral kiln
#

so my customers have either 0 % tax enrtirely, or 19%,
Where in total taxes do I find this 0/19 number?
where in total taxes do I find the tax rate id that I need to use to set it up again?
Because.. getting to the root of my problem - I have a refund that accidentally was created without a credit note. We always need credit notes - so
I am attempting to create an automatic "fix system" that creates a correct credit note and attaches the lonely refund to it.
For this, it seems I need all this info, as the refund does not have it, just the gross amount

#

"total_taxes": [
{
"amount": 95,
"tax_behavior": "exclusive",
"tax_rate_details": {
"tax_rate": "txr_1HwVi5AfQ68zM8anHf3Zr456"
},
"taxability_reason": "not_available",
"taxable_amount": 500,
"type": "tax_rate_details"
}

#

so one is probably this:
tax_rate": "txr_1HwVi5AfQ68zM8anHf3Zr456"

#

wait.. default tax rate in the invoice might be even better for me?

  "default_tax_rates": [
    {
      "id": "txr_1HwVi5AfQ68zM8anHf3Zr456",
      "object": "tax_rate",
      "active": true,
      "country": null,
      "created": 1607532013,
      "description": null,
      "display_name": "Tax",
      "effective_percentage": null,
      "flat_amount": null,
      "inclusive": false,
      "jurisdiction": null,
      "jurisdiction_level": null,
      "livemode": true,
      "metadata": {
      },
      "percentage": 19,
      "rate_type": "percentage",
      "state": null,
      "tax_type": null
    }
  ],
#

But in another example, where the customer did not pay any tax, I see:

 "total_taxes": [
  ],

yet, the default tax rate of the invoice still says the same:

  "default_tax_rates": [
    {
      "id": "txr_1HwVi5AfQ68zM8anHf3Zr456",
      "object": "tax_rate",
      "active": true,
      "country": null,
      "created": 1607532013,
      "description": null,
      "display_name": "Tax",
      "effective_percentage": null,
      "flat_amount": null,
      "inclusive": false,
      "jurisdiction": null,
      "jurisdiction_level": null,
      "livemode": true,
      "metadata": {
      },
      "percentage": 19,
      "rate_type": "percentage",
      "state": null,
      "tax_type": null
    }
  ],
drowsy lodge
#

yes but you need to look at the total taxes to see what was actually applied for this customer

#

not what you applied as a tax rate

viral kiln
#

so.. do I need to check both the fields - first total taxes - to see - WAS tax applied? And then - default tax rate - to see - what is the percentage of tax?

drowsy lodge
#

in the total taxes you have the tax rate details

#

and you could then get the information based on the ID

viral kiln
#

you mean by making just another call based on the tax rate id.. well I am tring to limit the amount of calls I am doing ๐Ÿ™‚

drowsy lodge
#

or you can check the tax ID in the tax_rates array

viral kiln
#

I assume you mean "default_tax_rates"?

drowsy lodge
#

yes