Hello I been trying to work on the api Oauth for a couple of months, and I just can’t make heads or tails of it. I am just trying to be able to have a button that one would click that would connect to patreon, get their current pledge level, and save it in my database. I been using PHP. Can I have some help maybe?
Hey there! We recently updated our documentation to live at http://docs.patreon.com - please let me know if those aren’t good enough - and if you have suggestions we’d love you to make an issue or a pull requests on the docs source directly! https://github.com/Patreon/platform-documentation
We admittedly make mistakes and do confusing things all the time, so if you need help on something that doesn’t make sense, we’re standing by at platform@patreon.com to help you directly if you need that.
-Tal
Thanks! I understand, and still trying to decipher it. I don’t think it is a problem with the documentation itself, as much as it is with me. I am much stronger with html/css than I am with any programming language that is current.
I sent an email in hopes that perhaps more information could be shared.
Hi YFTechno,
It’s not really a task you would immediately want to try and tackle if you aren’t too familiar with PHP or the likes.
A first step would be to understand OAuth and how the information flows from your server to Patreon and back again: https://aaronparecki.com/oauth-2-simplified/
Once you are familiar with how oauth works, it should hopefully make a bit more sense
I for the most part understand how it OAuth works (though I will read what you posted, just in case I am mistaken). And I would love not want to do it, but I really need it to work, so I am trying my best for it.
My biggest issue is I am not understanding how to get the information I need from the request? Like I said, I am just trying to be able to get the user’s tier.
Will continue in research though, thanks!
Hey YF, this should help you - its adapted from the code @ https://github.com/Patreon/patreon-wordpress/blob/master/classes/patreon_wordpress.php
But it is the way to fetch a pledge object from the api response. Substitute XXXXXXXXXXXXX with your creator ID.
$user_response is the response from the Patreon API after you have already got a token to work with.
<?php
$pledge = false;
if (array_key_exists('included', $user_response)) {
foreach ($user_response['included'] as $obj) {
if ($obj["type"] == "pledge" && $obj["relationships"]["creator"]["data"]["id"] == XXXXXXXXXXXXX) {
$pledge = $obj;
break;
}
}
}
var_dump($pledge);
?>
Hope this answers your question!
sorry the formatting is really hard here
Hey all! Cool news. ~10 days ago we created a forum for anyone using the API (creators and developers/partners) to converse - should be a faster place to get responses and see others’ questions:
That is good to know, I will have to check it out!
We’ve also been fighting with oauth, what we have found is that it is easier (if I am correct in assuming you are also trying to get similar data to what we are trying to get) to just run a headless browser to log in as you and grab your patron list to parse.