* 5. Fetch the current merchant's pre-authorizations * 6. Create a bill under a pre-authorizations * 7. Repeat steps 4 and 5 with a new GoCardless_Client object * */ // Include library include_once '../lib/gocardless.php'; // Sandbox GoCardless::$environment = 'sandbox'; // Config vars for your PARTNER account $account_details = array('app_id' => null, 'app_secret' => null, 'access_token' => null, 'merchant_id' => null); $gocardless_client = new GoCardless_Client($account_details); if (isset($_GET['code'])) { $params = array('client_id' => $account_details['app_id'], 'code' => $_GET['code'], 'redirect_uri' => 'http://localhost/examples/demo_partner.php', 'grant_type' => 'authorization_code'); // Fetching token returns merchant_id and access_token $token = $gocardless_client->fetch_access_token($params); $account_details = array('app_id' => null, 'app_secret' => null, 'access_token' => null, 'merchant_id' => null); $gocardless_client = new GoCardless_Client($account_details); echo '<p>Authorization successful! <br />Add the following to your database for this merchant <br />Access token: ' . $token['access_token'] . ' <br />Merchant id: ' . $token['merchant_id'] . '</p>'; } if ($account_details['access_token']) { // We have an access token echo '<h2>Partner authorization</h2>'; echo '<p>Access token found!</p>'; echo '$gocardless_client->merchant()'; echo '<blockquote><pre>'; $merchant = $gocardless_client->merchant(); print_r($merchant);