2

I am developing a patreon app which can get info from patreon and get tier spots_count and if spots_count is less than 4 than add more spots. From the help of

API Docs https://docs.patreon.com/

GitCode https://github.com/Patreon/patreon-php

I have prepared a code

<?php session_start();
 require_once __DIR__.'/vendor/autoload.php';

use Patreon\API;
use Patreon\OAuth;

$access_token = $_SESSION['access_token'];
$refresh_token = $_SESSION['refresh_token'];

// Get your campaign data
// $campaign_response = $api_client->fetch_campaign();
// $campaign_id = $campaign_response->get('data.0.id');

    // Make an OAuth client
    $client_id = 'client_id';
    $client_secret = 'client_secret';
    $oauth_client = new Patreon\OAuth($client_id, $client_secret);
    // Get a fresher access token
    $tokens = $oauth_client->refresh_token($refresh_token, null);
    print_r($tokens);
    $_SESSION['access_token'] = $tokens['access_token'];
    $_SESSION['refresh_token'] = $tokens['refresh_token'];
    $access_token = $_SESSION['access_token']; // Your Creator Access Token
    $refresh_token = $_SESSION['refresh_token'];
    $api_client = new Patreon\API($access_token);
    // $campaign_response = $api_client->fetch_campaign_details(7510630)['data']['relationships']['tiers']['data'][1];
    $campaign_response = $api_client->fetch_campaign_details(campaign_id);
    print_r($campaign_response);

I am able to get compaign info and tier_ids but i couldn't find any way to view tier_spots and any way to update that through API.

Please help me with that.

The IRF
  • 470
  • 3
  • 13

0 Answers0