#stripe

/

      • alex512
        I've had created a .php file that contains the checkout, I can see the button, but it's the charge creating that I don't understand.
      • tr12
        alex512: another thing that might work is a 3rd party integration that only requires frontend code
      • alex512
        Do you have any recommandations?
      • tr12
      • mattwc (who hangs around in this channel sometimes) maintains it
      • mattwc
        Howdy
      • tr12
        hi hi
      • gilmoregirl joined the channel
      • skyloath
        tr12: it's a bit confusing, so you're saying i can't call the standard api call: `stripe.Event.retrieve("evt_1ADqRbFYGrqwPVpiDNnr3FHG")` if i want to verify a connect account type event exists?
      • tr12
        skyloath: those events are being delivered to your connect webhook endpoint
      • skyloath
        tr12: correct
      • tr12
        any events delivered to that endpoint also have a `user_id` property which indicates what stripe account the event exists on
      • Chris_m
        @skyloath have you set the managed account webhook in the web console?
      • gilmoregirl has quit
      • theomo
        tr12, got logging working.
      • var_dump is empty.
      • tr12
        \o/
      • nuuu
      • theomo
        -.-
      • Chris_m
        @skyloath Its actually called connect webhook and the other is account webhook
      • tr12
        empty as in literally nothing?
      • theomo
        tr12 are you a stripe dev?
      • Literally nothing
      • tr12
        theomo: yes
      • ldrivo has quit
      • theomo
        tr12 awesome!
      • tr12
        theomo: just to smoke test, if you do var_dump("potato"); do you get anything?
      • Chris_m
      • theomo
        tr12 nope"
      • skyloath
        tr12 Chris_m: to be clear ive setup a webhook for "Endpoints receiving events from Connect applications" to lsiten for events on prod with type: `account.updated`. the docs here (https://stripe.com/docs/webhooks) specify that i can call `event = stripe.Event.retrieve(event_json["id"])` to verify the event. but what you're saying tr12 is i have to instead call the get eevent on the managed account?
      • tr12
        theomo: how about error_log("potato"); ?
      • alex512 has quit
      • theomo
        tr12, yep works.
      • bed666 has quit
      • tr12
        wat
      • theomo
        var_dump is empty.
      • tr12
        ok, whatever
      • theomo
        json_decode is simply not working
      • The module is installed + enabled in php
      • tr12
        let's do something like error_log(var_export(the thing you want to look at));
      • Chris_m
        @skyloath How are you triggering the account update? are you using a live api key? Can you see the webhook in the web console?
      • the log
      • tr12
        skyloath: those docs are talking about non-connect webhooks - for webhooks about connected accounts, you need to fetch the event from the account it exists on
      • skyloath
        Chris_m: I'm doing it from a python shell with a live api key. i can see the endpoint set in the webhook console
      • theomo
        tr12 blank.
      • skyloath
        tr12: how do i do that, is there a doc for it?
      • tr12
        stripe.Event.retrieve(id, stripe_account="acct_***") will do this
      • Chris_m
        I mean if you go in your web console and sign in as the user do you see the webhook was delivered in the log of events?
      • tr12
        you'd get the account ID with event.user_id
      • GoJoe__ has quit
      • skyloath
        Chris_m: yes the webhook is delivered, that's not the issue.
      • theomo
        tr12 I think var_dump/export isn't doing what it should be.
      • skyloath
        tr12: okay, once ive got the id. how do i make the api call to get all events for a speicifc managed account
      • Chris_m
        I know but I am just making sure you have actually triggered an account update
      • event = stripe.Event.retrieve(event_json["id"])
      • skyloath
        Chris_m: sure, well yeah i've done that. i think what tr12 is saying makes sense, just not sure why its not easily documented/how to even do it
      • tr12
        skyloath: you can list events with: https://stripe.com/docs/api#list_events
      • all api methods take a stripe_account param to indicate that the request should be executed on a specific account
      • Chris_m
        I am doing this in Go, I receive the event in my webhook server and then I call the stripe server to pull the event with the ID to verify.
      • tr12
        skyloath: so you can run the standard event list acll + stripe_account to list events on a particular acount
      • skyloath
        tr12: `events = stripe.Event.list(stripe_account=<managed_account_id>, limit=3) ` ?
      • then il have to iterate through that to find a match
      • tr12
        didn't you say you wanted all events for that account?
      • skyloath
        tr12: no, i just want to verify the event that i receivve on a webhook (regardless of whose account it belongs to) is legitimate
      • tr12
        then just the retrieve call from before will do
      • Chris_m
        @skylaoth I take it you have read the api docs here https://stripe.com/docs/api#retrieve_event
      • skyloath
        tr12: stripe.Event.retrieve(event_json["id"]) but that doesn't work for me
      • mattwc
        you need to authenticate the api call as the connected account
      • Chris_m
        import stripe stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" stripe.Event.retrieve("evt_1ADqFT2eZvKYlo2CzTKlwGyp")
      • mattwc
      • skyloath
        guys, i appreciate the help but my answers have already indicated that i've set the api key, received a webhook event, called the retrieve api call
      • and failed at that point
      • tr12
        skyloath: backing up a bit
      • did you try passing stripe_account?
      • skyloath
        tr12: nope, i just did stripe.Event.retrieve(event_json["id"])
      • tr12: based on what you said i imagine i should pass that in?
      • deadghost_ joined the channel
      • tr12
        try stripe.Event.retrieve(event_json['id'], stripe_account=event_json['user_id'])
      • Shilon joined the channel
      • skyloath
        tr12: trying now
      • deadghost has quit
      • tr12: ok that worked perfectly!
      • tr12: thanks!
      • tr12
        np!
      • theomo
        tr12
      • I'm stumped.
      • tr12
        theomo: gah, sorry
      • I lost you in the backscrolll
      • theomo
        Don't worry about it :)
      • tr12
        can you try outputting gettype / get_class?
      • theomo
        stdClass
      • object
      • tr12
        huh
      • so that is actually what you'd expect to get back
      • theomo
        lol
      • tr12
        how about error_log(var_export($event_json))?
      • lenochka_ joined the channel
      • theomo
        tr12 - empty!
      • tr12
        the empty string?
      • Peder_ has quit
      • theomo
        It's just empty.
      • Doesn't return anything
      • tr12
        how about error_log("foo: " + var_export($event_json));
      • theomo
        returns 0
      • wtf
      • ah wait
      • tr12
        egh, sorry
      • theomo
        need a . not +
      • tr12
        yeah
      • friggin php
      • theomo
        Yeah, just the foo:
      • Then blank
      • haha fun eh!
      • tr12
        mm
      • CyberBully is now known as jq
      • theomo
        I'm so confused.
      • mattwc
        theomo: you're testing with POST requests right not just get requests in your browser?
      • theomo
        Yes
      • lenochka_ has quit
      • I'm firing test webhooks to my php file which is just logging on the backend
      • I'm using codeigniter, if that makes any difference.
      • tr12
        theomo: and error_log($input) outputs a reasonable value?
      • theomo
        Yes
      • tr12
        I think you checked this before
      • theomo
        It shows the JSON perfectly
      • tr12
        but I'm losing my mind here
      • theomo
        Me too!!
      • I've validated the JSON received in $Input. It's 100% valid.
      • mattwc
        and how are you setting $event_json?
      • tr12
        hrm
      • theomo
        $event_json = json_decode($input);
      • tr12
        could you do something like $event_json = json_decode('{"foo": "bar"}'); ?
      • theomo
        empty.
      • Weird
      • json_decode not working. at all?
      • tr12
        is there some spooky action at a distance that could stomp the function?
      • Chris_m
        lol
      • tr12
        redefine it or something?
      • I forget if php will let you do that
      • I suspect it will, because lol php
      • theomo
        function is endpoint()
      • Chris_m
        I hate php :)
      • theomo
        haha what should I switch to?
      • tr12
        the json_decode function, I mean
      • theomo
        ah
      • Chris_m
        Python Java anything is better than Php
      • tr12
        perl?
      • Chris_m
        nooooo
      • lol
      • html