Skip to content

Instantly share code, notes, and snippets.

@chris-jamieson
Created January 23, 2015 15:04
Show Gist options
  • Select an option

  • Save chris-jamieson/c81443fcfbe19ea34630 to your computer and use it in GitHub Desktop.

Select an option

Save chris-jamieson/c81443fcfbe19ea34630 to your computer and use it in GitHub Desktop.
GoCardless Incorrect token error
import gocardless
from api import settings
# set environment to sandbox
gocardless.environment = settings.GOCARDLESS_ENVIRONMENT
gocardless.set_details(
app_id=settings.GOCARDLESS_MERCHANT_APP_ID,
app_secret=settings.GOCARDLESS_MERCHANT_APP_SECRET,
access_token=settings.GOCARDLESS_MERCHANT_ACCESS_TOKEN,
merchant_id=settings.GOCARDLESS_MERCHANT_ID
)
def get_gc_partner_authorization_url(merchant_details):
"""
passes merchant details to GoCardless and returns a URL, where a merchant can authorise with GoCardless
info: https://developer.gocardless.com/python/#merchant-account-authorization
"""
client = gocardless.Client(
settings.GOCARDLESS_PARTNER_APP_ID,
settings.GOCARDLESS_PARTNER_APP_SECRET
)
url = client.new_merchant_url(
redirect_uri='http://httpbin.org/get',
merchant=merchant_details
)
return url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment