The GoCardless Python Client Library
This module provides a wrapper around the GoCardless payments API, the interface to the api is provided by the gocardless.Client object. See the documentation for that class for how to obtain a reference.
By default the library will attempt to use the GoCardless production environment, for testing purposes this is not what you want and you should set the gocardless.environment to “sandbox”.
Once you have obtained an instance of a client you can use that client to generate urls for receiving payments. You can also use it to query the api for information about payments resources using an active resource style API. For example, to get all of a merchants bills:
>>> merchant = client.merchant()
>>> merchant.bills()
>>> [<gocardless.resources.Bill at 0x29a6050>]
The client for merchants to use. Does not exist until gocardless.set_details() has been called.
The environment GoCardless executes API requests against, should be either “production” or “sandbox”
Set the global account details to use for requests
The parameters are your security details which can be found on your gocardless developer details page. All are mandatory
The main interface to the GoCardless API
This class is the starting point for interacting with GoCardless. If you are a merchant than you can obtain a client instance by setting your account details in gocardless.set_details().
If you are a partner and need OAuth access to other merchants’ accounts then you need to create a client using your app id and app secret, then use the OAuth APIs to obtain authorization over the merchants’ account.
Create a client
Parameters: |
|
---|
list of weak references to the object (if defined)
Issue a delete to the API server.
Parameters: |
|
---|
Issue an GET request to the API server.
Parameters: | path – the path that will be added to the API prefix |
---|
Issue a POST request to the API server
Parameters: |
|
---|
Issue a PUT request to the API server
Parameters: |
|
---|
Find a bill with id id
Confirm a payment
This send a post request to the confirmation URI for a payment. params should contain these elements from the request - resource_uri - resource_id - resource_type - signature - state (if any)
Creates a new bill under an existing pre_authorization
Parameters: |
|
---|
Fetch the access token for a merchant
Takes the authorization code obtained from a merchant redirect and the redirect_uri used in that same redirect and fetches the corresponding access token. The access token is returned and also set on the client so the client can then be used to make api calls on behalf of the merchant.
Parameters: |
|
---|
Return the correct base URL for the current environment. If one has been manually set, default to that.
Returns the current Merchant’s details.
Generate a url for creating a new bill
Parameters: |
|
---|
Get a URL for managing a new merchant
This method creates a URL which partners should redirect merchants to in order to obtain permission to manage their GoCardless payments.
Parameters: |
|
---|
Get a url for creating new pre_authorizations
Parameters: |
|
---|
Get a url for creating new pre_authorizations
Parameters: |
|
---|
Generate a url for creating a new subscription
Parameters: |
|
---|
Find a pre authorization with id id
Params id: | The pre authorization id |
---|
Returns a single subscription
Parameters: | id – The subscription id, String |
---|
Find a user by id
Parameters: | id – The users id |
---|
Check whether a webhook signature is valid
Takes a dictionary of parameters, including the signature and returns a boolean indicating whether the signature is valid.
Parameters: | params – A dictionary of data to validate, must include the key “signature” |
---|