How can I get patrons with the API?

Hi. I’m trying to implement a patron status check on my website. I want to periodically run this check via cron. The system will take a patron, then make a request to the Patreon API and check if it is an active patron. What is the best way to do this?

Depends. Do you need to do this live, right at the time a patron is logged into your website? Or is it a background process?

Background process. I need up-to-date information even if the user is not logged in. I want to do this with a cron on the server (check patrons once an hour).

If this is your campaign, just use your creator access token to pull your patrons by paginating your members list.

If this is not your campaign, then you will need to get creators to authorize your app by asking the campaigns scope during authorization. Then you can use their individual tokens to pull their individual campaigns.

Yes, this is my campaign. It turns out that I will take the token for the creator here
API Reference (manually via the button)

Then save the token in the database. And then use the token to access the patrons data here

This is right?

Yep. That’s right. Your apps are listed in the below page:

I am using this library

Is it possible to get users through it?

As for the access token. Here Patreon i see Creator access token. Do I need to use it in queries for a company? I see that it is becoming obsolete, it may not be very convenient (updating manually on the server). Do I need to refresh the token programmatically? It looks bad, there are so many actions for such a simple integration:) Usually APIs work much easier.

Creator’s access token allows you to access all the details of your campaign, its members and their membership info without having any users to authorize your application - just like I posted in the other thread.

I am using creator’s access token from here Patreon in the library. I call this way

    public function getPatrons()
        $api = new API(config('patreon.access_token'));


I’m getting null in response. What am I doing wrong? Which API class method should I use to get my company’s patrons? Thanks for the help!

Are you using Laravel? Try to confirm that no Laravel package interferes with the outgoing call.

Yes, I am using Laravel. How can this be checked?

I’m using the API class for authorization through Patreon. And there these classes work without problems. It turns out that no package interferes with requests. This code works:

        $patron->access_token = $access_token;
        $patron->refresh_token = $refresh_token;

        $api_client = new API($access_token);

        $api_client->api_return_format = 'object';

        $patreonUser = $api_client->fetch_user();

Can you try making the same call using the PHP library outside Laravel and see if that makes any change?

I write this in an empty PHP project and I get NULL in response


require_once __DIR__.'/vendor/autoload.php';

use Patreon\API;

$accessToken = 'token';

$response = (new API($accessToken))->fetch_campaigns();


Could there be something wrong with my token?

I think I understand … I’m from Russia, Patreon is blocked with us. Is it possible to make a request without blocking?

No, it turns out Patreon is not blocked in Russia. Perhaps the problem is in the token? I am using a token from my Patreon account, not after oauth authorization (as in the package example).

You can use your creator’s access token to access your campaign and its members.

But if you are trying to access another campaign’s info, or another campaign’s patron’s info, you will need to have them authorize your app with the correct scopes (permissions) for your app. Then you can use that specific token to make a call.

Basically, make sure that the token that you are using has access to the account that you are trying to access, and it has the correct scopes to access the fields that you want.

I am using the token from here Patreon. I created an application where there is a token, a refresh token and a secret word. The company belongs to me and everything is done in my account. Is it that token? Is this the token I should use in the API class or some other one?

That depends on whether the patrons (or other creators) will log into your app and do things with your app.

If they won’t, yes, you can use the token in your account.

This is how I use and get null in the response :slight_smile: This is the problem.