#typek3

1 messages · Page 1 of 1 (latest)

remote chasmBOT
floral cosmos
tawny idol
#

That is what I thought but no, I don't see it

#
<BalanceTransaction balance_transaction id=txn_1NIz3QJ8S8EUFADrRWfXAfzY at 0x7f25b6321220> JSON: {
  "amount": -400,
  "available_on": 1686769708,
  "created": 1686769708,
  "currency": "usd",
  "description": null,
  "exchange_rate": null,
  "fee": 0,
  "fee_details": [],
  "id": "txn_1NIz3QJ8S8EUFADrRWfXAfzY",
  "net": -400,
  "object": "balance_transaction",
  "reporting_category": "transfer",
  "source": "tr_1NIz3QJ8S8EUFADrSEztAZC6",
  "status": "available",
  "type": "transfer"
}

#

The ID txn_1NIz3QJ8S8EUFADrRWfXAfzY is the one I'm getting when retreiving Transfer object with given ID.

floral cosmos
#

I think you want the Balance Transaction associated with the Payment made as a result of this Transfer, not the one on the Transfer itself.

tawny idol
#

I thought so as well

#

but ..

#

So when I expand Transfer to include payment like this:

#

stripe.Transfer.retrieve("tr_1NIz3QJ8S8EUFADrSEztAZC6", expand=["balance_transaction", "destination_payment", "source_transaction"])

#

I get the following details of destination payment:

"destination_payment": {
    "amount": 400,
    "amount_captured": 400,
    "amount_refunded": 0,
    "application": "ca_NtuQ1ea3lgLZyHnidnRN5HINpT9C70RM",
    "application_fee": null,
    "application_fee_amount": null,
    "balance_transaction": "txn_1NIz3QR5BXoTX95r9N3qX4i6",
...
}
#

(Truncated)

#

So there is ID of balance transaction txn_1NIz3QR5BXoTX95r9N3qX4i6

#

and when I try to retrieve it, I get this:

#
>>> stripe.BalanceTransaction.retrieve("txn_1NIz3QR5BXoTX95r9N3qX4i6")
stripe.error.InvalidRequestError: Request req_igjnYbr2WYx4Y8: No such balance transaction: 'txn_1NIz3QR5BXoTX95r9N3qX4i6'

#

🤯

floral cosmos
#

That's because that Balance Transaction exists on the connected account, not on your platform account. You need to make the API request on the connected account using this approach to retrieve it: https://stripe.com/docs/connect/authentication

tawny idol
#

ah, ok... let me try this

#

Ok, that works. Thank you so much! 🙏