Skip to content

Instantly share code, notes, and snippets.

@timrogers
Created May 28, 2013 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timrogers/5663410 to your computer and use it in GitHub Desktop.
Save timrogers/5663410 to your computer and use it in GitHub Desktop.
<?php
GoCardless::$environment = 'sandbox'; // Whilst you're testing...
$account_details = array(
'app_id' => 'app id',
'app_secret' => 'app secret',
'merchant_id' => 'merchant id',
'access_token' => 'access token'
);
GoCardless::set_account_details($account_details);
$bill_details = array(
'amount' => $_POST['amount'], // You might want to do some filtering on this first to check it's the right format
'name' => "Donation to My Charity"
);
// Generate the url
$bill_url = GoCardless::new_bill_url($bill_details);
// Redirect to the URL that was generated
die(header("Location: " . $bill_url));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment