### gocardless get examples Source: https://docs.gocardless.com/docs/developer-resources/gc-cli/cli-reference.md Examples of fetching different resource types by their IDs. ```bash gocardless get mandate MD000EZSHACK2V gocardless get payment PA1000014 gocardless get event EV109280928 ``` -------------------------------- ### Install GoCardless client library (Go) Source: https://docs.gocardless.com/docs/getting-started/set-up.md Install the GoCardless Go client library using go get. ```go go get github.com/gocardless/gocardless-pro-go/v6 ``` -------------------------------- ### gocardless get subscription example Source: https://docs.gocardless.com/docs/developer-resources/gc-cli/cli-reference.md Example command to fetch a subscription with ID XYZ12344. ```bash gocardless get subscription XYZ12344 ``` -------------------------------- ### gocardless create examples Source: https://docs.gocardless.com/docs/developer-resources/gc-cli/cli-reference.md Examples of creating resources: a payment linked to a mandate, a payment using the vim editor, and a subscription. ```bash # create a payment linked to a mandate gocardless create payments -d amount=1000 -d currency=GBP -d "links[mandate]=MD1234" # create a payment with editor # opens vim prompt and then you can enter json data. gocardless create payments --editorName vim # create a subscription gocardless create subscriptions -d amount=1000 -d currency=GBP -d interval_unit=monthly -d "links[mandate]=MD1234" ``` -------------------------------- ### Build signature base in TypeScript for POST and GET Source: https://docs.gocardless.com/docs/send-money/api-request-signing.md TypeScript examples for POST and GET requests. The POST example includes content-digest, content-type, and content-length; the GET example omits them. Both use template literals to preserve newlines. ```typescript // Example for POST request const signatureBase = `"@method": POST "@authority": api.gocardless.com "@request-target": /path?param=value "content-digest": sha256=:9AmU2hRsZnqEo2HiNTLacLN0fOs8YmDiuX4WYeYWvh0=: "content-type": application/json "content-length": 18 "@signature-params": ("@method" "@authority" "@request-target" "content-digest" "content-type" "content-length");keyid="RSK00123456789300123456789300";created=1675688690;nonce="8IBTHwOdqNKAWeKl7plt8g=="`; // Example for GET request const signatureBaseGet = `"@method": GET "@authority": api.gocardless.com "@request-target": /path?param=value "@signature-params": ("@method" "@authority" "@request-target");keyid="RSK00123456789300123456789300";created=1675688690;nonce="8IBTHwOdqNKAWeKl7plt8g=="`; ``` -------------------------------- ### Create instalment schedule with fixed dates Source: https://docs.gocardless.com/docs/collect-payments/recurring-payments/instalment-schedules.md Create an instalment schedule with fixed dates using the API. The example specifies two instalments with amounts and charge dates, and links the schedule to a mandate. The PHP example uses the createWithDates method. ```http curl -X POST https://api.gocardless.com/instalment_schedules \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "instalment_schedules": { "name": "Invoice #1234", "currency": "GBP", "total_amount": 2500, "instalments": [ { "amount": 1500, "charge_date": "2024-11-01" }, { "amount": 1000, "charge_date": "2025-02-01" } ], "links": { "mandate": "MD123" } } }' ``` ```php getenv('GC_ACCESS_TOKEN'), 'environment' => \GoCardlessPro\Environment::SANDBOX ]); $response = $client->instalmentSchedules()->createWithDates([ 'params' => [ 'name' => 'Invoice #1234', 'currency' => 'GBP', 'total_amount' => 2500, 'instalments' => [ ['amount' => 1500, 'charge_date' => '2024-11-01'], ['amount' => 1000, 'charge_date' => '2025-02-01'], ], 'links' => [ 'mandate' => 'MD123', ], ], ]); ``` -------------------------------- ### gocardless version example Source: https://docs.gocardless.com/docs/developer-resources/gc-cli/cli-reference.md Example of running the gocardless version command. ```bash gocardless version ``` -------------------------------- ### gocardless get webhook example Source: https://docs.gocardless.com/docs/developer-resources/gc-cli/cli-reference.md Example command to fetch a webhook with ID XYZ12344. ```bash gocardless get webhook XYZ12344 ``` -------------------------------- ### Set up GoCardless client (Go) Source: https://docs.gocardless.com/docs/getting-started/set-up.md Initialise the GoCardless Go client with your sandbox access token from the GC_ACCESS_TOKEN environment variable. ```go import gocardless "github.com/gocardless/gocardless-pro-go/v6" accessToken := os.Getenv("GC_ACCESS_TOKEN") client, err := gocardless.New(accessToken, gocardless.WithEndpoint(gocardless.SandboxEndpoint)) ``` -------------------------------- ### gocardless completion examples Source: https://docs.gocardless.com/docs/developer-resources/gc-cli/cli-reference.md Examples for setting up shell completion for bash, zsh, fish, and PowerShell. ```bash #### Bash: $ source <(gc completion bash) # To load completions for each session, execute once: # Linux: $ gc completion bash > /etc/bash_completion.d/gc # macOS: $ gc completion bash > /usr/local/etc/bash_completion.d/gc #### Zsh: # If shell completion is not already enabled in your environment, # you will need to enable it. You can execute the following once: $ echo "autoload -U compinit; compinit" >> ~/.zshrc # To load completions for each session, execute once: $ gc completion zsh > "${fpath[1]}/_gc" # You will need to start a new shell for this setup to take effect. #### fish: $ gc completion fish | source # To load completions for each session, execute once: $ gc completion fish > ~/.config/fish/completions/gc.fish #### PowerShell: PS> gc completion powershell | Out-String | Invoke-Expression # To load completions for every new session, run: PS> gc completion powershell > gc.ps1 # and source this file from your PowerShell profile. ``` -------------------------------- ### GET /oauth/authorize request URL Source: https://docs.gocardless.com/docs/api-reference/oauth-reference.md Redirect the user to this endpoint to start the OAuth flow. The example includes all required parameters (response_type, client_id, scope, redirect_uri) and optional parameters such as state and prefill fields. The redirect_uri must exactly match one of the registered redirect_uris. ```http GET https://connect.gocardless.com/oauth/authorize? response_type=code& client_id=sx6WHUAVMUrinkJNJn8DotVFm& scope=read_write& redirect_uri=https%3A%2F%2Fexample.com%2Fcallback& state=q8wEr9yMohTP& prefill[email]=tim%40acme.com& prefill[given_name]=Tim& prefill[family_name]=Rogers& prefill[organisation_name]=Acme%20Ltd& prefill[country_code]=GB ``` -------------------------------- ### Set up GoCardless client (.NET) Source: https://docs.gocardless.com/docs/getting-started/set-up.md Initialise the GoCardless .NET client with your sandbox access token from the GC_ACCESS_TOKEN environment variable. ```net using GoCardless; var client = GoCardlessClient.Create( Environment.GetEnvironmentVariable("GC_ACCESS_TOKEN"), GoCardlessClient.Environment.SANDBOX ); ``` -------------------------------- ### gocardless config current-session example Source: https://docs.gocardless.com/docs/developer-resources/gc-cli/cli-reference.md Example usage of the current-session command to get the user's current session. ```bash gocardless config current-session ``` -------------------------------- ### gocardless open examples Source: https://docs.gocardless.com/docs/developer-resources/gc-cli/cli-reference.md Examples of using the gocardless open command to list all shortcuts and open specific GoCardless pages. ```bash gocardless open --list gocardless open api gocardless open docs gocardless open customers gocardless open dashboard/webhooks ``` -------------------------------- ### Set up GoCardless client (Java) Source: https://docs.gocardless.com/docs/getting-started/set-up.md Initialise the GoCardless Java client with your sandbox access token from the GC_ACCESS_TOKEN environment variable. ```java import com.gocardless.GoCardlessClient; GoCardlessClient client = GoCardlessClient .newBuilder(System.getenv("GC_ACCESS_TOKEN")) .withEnvironment(GoCardlessClient.Environment.SANDBOX) .build(); ``` -------------------------------- ### gocardless get mandate command usage and options Source: https://docs.gocardless.com/docs/developer-resources/gc-cli/cli-reference.md Shows the usage, an example, and available options for the 'gocardless get mandate' command. The example fetches a mandate with ID 'XYZ12344'. The inherited --config flag defaults to $HOME/.gc-cli/config.json. ```bash gocardless get mandate {ID} [flags] ``` ```bash gocardless get mandate XYZ12344 ``` ```bash -h, --help help for mandate ``` ```bash --config string config file (default is $HOME/.gc-cli/config.json) ``` -------------------------------- ### gocardless get event command usage and options Source: https://docs.gocardless.com/docs/developer-resources/gc-cli/cli-reference.md Shows the usage, an example, and available options for the 'gocardless get event' command. The example fetches an event with ID 'XYZ12344'. The inherited --config flag defaults to $HOME/.gc-cli/config.json. ```bash gocardless get event {ID} [flags] ``` ```bash gocardless get event XYZ12344 ``` ```bash -h, --help help for event ``` ```bash --config string config file (default is $HOME/.gc-cli/config.json) ``` -------------------------------- ### Set up GoCardless client (PHP) Source: https://docs.gocardless.com/docs/getting-started/set-up.md Initialise the GoCardless PHP client with your sandbox access token from the GC_ACCESS_TOKEN environment variable. ```php getenv("GC_ACCESS_TOKEN"), "environment" => \GoCardlessPro\Environment::SANDBOX, ]); ``` -------------------------------- ### gocardless get customer command usage and options Source: https://docs.gocardless.com/docs/developer-resources/gc-cli/cli-reference.md Shows the usage, an example, and available options for the 'gocardless get customer' command. The example fetches a customer with ID 'XYZ12344'. The inherited --config flag defaults to $HOME/.gc-cli/config.json. ```bash gocardless get customer {ID} [flags] ``` ```bash gocardless get customer XYZ12344 ``` ```bash -h, --help help for customer ``` ```bash --config string config file (default is $HOME/.gc-cli/config.json) ``` -------------------------------- ### Set up GoCardless client (Python) Source: https://docs.gocardless.com/docs/getting-started/set-up.md Initialise the GoCardless Python client with your sandbox access token from the GC_ACCESS_TOKEN environment variable. ```python import os import gocardless_pro client = gocardless_pro.Client( access_token=os.environ["GC_ACCESS_TOKEN"], environment="sandbox" ) ``` -------------------------------- ### gocardless get mandate_import command usage and options Source: https://docs.gocardless.com/docs/developer-resources/gc-cli/cli-reference.md Shows the usage, an example, and available options for the 'gocardless get mandate_import' command. The example fetches a mandate import with ID 'XYZ12344'. The inherited --config flag defaults to $HOME/.gc-cli/config.json. ```bash gocardless get mandate_import {ID} [flags] ``` ```bash gocardless get mandate_import XYZ12344 ``` ```bash -h, --help help for mandate_import ``` ```bash --config string config file (default is $HOME/.gc-cli/config.json) ``` -------------------------------- ### gocardless login examples Source: https://docs.gocardless.com/docs/developer-resources/gc-cli/cli-reference.md Examples for the gocardless login command. The first authorises against the Gocardless CLI; the second authorises against a partner app by providing the App ID with the --app flag. ```bash # authorise against the Gocardless CLI gocardless login # authorise against a partner app by providing the App ID gocardless login --app {APP_ID} ``` -------------------------------- ### gocardless list creditors example Source: https://docs.gocardless.com/docs/developer-resources/gc-cli/cli-reference.md Example command to list creditors. ```bash gocardless list creditors ``` -------------------------------- ### GET /instalment_schedules/{instalment_schedule_id} Source: https://docs.gocardless.com/docs/api-reference/instalment-schedule.md Retrieves the details of an existing instalment schedule. ```APIDOC ## [GET] /instalment_schedules/{instalment_schedule_id} ### Description Retrieves the details of an existing instalment schedule. ### Method GET ### Endpoint /instalment_schedules/{instalment_schedule_id} ### Parameters #### Path Parameters - **instalment_schedule_id** (string) - Required - The instalment schedule id ### Response #### Success Response (200) The response is wrapped in a `instalment_schedules` object. - **id** (string) - Optional - Unique identifier, beginning with "IS". - **created_at** (string) - Optional - Fixed timestamp, recording when this resource was created. - **total_amount** (integer) - Optional - The total amount of the instalment schedule, defined as the sum of all individual payments, in the lowest denomination for the currency (e.g. pence in GBP, cents in EUR). If the requested payment amounts do not sum up correctly, a validation error will be returned. - **name** (string) - Optional - Name of the instalment schedule, up to 100 chars. This name will also be copied to the payments of the instalment schedule if you use schedule-based creation. - **currency** (enum) - Optional - ISO 4217 currency code. Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. - **metadata** (object) - Optional - Key-value store of custom data. Up to 3 keys are permitted, with key names up to 50 characters and values up to 500 characters. - **status** (enum) - Optional - One of: `pending`, `active`, `creation_failed`, `completed`, `cancelled`, `errored`. - **payment_errors** (object) - Optional - If the status is `creation_failed`, this property will be populated with validation failures from the individual payments, arranged by the index of the payment that failed. - **links** (object) - Optional - Links to associated objects #### Response Example { "instalment_schedules": { "id": "IS123", "created_at": "2024-01-01T12:00:00Z", "total_amount": 1000, "name": "Example Schedule", "currency": "GBP", "metadata": {}, "status": "active", "payment_errors": null, "links": {} } } #### Error Response (400, 401, 404, 422, 500) Errors are wrapped in an `error` object. - **code** (integer) - Optional - **documentation_url** (string) - Optional - **errors** (array) - Required - **message** (string) - Required - **request_id** (string) - Required - **type** (string) - Optional #### Error Example { "error": { "code": 404, "documentation_url": "https://docs.example.com/errors/not-found", "errors": ["Not found"], "message": "Resource not found", "request_id": "req_123", "type": "invalid_request_error" } } ``` -------------------------------- ### Create instalment schedule in Python Source: https://docs.gocardless.com/docs/collect-payments/recurring-payments/instalment-schedules.md Initializes the GoCardless Python client with an access token and sandbox environment, then creates an instalment schedule with the same parameters as the PHP example. ```python client = gocardless_pro.Client( access_token=os.environ['GC_ACCESS_TOKEN'], environment='sandbox' ) response = client.instalment_schedules.create_with_schedule( params={ 'name': 'Invoice #1234', 'currency': 'GBP', 'total_amount': 2500, 'instalments': { 'start_date': '2024-11-01', 'interval_unit': 'monthly', 'interval': 1, 'amounts': [1500, 1000], }, 'links': { 'mandate': 'MD123', }, } ) ``` -------------------------------- ### Set up GoCardless client (Ruby) Source: https://docs.gocardless.com/docs/getting-started/set-up.md Initialise the GoCardless Ruby client with your sandbox access token from the GC_ACCESS_TOKEN environment variable. ```ruby require "gocardless_pro" client = GoCardlessPro::Client.new( access_token: ENV["GC_ACCESS_TOKEN"], environment: :sandbox ) ``` -------------------------------- ### Set up GoCardless client (Node.js) Source: https://docs.gocardless.com/docs/getting-started/set-up.md Initialise the GoCardless Node.js client with your sandbox access token from the GC_ACCESS_TOKEN environment variable. ```nodejs const gocardless = require("gocardless-nodejs"); const constants = require("gocardless-nodejs/constants"); const client = gocardless(process.env.GC_ACCESS_TOKEN, constants.Environments.Sandbox); ``` -------------------------------- ### Instalment schedule JSON object Source: https://docs.gocardless.com/docs/collect-payments/recurring-payments/instalment-schedules.md Example JSON representation of an instalment schedule resource, showing fields such as id, status, name, currency, total_amount, and links to the mandate and payments. ```json { "instalment_schedules": { "id": "IS123", "status": "active", "name": "Invoice #1234", "currency": "GBP", "total_amount": 2500, "links": { "mandate": "MD123", "payments": ["PM001", "PM002"] } } } ```