#marcus_webhooks

1 messages ยท Page 1 of 1 (latest)

untold frigateBOT
#

๐Ÿ‘‹ 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/1382811458051637339

๐Ÿ“ 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.

flat shore
#

Hi! I don't think there's an event for that. Can you tell me more about what you're trying to do?

grave meadow
#

there is this monthly sheet / document that stripe provides.. a bit hidden in the dashboard

#

it shows all the fees, as an invoice

#

my bookkeeper ahs to download this each end of month and upload to our accounting software lexware

#

I want to automize that

#

GPT told me to listen to the events:

TAX_REPORT_TYPE_UPDATED("reporting.report_type.updated"),
TAX_REPORT_RUN_SUCCEEDED("reporting.report_run.succeeded");
#

and then I should check the incoming report type

#

and skip everthing but ""tax.transactions.itemized.2"

#

but I am not so very sure this is correct

flat shore
grave meadow
#

Can this be downloaded from my backend also?

public InputStream download(ReportRun run) throws Exception {
    String fileUrl = run.getResult().getUrl();
    HttpURLConnection conn = (HttpURLConnection) new URI(fileUrl).toURL().openConnection();
    conn.setRequestMethod("GET");
    return conn.getInputStream();
}
flat shore
#

We don't generally do much with Reporting here, but I think if you listened for reporting.report_type.updated and used that to trigger running the report via API, and then listened to reporting.report_run.succeeded to know when it was available to download - and also upload to your other API - then this should work.

grave meadow
#

how will I be able to access the file (security)

flat shore
#

I don't understand the question.

grave meadow
#

well. The api gives me the url of the file. But the file is in the internet.

grave meadow
#

then I can do a http GET

#

but.. I dont think this is covered with my other credentials??

flat shore
#

I'd suggest you read the link I sent. Or ... at least the URL. ๐Ÿ™‚

#

But really: you just use your Secret Key as the user portion of the Basic Authentication, with no password.

grave meadow
#

like this:
URL url = new URL(run.getResult().getUrl());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Authorization", "Bearer " + Stripe.apiKey);

flat shore
#

You could try that, ya.

#

But you only need to set your Secret Key to the username for it to work.

grave meadow
#

ok another question -
I want to retrieve two things

  1. I need to send all incomes and credits / refunds (done from my customers in USD) - to my accounting app. What is the best way?
    A) in the StripeInvoicePaid Event Handler and CreditNoteEvent Handler.. so whenever an Invoice or CreditNote arrives
    B) Listening to the charge events
    //
    I already have the handlers in A).. but I am thinking if implementing the charge event handlers separately could give me an adnvatage?
#

For 1) - I know I need to get the PaymentIntentId, then, I need to do another call - expanded twice - to get the exchange rate of the balance transaction of the latest charge object:

public BigDecimal getExchangeRate(String paymentIntentId) {
    PaymentIntentRetrieveParams params = PaymentIntentRetrieveParams.builder()
            .addExpand("latest_charge.balance_transaction")
            .build();

    try {
        PaymentIntent paymentIntent = PaymentIntent.retrieve(paymentIntentId, params, requestOptions);
        BalanceTransaction balanceTransaction = paymentIntent.getLatestChargeObject().getBalanceTransactionObject();
       return balanceTransaction.getExchangeRate();
#

Not fully sure if correct.. but already quite complex. Maybe thats easier with the charge events / or there is some other reason to use the charge events?

flat shore
#

What accounting app do you use?

grave meadow
#

Lexware

flat shore
#

I already knew that didn't I. ๐Ÿ˜‚

grave meadow
#

well ๐Ÿ™‚

flat shore
#

I'm not familiar with that app, and it doesn't look like it has a Stripe connector already.

untold frigateBOT
flat shore
#

I would be tempted to sit down with your accountant/accounting folks and make sure you understand exactly what they do (and do not) need here, but you'll want to listen to every event that represents 'money movement', for every Stripe product/object you use.

grave meadow
#

doesn't look like it has a Stripe connector already. - no

#

it is actually the biggest one in Germany at least

#

I would be tempted to sit down with your accountant/accounting folks and make sure you understand exactly what they do (and do not) need here - they told me to get this data ๐Ÿ™‚

#

so, back to my question:

ok another question -
I want to retrieve two things

  1. I need to send all incomes and credits / refunds (done from my customers in USD) - to my accounting app. What is the best way?
    A) in the StripeInvoicePaid Event Handler and CreditNoteEvent Handler.. so whenever an Invoice or CreditNote arrives
    B) Listening to the charge events
    //
    I already have the handlers in A).. but I am thinking if implementing the charge event handlers separately could give me an adnvatage?
    For 1) - I know I need to get the PaymentIntentId, then, I need to do another call - expanded twice - to get the exchange rate of the balance transaction of the latest charge object:

    public BigDecimal getExchangeRate(String paymentIntentId) {
    PaymentIntentRetrieveParams params = PaymentIntentRetrieveParams.builder()
    .addExpand("latest_charge.balance_transaction")
    .build();

     try {
         PaymentIntent paymentIntent = PaymentIntent.retrieve(paymentIntentId, params, requestOptions);
         BalanceTransaction balanceTransaction = paymentIntent.getLatestChargeObject().getBalanceTransactionObject();
        return balanceTransaction.getExchangeRate();
    

Not fully sure if correct.. but already quite complex. Maybe thats easier with the charge events / or there is some other reason to use the charge events?

flat shore
#

I would be tempted to sit down with your accountant/accounting folks and make sure you understand exactly what they do (and do not) need here - they told me to get this data ๐Ÿ™‚

Well, we probably shouldn't make an ouroboros out of this conversation. ๐Ÿ˜‚

#

In terms of your solution there, that seems reasonable enough. It's a complex object model.

grave meadow
#

ouroboros - what?

#

I have two different options and asked which one is best!!

flat shore
#

The ouroboros is a snake that eats its own tail - an endless loop, like if your accounting folks asked you to ask me, and I asked you to ask them, and we repeated the process ad infinitum.

#

I can't tell you which one best matches your specific situation, as it depends on a lot of things, like what things from Stripe you need to record in your accounting system, and when, and how.

grave meadow
#

I need alll incoming / outgoing money from my account obviously

flat shore
grave meadow
#

the - husband - of my accountant - is a developer too.. but I am unsure how skilled - and he told me retrieve the data from charge and charge refund. So it seems this is possible. But I am not yet using these events, and I do remember i implemented the invoice paid event for a reason, I was told so here in this chat.. so I
a) he might be wrong
b) I am already using the invoice paid event anyway.. so it might be good to continue there..
but then again -
c) he might be right and I am going in the wrong or difficult direction with invoice paid / credit???

flat shore
#

That is to say: running the appropriate (for you) balance report at whatever frequency you need, and processing the results as such.

#

He's not wrong.

grave meadow
#

well the data I am sending to the accounting sofware.. the acounting software indeed creates new invoice on their end.. and since i do not have an option to send them my own invoice.. I attach my own invoice.. and this sone I create in the invoice paid handler

#

so that is a strong reason for me to use the invoice paid handler.. but what does charge offer that payment intent does not??

flat shore
#

A Charge is an 'older' object, and every successful Payment Intent will have one.

#

...And every Invoice paid with real money will have one (or more) successful PaymentIntent(s) at .payments.data.payment.payment_intent, which will itself have a Charge.

grave meadow
#

this I don't understand What you mran with "older" you mean older in the history of stripe.. or older in the history of my customers doing transactions..
//
So would you go for the charges.. or yhe invoice paid and credit_note.created ? To me it seems, these are exactly the places where money goes in or out, just in time

flat shore
#

Older in the history of Stripe.

#

Credit notes are not money movement.

#

Invoices aren't money movement - until they're paid.

But both of these, from an accrual accounting perspective, should be recognized/recorded as revenue or contra revenue when created/"the service is provided" - and then the money movement should be recorded as well when the invoice is paid or the credit note is 'applied'.

#

So the answer to this, as with most things, truly is "it depends."

#

There are also things like disputes, fees, etc. It's nontrivially complicated, and needs to be wholly thought through before you start making API calls to an accounting system.

What about downloading the report from the Dashboard that you currently download, but doing so via the Reporting API - i.e., literally automate what you're currently doing?

grave meadow
#

well - what I am currently doing is this:

For every invoice I create, send an email to my accounting@me.. email

#

then I have a batch job that moves every email attachment into the accounting software

#

same for the credit notes

#

SECOND -

#

my accountant logs into the stripe dashboard with her accountant access

#

and downloads this feees file

#

and then she does some magic with it

#

plus.. she complains that for every invoice she needs to convert all values from USD to euro

#

that takes time and she charges me for that

#

So now I want to automate that ๐Ÿ™‚

#

and hence, I feel like.. since i send the invoices and credit from right those endpoints -

#

those are also the places that I should send them directly into the app

flat shore
#

Cool, then that makes sense as a better solution to what you're currently doing.

grave meadow
#

and so, I ignored the advice from her husband - but as we know.. ignoring advice can have fatal consequences

flat shore
#

So can listening to it, to be fair.

grave meadow
#

so.. I thought ask those who know ๐Ÿ™‚

#

"So can listening to it, to be fair." what?

flat shore
#

ignoring advice can have fatal consequences

Listening to it can also have fatal consequences.

#

(is what I meant)

grave meadow
#

yes

#

thats why I came here ๐Ÿ™‚

#

because gpt also talks a lot of shit

flat shore
#

So in this situation, everyone is right and everyone is wrong and everything is made up and the points don't matter.

#

That is to say:

#

The best approach to your situaton is specific to your situation.

#

And in your situation, it sounds like listening to invoice.paid and credit_note.created (and possibly some additional Invoice and Credit Note events in case those occur too), and then putting the Invoices and Credit Notes directly into the accounting system one at a time - instead of from a batch of emails - makes sense to me.

grave meadow
#

the only thing that I am truly worried about - in stripe, it seems there are two ways to give a refund to a customer - a) a pretty prominent button next to payment - close subscription and give full refund or so.
(thats what I usally do).
And be.. on the payment, on the top right.. quite hidden - give credit note.. and then you can choose - give credit - or GIVE refund.
And, from what i remember when I implemented refunds.. I implemneted them with credit-> refunds.. as I was told this was the "proper way of doing it".
But I keep noticing that I do give just refunds by closing a subscription.. and it seems then I do not receive a refund event over my "credit_note.created" event.. and then I dont see in my app that I gave a refund.. and then I fear this could mean that I tell the tax office that I got paid and did not give a refund.. meaning I pay tax for money I never received.

#

Am I missing an event for those other "quick refunds" that I shoudl also listen to?

#

so that I can never miss any refund

#

Refunds are critical twice, because we have affiliate partners getting 30% for anything not refunded- in which case I woudl pay a 30% commission PLUS tax on money I never received ๐Ÿ˜ฆ

flat shore
#

Can you share a Credit Note ID from your Stripe Account?

#

Or any ID from any payment that got refunded via the mechanism you're describing?

grave meadow
#

let me see

#

pi_3RSu6LAfQ68zM8an1sHSe1df

#

Latest charge
ch_3RSu6LAfQ68zM8an1QfqYIza
Invoice
in_1RSu6LAfQ68zM8anmSGicRVl
Payout
po_1RTu6nAfQ68zM8anPmVU2mKG
Payout for refund
po_1RTu6nAfQ68zM8anPmVU2mKG

flat shore
#

That's fine, thank you.

grave meadow
#

and then.. there is, on the other hand "cn_1QLgd0AfQ68zM8an6voihbgD" this one is a credit note. I received it in my system and created a credit note from it.

flat shore
#

That one belongs to a different thing though - the one associated with the PI ID you shared is cn_1RTgIwAfQ68zM8anlt2kslfT

grave meadow
#

yes, this was the other example. However I saw that I have refunds in my system for both.. but i know there was some other button.. other way.. to have "small/direct" refunds.. without an attached credit note.. and I think those might never receive my backend..

flat shore
#

If you created a Refund in a way that didn't create a Credit Note, you would not get a Credit Note - that's correct.

#

Or rather: if you created a Refund in a way other than creating a Credit Note that automatically creates a Refund, you wouldn't get a Credit Note.

grave meadow
#

I found in the dashboard - if you go to a PAYMENT and click refund paytment.. I think there is no credit note

#

but.. how can I still be informed of this action and still create a credit note on my own??

#

because I keep ocasionally pressing this stupid button ๐Ÿ˜ฆ

#

(can it be removed or deactivated?! )

flat shore
#

No, it can't be removed or deactivated.

#

Why are you doing this through the Dashboard and not through your app?

grave meadow
#

if you mean an admin area.. because there is no such thing ๐Ÿ™‚

#

startup baby, startup ๐Ÿ˜„

flat shore
#

Gotcha.

grave meadow
#

"charge.refunded" seems the right one then.

#

But.. I assume that my refund based on a credit note.. would also appear there?

#

how to avoud duplicates?

#

is there a field on the refund to ask if it is connected to a credit note?

flat shore
#

Not as far as I know.

grave meadow
#

and how can I see those specific refund only, as a list, in the dashboard.. so I can check if any of those got lost on my end..

flat shore
#

If you'e going to listen to both, you'll need to figure out how to make sure you don't duplicate actions.

#

I don't know much about the dashboard to be honest - that's not really what we do here.

grave meadow
#

GPT told me ๐Ÿ™‚

#

ok. thanks.. I am long overdue

#

good night good fight

#

it even told me.. I can over the api then afterwars create the missing credit note and fix it ๐Ÿ™‚

#

(just this could get crazy with the events.. ๐Ÿ˜‰

untold frigateBOT
grave meadow
#

but.. there is a better way.. i just credit a credit note when it is missing.. this will be send to my normal handler.. or so I assume.. and then the normal flow will take over ๐Ÿ™‚

#

river good night I am out ๐Ÿ™‚

#

thanks

flat shore
#

Cheers! ๐Ÿ™‚