#tim-s_api

1 messages ยท Page 1 of 1 (latest)

sturdy raptorBOT
#

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

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

next crane
#

Hello, thanks for the info. I am not immediately sure why this may be throwing this error but am looking further and will get back with what I can find

#

Is there a specific doc you are working off of for the associating the transaction with the intent?

rotund ivy
#

Not exactly. I'm trying to make the FinancingTransaction <-> PaymentIntent association in our own back-end using the data coming from a capital.financing_transaction.created webhook. Here's that payload:

{
    "id": "evt_1SGoM22eCZlO7LNYrXAwzMUd",
    "object": "event",
    "api_version": "2024-06-20",
    "created": 1760133602,
    "data": {
        "object": {
            "id": "cptxn_1SGoM1Gfgl8ym6UAUFiWV2Yt",
            "object": "capital.financing_transaction",
            "account": "acct_1SGl4TGfgl8ym6UA",
            "created_at": 1760133601,
            "details": {
                "advance_amount": 39686, ($396.86)
                "currency": "usd",
                "fee_amount": 3969, ($39.69)
                "linked_payment": "py_1SGoLoGfgl8ym6UAasFPlDDP",
                "reason": "automatic_withholding",
                "total_amount": 43655, ($436.55)
                "transaction": {
                    "charge": "py_1SGoLoGfgl8ym6UAasFPlDDP"
                }
            },
            "financing_offer": "financingoffer_1SGnGz2eCZlO7LNYUbeQJUmJ",
            "legacy_balance_transaction_source": "flxlnpd_1SGoM1Gfgl8ym6UASCJ4nNXx",
            "livemode": false,
            "type": "payment",
            "user_facing_description": "Paydown of your loan"
        }
    },
    "livemode": false,
    "pending_webhooks": 1,
    "request": {
        "id": null,
        "idempotency_key": null
    },
    "type": "capital.financing_transaction.created"
}
#

I can see the linked_payment object as a Charge in the workbench, but I'm unable to query the listed API route directly:

#

Our system uses "2024-06-20" API, but I've tried changing that to the latest and get the same error:

#
[development]> Stripe.api_version = new_api
=> "2025-09-30.clover"
[development]> Stripe::Charge.retrieve("py_1SGoLoGfgl8ym6UAasFPlDDP")
/Users/tim/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.15.2/lib/irb.rb:406:in `full_message': No such charge: 'py_1SGoLoGfgl8ym6UAasFPlDDP' (Stripe::InvalidRequestError)
next crane
#

Can you retrieve it if you try to make this request as acct_1SGl4TGfgl8ym6UA? I am still trying to figure out exactly what happened here but I think that is worth trying in the meantime
https://docs.stripe.com/api/connected-accounts

rotund ivy
#

@next crane Adding the connected account allowed me to retrieve the charge

next crane
#

Nice!

#

Any further questions here at the moment?

rotund ivy
#

Only issue is getting the data in this way returns a blank payment_intent

#

I think I can figure it out, thank you!

next crane
#

Gotcha, I'm not seeing an intent related to that charge, so it may have to do with how that transaction was created, though I'm not that familiar with Capital so I'm not sure where to start. Let us know if you need further help digging in to this!

sturdy raptorBOT
rotund ivy
#

Yeah, even with an expand: ["payment_intent"] it returns a null payment_intent.

#

So I think I'm still unable to make the Charge <-> PaymentIntent connection, any assistance with that would be much appreciated. Not seeing anything in the API docs, but it's strange payment_intent: null is included, since the charge definitely originated from a payment intent.

next crane
#

Do you have the ID of that intent on hand?

rotund ivy
#

It should be this one: pi_3SGoL52eCZlO7LNY0vUoHGgx

feral prawn
#

๐Ÿ‘‹ Hello, I'm taking over for Pompey. Just getting caught up.

#

You are trying to retrieve the charge and connect it back to the Payment Intent?

#

Looks like Charge py_3SGoL52eCZlO7LNY0dnYU9t is associated with Payment Intent pi_3SGoL52eCZlO7LNY0vUoHGgx

rotund ivy
#

Hi, so I'm working on integrating Stripe Capital and tracking Financing Transactions. When a Financing Transaction (type=payment) is created as a result of automatic loan payment withholding, I want to be able to associate that with a Payment Intent.

#

There's an example financing transaction payload above, but the only associated payment-related data is the "linked_payment": "py_1SGoLoGfgl8ym6UAasFPlDDP"

#

So far the only option I've found is stripe charges retrieve py_1SGoLoGfgl8ym6UAasFPlDDP --expand="source_transfer.source_transaction" --stripe-account="acct_1SGl4TGfgl8ym6UA"

#

Which is quite a long path: Financing Transaction -> Linked payment (charge) -> Source Transfer -> Source Transaction -> Payment Intent

#

^^ This unblocks me, unless you can see some problem with relying on this path. However I was expected there to be a more direct relationship between the automated withholding transaction and the Payment Intent that triggered it.

feral prawn
#

I don't forsee any issues relying on this path. I'm also no seeing a more straight forward path, though admittedly I'm not incredibly familiar with Stripe Capital

rotund ivy
#

Thanks for taking a look!

feral prawn
#

Of course!