#JonnyJ
1 messages · Page 1 of 1 (latest)
Can you send me a request ID (req_123) from a time that you tried this?
It sounds like your code may be sending this as one string rather than pairs of values and keys
hmm..it looks like my webhook log isn't capturing request IDs
I can get that figured out and get back to you
oh, i found it sorry
req_kyoroN6v9oBFCm
Yep, I do see just one item with all of that data.
I see that the printed version of records has parentheses around it. I think in Python that means that you actually have a set here that contains a dictionary rather than just a dictionary
Is wrapping it in a set here intentional?
It's not...so to dig a little deeper the database I'm taking this from is built from grabbing all the data from a checkout session.
I tried to unpack the meta data, but that gave me a stripe error, i'll reproduce it real quick
OK, so when I unpack that, the results log like this
`
{"zip": "02131", "city": "Boston", "email": "jon@givzey.com", "honor": "", "phone": "413-374-2964", "state": "MA", "amount": "240", "address": "101 Fletcher St", "country": "United States of America", "name_last": "Jaszek", "name_first": "Jon", "designation": "", "display_name": "Buffalo State College", "organization": "buffalostate"}
`
And I get the error
`
File "/home/jjaszke/givzey-web/app/givzey.py", line 1027, in webhook
stripe.SubscriptionSchedule.modify(
File "/app/givzey/venv/lib/python3.8/site-packages/stripe/api_resources/abstract/updateable_api_resource.py", line 12, in modify
return cls.static_request("post", url, **params)
File "/app/givzey/venv/lib/python3.8/site-packages/stripe/api_resources/abstract/api_resource.py", line 64, in static_request
response, api_key = requestor.request(method, url, params, headers)
File "/app/givzey/venv/lib/python3.8/site-packages/stripe/api_requestor.py", line 122, in request
resp = self.interpret_response(rbody, rcode, rheaders)
File "/app/givzey/venv/lib/python3.8/site-packages/stripe/api_requestor.py", line 399, in interpret_response
self.handle_error_response(rbody, rcode, resp.data, rheaders)
File "/app/givzey/venv/lib/python3.8/site-packages/stripe/api_requestor.py", line 159, in handle_error_response
raise err
stripe.error.InvalidRequestError: Request req_tzkY78Qy57OLLG: Invalid object
`
Interesting we seem to just get a raw string of the whole dictionary
Can you see a way that your code may be stringifying the dictionary here? Or does it pass the raw dictionary object straight to the metadata parameter in the stripe code?
Yeah something must be happening in the transition. Right now, I'm grabbing the meta data object from the json column and sending it back to stripe. my query is
SELECT data ->> 'metadata' FROM donation where data ->> 'subscription' = %s
but I think I have enough info now to figure out what to do
might just rebuild the dictionary piece and piece
Agreed, yeah, if you can figure out how to unpack or recreate the dictionary that should solve this. Let me know if you run in to anything else here
will do thanks a lot