#codyellow

1 messages · Page 1 of 1 (latest)

restive tundraBOT
grave heath
#

What are you trying to do, exactly?

#

Those py_123 objects are charges with a different prefix for historical reasons

#

but you can retreive them via the charges api

#

if thats what you mean

stoic quartz
#

I'm trying to see if I can add more metadata on these so that my users w/ connected accounts can use this information to get logs of all their payments & customers

grave heath
#

SUre, you can also update those via the charges API to set metadata

stoic quartz
#

Is there a good lifecycle point to set metadata / description here?

For one time payments, I have calls to
Invoice.create & Invoice.pay

For subscriptions I have calls to Subscription.create

Should I be hooking into a webhook? Or is there another way to configure these params to pass along information to set on the charge?

grave heath
#

You'd likely want to do this in a webhook handler, yea

#

To read the data from where you have it and write it where you want it

stoic quartz
#

To confirm at your earlier message, py_* ids are for charges?

I'm getting troubles trying to find the object with Stripe::Charge.retrieve(py_some_id)

grave heath
#

Can you share a failing request?

stoic quartz
#

Ah I see - I'm trying something like this now. My read of the documentation is that I shouldn't need to update my Stripe.api_key and I could pass it in as a param?

Stripe::PermissionError: The provided key 'sk_test_***********************************************************************************************wDTA' does not have access to account 'py_1L6gKURV2IzD20LZsROvYaU4' (or that account does not exist). Application access may have been revoked.
from /src/figma/vendor/bundle/ruby/2.7.0/gems/stripe-5.55.0/lib/stripe/stripe_client.rb:714:in `handle_error_response'```
grave heath
#

Can you share that request ID? You may be setting the wrong account

stoic quartz
#

oops I used the wrong stripe_account! I got it now!

#

What would be the best webhook even to add my desired metadata to this you think? charge.updated?

grave heath
#

Depends on what you're trying to achieve

#

Do you have a more recent example?

#

That one is too old for me to see the events it emitted

stoic quartz
#

I don't have any offhand, though I'm effectively looking for whenever a charge is created for a connected account, update some description & metadata

restive tundraBOT
patent oasis
#

charge.succeeded might make sense for seeing when the successful charge is initially created