#nathan_webhooks

1 messages ¡ Page 1 of 1 (latest)

willow furnaceBOT
#

👋 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/1267821920745689119

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

wanton pagoda
#

Hi, let me help you with this.

#

py_ is usually the transactions on the Connected account, which come from Transfers from the Platform.

#

But transfer.created event type always contains a Transfer, so you should never see a py_xxx object in it.

willow furnaceBOT
alpine anchor
#

Indeed I don't see a py_xxx object in the transfer.created body.

I see the py_xxx ID in the transfer_group property of the event (as you can see on the screenshot)

wanton pagoda
#

transfer_group can be an arbitrary string value that you provide yourself, or is generated automatically. You shouldn't refer to it except for matching to other transfer_group values

alpine anchor
wanton pagoda
#

Again, it shouldn't matter for your integration. You need to expect an arbitrary string. What are you using it for exactly?

alpine anchor
#

Indeed it makes sense

I'm using the paymentIntend ID

  • to retrieve the paymentIntent object
  • access the invoiceId of the paymentIntent object
  • retrieve the invoice to get its tax rate

If there is a more robust approach to get the tax rate I'd be glad to use it

latent horizon
alpine anchor
#

Thanks for the docs.

However I'm looking at an other approach to avoid using the paymentIntent ID int he first place.

I'm getting the paymentIntent ID from the transfer_group property of the transfer.created event. @wanton pagoda told me that I shouldn't use the transfer_group property as the value can be arbitrary.

So my problem is the following:

How can I get an invoice from the data of a transfer.created event?

Thanks for your help

latent horizon
#

Thank you for privding this context. Given that you're attempting to get more granular data from the invoice, you'd want to use the PaymentIntent ID and use the expand function to expand the invoice to get the tax data.

alpine anchor
#

Indeed, but how can I get the PaymentIntent ID if I cannot read it from the transfer_group?

latent horizon
#

You can track that on your end

alpine anchor
#

Could you elaborate more please?

latent horizon
#

You're using Separate Charges and Transfers. Before you make the request to Transfer the funds, you can keep track of what payment intents/invoices are 'included' in that transfer. Then you have that data to inspect the tax rates on those invoices.

alpine anchor
#

I'm not manually creating the Transfer. I'm updating the Subscription object with a transfer_data property and then Stripe sends me a transfer.created event automatically

latent horizon
#

You already have the subscription object so I think getting the tax information before you even make the transfer makes sense here. For instance, you can listen to invoice.paid event and inspect the tax data from there. Then, you create the transfer.