gocardless

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2022 License: MIT Imports: 20 Imported by: 0

README

Go Client Library for GoCardless Pro Api

This library provides a simple wrapper around the GoCardless API.

Getting started

Make sure your project is using Go Modules (it will have a go.mod file in its root if it already is):

go mod init
go mod tidy

Then, reference gocardless-pro-go in a Go program with import:

import (
    gocardless "github.com/gocardless/gocardless-pro-go"
)

Run any of the normal go commands (build/install/test). The Go toolchain will resolve and fetch the gocardless-pro-go module automatically.

Alternatively, you can also explicitly go get the package into a project:

go get -u github.com/gocardless/gocardless-pro-go/v1.0.0

Initializing the client

The client is initialised with an access token, and is configured to use GoCardless live environment by default:

    token := "your_access_token"
    client, err := gocardless.New(token)

Optionally, the client can be customised with endpoint, for ex: sandbox environment

    opts := gocardless.WithEndpoint(gocardless.SandboxEndpoint)
    client, err := gocardless.New(token, opts)

the client can also be initialised with a customised http client, for ex;

    customHttpClient := &http.Client{
        Timeout: time.Second * 10,
    }
    opts := gocardless.WithClient(customHttpClient)
    client, err := gocardless.New(token, opts)

Examples

Fetching resources

To fetch single item, use the Get method

    ctx := context.TODO()
    customer, err := client.Customers.Get(ctx, "CU123")
Listing resources

To fetch items in a collection, there are two options:

  • Fetching items one page at a time using List method:
    ctx := context.TODO()
    customerListParams := gocardless.CustomerListParams{}
    customers, err := client.Customers.List(ctx, customerListParams)
    for _, customer := range customers.Customers {
        fmt.Printf("customer: %v", customer)
    }
    cursor := customers.Meta.Cursors.After
    customerListParams.After = cursor
    nextPageCustomers, err := client.Customers.List(ctx, customerRemoveParams)
  • Iterating through all of the items using a All method to get a lazily paginated list. All will deal with making extra API requests to paginate through all the data for you:
    ctx := context.TODO()
    customerListParams := gocardless.CustomerListParams{}
    customerListIterator := service.Customers.All(ctx, customerListParams)
    for customerListIterator.Next() {
        customerListResult, err := customerListIterator.Value(ctx)
        if err != nil {
            fmt.Printf("got err: %s", err.Error())
        } else {
            fmt.Printf("customerListResult is %v", customerListResult)
        }
    }
Creating resources

Resources can be created with the Create method:

    ctx := context.TODO()
    customerCreateParams := CustomerCreateParams{}
    customerCreateParams.AddressLine1 = "9 Acer Gardens"
    customerCreateParams.City = "Birmingham"
    customerCreateParams.CountryCode = "GB"
    customerCreateParams.Email = "bbr@example.xom"
    customerCreateParams.FamilyName = "Rodgriguez"
    customerCreateParams.GivenName = "Bender Bending"
    customerCreateParams.PostalCode = "B4 7NJ"

    customer, err := client.Customers.Create(ctx, customerCreateParams)
Updating Resources

Resources can be updates with the Update method:

    ctx := context.TODO()
    customerUpdateParams := CustomerUpdateParams{}
    customerUpdateParams.GivenName = "New name"

    customer, err := client.Customers.Update(ctx, "CU123", customerUpdateParams)
Removing Resources

Resources can be removed with the Remove method:

    ctx := context.TODO()
    customerRemoveParams := CustomerRemoveParams{}

    customer, err := client.Customers.Remove(ctx, "CU123", customerRemoveParams)
Retrying requests

The library will attempt to retry most failing requests automatically (with the exception of those which are not safe to retry).

GET requests are considered safe to retry, and will be retried automatically. Certain POST requests are made safe to retry by the use of an idempotency key, generated automatically by the library, so we'll automatically retry these too. Currently its retried for 3 times. If you want to override this behaviour(for example, to provide your own retry mechanism), then you can use the WithoutRetries. This will not retry and return response object.

    requestOption := gocardless.WithoutRetries()
    customersCreateResult, err := service.Customers.Create(ctx, customerCreateParams, requestOption)
Setting custom headers

You shouldn't generally need to customise the headers sent by the library, but you wish to in some cases (for example if you want to send an Accept-Language header when creating a mandate PDF).

    headers := make(map[string]string)
    headers["Accept-Language"] = "fr"
    requestOption := gocardless.WithHeaders(headers)
    customersCreateResult, err := service.Customers.Create(ctx, customerCreateParams, requestOption)

Custom headers you specify will override any headers generated by the library itself (for example, an Idempotency-Key header with a randomly-generated value or one you've configured manually). Custom headers always take precedence.

    requestOption := gocardless.WithIdempotencyKey("test-idemptency-key-123")
    customersCreateResult, err := service.Customers.Create(ctx, customerCreateParams, requestOption)
Handling webhooks

GoCardless supports webhooks, allowing you to receive real-time notifications when things happen in your account, so you can take automatic actions in response, for example:

  • When a customer cancels their mandate with the bank, suspend their club membership
  • When a payment fails due to lack of funds, mark their invoice as unpaid
  • When a customer’s subscription generates a new payment, log it in their “past payments” list

The client allows you to validate that a webhook you receive is genuinely from GoCardless, and to parse it into Event objects(defined in event_service.go) which are easy to work with:

    http.HandleFunc("/webhookEndpoint", func(w http.ResponseWriter, r *http.Request) {
        wh, err := NewWebhookHandler("secret", EventHandlerFunc(func(event gocardless.Event) error {
		    parseEvent(event)
        }))
        wh.ServeHTTP(w,r)
    })

    func parseEvents(event Event) {
        // work through list of events
    }

Compatibility

This library requires go 1.16 and above.

Documentation

TODO

Contributing

This client is auto-generated from Crank, a toolchain that we hope to soon open source. Issues should for now be reported on this repository. Please do not modify the source code yourself, your changes will be overridden!

Documentation

Index

Constants

View Source
const (

	// Live environment
	LiveEndpoint = "https://api.gocardless.com"

	// Sandbox environment
	SandboxEndpoint = "https://api-sandbox.gocardless.com"
)

Variables

This section is empty.

Functions

func NewIdempotencyKey

func NewIdempotencyKey() string

NewIdempotencyKey generates a random and unique idempotency key

Types

type APIError

type APIError struct {
	Message          string            `json:"message"`
	DocumentationUrl string            `json:"documentation_url"`
	Type             string            `json:"type"`
	RequestID        string            `json:"request_id"`
	Errors           []ValidationError `json:"errors"`
	Code             int               `json:"code"`
}

func (*APIError) Error

func (err *APIError) Error() string

type BankAuthorisation

type BankAuthorisation struct {
	AuthorisationType string `url:"authorisation_type,omitempty" json:"authorisation_type,omitempty"`
	AuthorisedAt      string `url:"authorised_at,omitempty" json:"authorised_at,omitempty"`
	CreatedAt         string `url:"created_at,omitempty" json:"created_at,omitempty"`
	ExpiresAt         string `url:"expires_at,omitempty" json:"expires_at,omitempty"`
	Id                string `url:"id,omitempty" json:"id,omitempty"`
	LastVisitedAt     string `url:"last_visited_at,omitempty" json:"last_visited_at,omitempty"`
	Links             struct {
		BillingRequest string `url:"billing_request,omitempty" json:"billing_request,omitempty"`
		Institution    string `url:"institution,omitempty" json:"institution,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	RedirectUri string `url:"redirect_uri,omitempty" json:"redirect_uri,omitempty"`
	Url         string `url:"url,omitempty" json:"url,omitempty"`
}

BankAuthorisation model

type BankAuthorisationCreateParams

type BankAuthorisationCreateParams struct {
	AuthorisationType string `url:"authorisation_type,omitempty" json:"authorisation_type,omitempty"`
	Links             struct {
		BillingRequest string `url:"billing_request,omitempty" json:"billing_request,omitempty"`
		Institution    string `url:"institution,omitempty" json:"institution,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	RedirectUri string `url:"redirect_uri,omitempty" json:"redirect_uri,omitempty"`
}

BankAuthorisationCreateParams parameters

type BankAuthorisationService

type BankAuthorisationService struct {
	// contains filtered or unexported fields
}

BankAuthorisationService manages bank_authorisations

func (*BankAuthorisationService) Create

Create Create a Bank Authorisation.

func (*BankAuthorisationService) Get

Get Fetches a bank authorisation

type BankDetailsLookup

type BankDetailsLookup struct {
	AvailableDebitSchemes []string `url:"available_debit_schemes,omitempty" json:"available_debit_schemes,omitempty"`
	BankName              string   `url:"bank_name,omitempty" json:"bank_name,omitempty"`
	Bic                   string   `url:"bic,omitempty" json:"bic,omitempty"`
}

BankDetailsLookup model

type BankDetailsLookupCreateParams

type BankDetailsLookupCreateParams struct {
	AccountNumber string `url:"account_number,omitempty" json:"account_number,omitempty"`
	BankCode      string `url:"bank_code,omitempty" json:"bank_code,omitempty"`
	BranchCode    string `url:"branch_code,omitempty" json:"branch_code,omitempty"`
	CountryCode   string `url:"country_code,omitempty" json:"country_code,omitempty"`
	Iban          string `url:"iban,omitempty" json:"iban,omitempty"`
}

BankDetailsLookupCreateParams parameters

type BankDetailsLookupService

type BankDetailsLookupService struct {
	// contains filtered or unexported fields
}

BankDetailsLookupService manages bank_details_lookups

func (*BankDetailsLookupService) Create

Create Performs a bank details lookup. As part of the lookup, a modulus check and reachability check are performed.

If your request returns an [error](#api-usage-errors) or the `available_debit_schemes` attribute is an empty array, you will not be able to collect payments from the specified bank account. GoCardless may be able to collect payments from an account even if no `bic` is returned.

Bank account details may be supplied using [local details](#appendix-local-bank-details) or an IBAN.

_Note:_ Usage of this endpoint is monitored. If your organisation relies on GoCardless for modulus or reachability checking but not for payment collection, please get in touch.

type BillingRequest

type BillingRequest struct {
	Actions []struct {
		BankAuthorisation struct {
			Adapter             string `url:"adapter,omitempty" json:"adapter,omitempty"`
			AuthorisationType   string `url:"authorisation_type,omitempty" json:"authorisation_type,omitempty"`
			RequiresInstitution bool   `url:"requires_institution,omitempty" json:"requires_institution,omitempty"`
		} `url:"bank_authorisation,omitempty" json:"bank_authorisation,omitempty"`
		CollectCustomerDetails struct {
			DefaultCountryCode string `url:"default_country_code,omitempty" json:"default_country_code,omitempty"`
		} `url:"collect_customer_details,omitempty" json:"collect_customer_details,omitempty"`
		CompletesActions []string `url:"completes_actions,omitempty" json:"completes_actions,omitempty"`
		Required         bool     `url:"required,omitempty" json:"required,omitempty"`
		RequiresActions  []string `url:"requires_actions,omitempty" json:"requires_actions,omitempty"`
		Status           string   `url:"status,omitempty" json:"status,omitempty"`
		Type             string   `url:"type,omitempty" json:"type,omitempty"`
	} `url:"actions,omitempty" json:"actions,omitempty"`
	CreatedAt string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Id        string `url:"id,omitempty" json:"id,omitempty"`
	Links     struct {
		BankAuthorisation     string `url:"bank_authorisation,omitempty" json:"bank_authorisation,omitempty"`
		Creditor              string `url:"creditor,omitempty" json:"creditor,omitempty"`
		Customer              string `url:"customer,omitempty" json:"customer,omitempty"`
		CustomerBankAccount   string `url:"customer_bank_account,omitempty" json:"customer_bank_account,omitempty"`
		CustomerBillingDetail string `url:"customer_billing_detail,omitempty" json:"customer_billing_detail,omitempty"`
		MandateRequest        string `url:"mandate_request,omitempty" json:"mandate_request,omitempty"`
		MandateRequestMandate string `url:"mandate_request_mandate,omitempty" json:"mandate_request_mandate,omitempty"`
		PaymentRequest        string `url:"payment_request,omitempty" json:"payment_request,omitempty"`
		PaymentRequestPayment string `url:"payment_request_payment,omitempty" json:"payment_request_payment,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	MandateRequest struct {
		Currency string `url:"currency,omitempty" json:"currency,omitempty"`
		Links    struct {
			Mandate string `url:"mandate,omitempty" json:"mandate,omitempty"`
		} `url:"links,omitempty" json:"links,omitempty"`
		Scheme string `url:"scheme,omitempty" json:"scheme,omitempty"`
		Verify string `url:"verify,omitempty" json:"verify,omitempty"`
	} `url:"mandate_request,omitempty" json:"mandate_request,omitempty"`
	Metadata       map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	PaymentRequest struct {
		Amount      int    `url:"amount,omitempty" json:"amount,omitempty"`
		AppFee      int    `url:"app_fee,omitempty" json:"app_fee,omitempty"`
		Currency    string `url:"currency,omitempty" json:"currency,omitempty"`
		Description string `url:"description,omitempty" json:"description,omitempty"`
		Links       struct {
			Payment string `url:"payment,omitempty" json:"payment,omitempty"`
		} `url:"links,omitempty" json:"links,omitempty"`
		Scheme string `url:"scheme,omitempty" json:"scheme,omitempty"`
	} `url:"payment_request,omitempty" json:"payment_request,omitempty"`
	Resources struct {
		Customer struct {
			CompanyName string                 `url:"company_name,omitempty" json:"company_name,omitempty"`
			CreatedAt   string                 `url:"created_at,omitempty" json:"created_at,omitempty"`
			Email       string                 `url:"email,omitempty" json:"email,omitempty"`
			FamilyName  string                 `url:"family_name,omitempty" json:"family_name,omitempty"`
			GivenName   string                 `url:"given_name,omitempty" json:"given_name,omitempty"`
			Id          string                 `url:"id,omitempty" json:"id,omitempty"`
			Language    string                 `url:"language,omitempty" json:"language,omitempty"`
			Metadata    map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
			PhoneNumber string                 `url:"phone_number,omitempty" json:"phone_number,omitempty"`
		} `url:"customer,omitempty" json:"customer,omitempty"`
		CustomerBankAccount struct {
			AccountHolderName   string `url:"account_holder_name,omitempty" json:"account_holder_name,omitempty"`
			AccountNumberEnding string `url:"account_number_ending,omitempty" json:"account_number_ending,omitempty"`
			AccountType         string `url:"account_type,omitempty" json:"account_type,omitempty"`
			BankName            string `url:"bank_name,omitempty" json:"bank_name,omitempty"`
			CountryCode         string `url:"country_code,omitempty" json:"country_code,omitempty"`
			CreatedAt           string `url:"created_at,omitempty" json:"created_at,omitempty"`
			Currency            string `url:"currency,omitempty" json:"currency,omitempty"`
			Enabled             bool   `url:"enabled,omitempty" json:"enabled,omitempty"`
			Id                  string `url:"id,omitempty" json:"id,omitempty"`
			Links               struct {
				Customer string `url:"customer,omitempty" json:"customer,omitempty"`
			} `url:"links,omitempty" json:"links,omitempty"`
			Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
		} `url:"customer_bank_account,omitempty" json:"customer_bank_account,omitempty"`
		CustomerBillingDetail struct {
			AddressLine1          string   `url:"address_line1,omitempty" json:"address_line1,omitempty"`
			AddressLine2          string   `url:"address_line2,omitempty" json:"address_line2,omitempty"`
			AddressLine3          string   `url:"address_line3,omitempty" json:"address_line3,omitempty"`
			City                  string   `url:"city,omitempty" json:"city,omitempty"`
			CountryCode           string   `url:"country_code,omitempty" json:"country_code,omitempty"`
			CreatedAt             string   `url:"created_at,omitempty" json:"created_at,omitempty"`
			DanishIdentityNumber  string   `url:"danish_identity_number,omitempty" json:"danish_identity_number,omitempty"`
			Id                    string   `url:"id,omitempty" json:"id,omitempty"`
			IpAddress             string   `url:"ip_address,omitempty" json:"ip_address,omitempty"`
			PostalCode            string   `url:"postal_code,omitempty" json:"postal_code,omitempty"`
			Region                string   `url:"region,omitempty" json:"region,omitempty"`
			Schemes               []string `url:"schemes,omitempty" json:"schemes,omitempty"`
			SwedishIdentityNumber string   `url:"swedish_identity_number,omitempty" json:"swedish_identity_number,omitempty"`
		} `url:"customer_billing_detail,omitempty" json:"customer_billing_detail,omitempty"`
	} `url:"resources,omitempty" json:"resources,omitempty"`
	Status string `url:"status,omitempty" json:"status,omitempty"`
}

BillingRequest model

type BillingRequestCancelParams

type BillingRequestCancelParams struct {
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

BillingRequestCancelParams parameters

type BillingRequestCollectBankAccountParams

type BillingRequestCollectBankAccountParams struct {
	AccountHolderName   string                 `url:"account_holder_name,omitempty" json:"account_holder_name,omitempty"`
	AccountNumber       string                 `url:"account_number,omitempty" json:"account_number,omitempty"`
	AccountNumberSuffix string                 `url:"account_number_suffix,omitempty" json:"account_number_suffix,omitempty"`
	AccountType         string                 `url:"account_type,omitempty" json:"account_type,omitempty"`
	BankCode            string                 `url:"bank_code,omitempty" json:"bank_code,omitempty"`
	BranchCode          string                 `url:"branch_code,omitempty" json:"branch_code,omitempty"`
	CountryCode         string                 `url:"country_code,omitempty" json:"country_code,omitempty"`
	Currency            string                 `url:"currency,omitempty" json:"currency,omitempty"`
	Iban                string                 `url:"iban,omitempty" json:"iban,omitempty"`
	Metadata            map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

BillingRequestCollectBankAccountParams parameters

type BillingRequestCollectCustomerDetailsParams

type BillingRequestCollectCustomerDetailsParams struct {
	Customer struct {
		CompanyName string                 `url:"company_name,omitempty" json:"company_name,omitempty"`
		Email       string                 `url:"email,omitempty" json:"email,omitempty"`
		FamilyName  string                 `url:"family_name,omitempty" json:"family_name,omitempty"`
		GivenName   string                 `url:"given_name,omitempty" json:"given_name,omitempty"`
		Language    string                 `url:"language,omitempty" json:"language,omitempty"`
		Metadata    map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
		PhoneNumber string                 `url:"phone_number,omitempty" json:"phone_number,omitempty"`
	} `url:"customer,omitempty" json:"customer,omitempty"`
	CustomerBillingDetail struct {
		AddressLine1          string `url:"address_line1,omitempty" json:"address_line1,omitempty"`
		AddressLine2          string `url:"address_line2,omitempty" json:"address_line2,omitempty"`
		AddressLine3          string `url:"address_line3,omitempty" json:"address_line3,omitempty"`
		City                  string `url:"city,omitempty" json:"city,omitempty"`
		CountryCode           string `url:"country_code,omitempty" json:"country_code,omitempty"`
		DanishIdentityNumber  string `url:"danish_identity_number,omitempty" json:"danish_identity_number,omitempty"`
		PostalCode            string `url:"postal_code,omitempty" json:"postal_code,omitempty"`
		Region                string `url:"region,omitempty" json:"region,omitempty"`
		SwedishIdentityNumber string `url:"swedish_identity_number,omitempty" json:"swedish_identity_number,omitempty"`
	} `url:"customer_billing_detail,omitempty" json:"customer_billing_detail,omitempty"`
}

BillingRequestCollectCustomerDetailsParams parameters

type BillingRequestConfirmPayerDetailsParams

type BillingRequestConfirmPayerDetailsParams struct {
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

BillingRequestConfirmPayerDetailsParams parameters

type BillingRequestCreateParams

type BillingRequestCreateParams struct {
	Links struct {
		Creditor            string `url:"creditor,omitempty" json:"creditor,omitempty"`
		Customer            string `url:"customer,omitempty" json:"customer,omitempty"`
		CustomerBankAccount string `url:"customer_bank_account,omitempty" json:"customer_bank_account,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	MandateRequest struct {
		Currency string `url:"currency,omitempty" json:"currency,omitempty"`
		Scheme   string `url:"scheme,omitempty" json:"scheme,omitempty"`
	} `url:"mandate_request,omitempty" json:"mandate_request,omitempty"`
	Metadata       map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	PaymentRequest struct {
		Amount      int    `url:"amount,omitempty" json:"amount,omitempty"`
		AppFee      int    `url:"app_fee,omitempty" json:"app_fee,omitempty"`
		Currency    string `url:"currency,omitempty" json:"currency,omitempty"`
		Description string `url:"description,omitempty" json:"description,omitempty"`
		Scheme      string `url:"scheme,omitempty" json:"scheme,omitempty"`
	} `url:"payment_request,omitempty" json:"payment_request,omitempty"`
}

BillingRequestCreateParams parameters

type BillingRequestFlow

type BillingRequestFlow struct {
	AuthorisationUrl string `url:"authorisation_url,omitempty" json:"authorisation_url,omitempty"`
	AutoFulfil       bool   `url:"auto_fulfil,omitempty" json:"auto_fulfil,omitempty"`
	CreatedAt        string `url:"created_at,omitempty" json:"created_at,omitempty"`
	ExitUri          string `url:"exit_uri,omitempty" json:"exit_uri,omitempty"`
	ExpiresAt        string `url:"expires_at,omitempty" json:"expires_at,omitempty"`
	Id               string `url:"id,omitempty" json:"id,omitempty"`
	Links            struct {
		BillingRequest string `url:"billing_request,omitempty" json:"billing_request,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	LockBankAccount     bool   `url:"lock_bank_account,omitempty" json:"lock_bank_account,omitempty"`
	LockCustomerDetails bool   `url:"lock_customer_details,omitempty" json:"lock_customer_details,omitempty"`
	RedirectUri         string `url:"redirect_uri,omitempty" json:"redirect_uri,omitempty"`
	SessionToken        string `url:"session_token,omitempty" json:"session_token,omitempty"`
}

BillingRequestFlow model

type BillingRequestFlowCreateParams

type BillingRequestFlowCreateParams struct {
	AutoFulfil bool   `url:"auto_fulfil,omitempty" json:"auto_fulfil,omitempty"`
	ExitUri    string `url:"exit_uri,omitempty" json:"exit_uri,omitempty"`
	Links      struct {
		BillingRequest string `url:"billing_request,omitempty" json:"billing_request,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	LockBankAccount     bool   `url:"lock_bank_account,omitempty" json:"lock_bank_account,omitempty"`
	LockCustomerDetails bool   `url:"lock_customer_details,omitempty" json:"lock_customer_details,omitempty"`
	RedirectUri         string `url:"redirect_uri,omitempty" json:"redirect_uri,omitempty"`
}

BillingRequestFlowCreateParams parameters

type BillingRequestFlowInitialiseParams

type BillingRequestFlowInitialiseParams struct{}

BillingRequestFlowInitialiseParams parameters

type BillingRequestFlowService

type BillingRequestFlowService struct {
	// contains filtered or unexported fields
}

BillingRequestFlowService manages billing_request_flows

func (*BillingRequestFlowService) Create

Create Creates a new billing request flow.

func (*BillingRequestFlowService) Initialise

Initialise Returns the flow having generated a fresh session token which can be used to power integrations that manipulate the flow.

type BillingRequestFulfilParams

type BillingRequestFulfilParams struct {
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

BillingRequestFulfilParams parameters

type BillingRequestListPagingIterator

type BillingRequestListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*BillingRequestListPagingIterator) Next

func (*BillingRequestListPagingIterator) Value

type BillingRequestListParams

type BillingRequestListParams struct {
	After     string `url:"after,omitempty" json:"after,omitempty"`
	Before    string `url:"before,omitempty" json:"before,omitempty"`
	CreatedAt string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Customer  string `url:"customer,omitempty" json:"customer,omitempty"`
	Limit     int    `url:"limit,omitempty" json:"limit,omitempty"`
	Status    string `url:"status,omitempty" json:"status,omitempty"`
}

BillingRequestListParams parameters

type BillingRequestListResult

type BillingRequestListResult struct {
	BillingRequests []BillingRequest `json:"billing_requests"`
	Meta            struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

BillingRequestListResult response including pagination metadata

type BillingRequestNotifyParams

type BillingRequestNotifyParams struct {
	NotificationType string `url:"notification_type,omitempty" json:"notification_type,omitempty"`
	RedirectUri      string `url:"redirect_uri,omitempty" json:"redirect_uri,omitempty"`
}

BillingRequestNotifyParams parameters

type BillingRequestService

type BillingRequestService struct {
	// contains filtered or unexported fields
}

BillingRequestService manages billing_requests

func (*BillingRequestService) Cancel

Cancel Immediately cancels a billing request, causing all billing request flows to expire.

func (*BillingRequestService) CollectBankAccount

CollectBankAccount If the billing request has a pending <code>collect_bank_account</code> action, this endpoint can be used to collect the details in order to complete it.

The endpoint takes the same payload as Customer Bank Accounts, but check the bank account is valid for the billing request scheme before creating and attaching it.

func (*BillingRequestService) CollectCustomerDetails

CollectCustomerDetails If the billing request has a pending <code>collect_customer_details</code> action, this endpoint can be used to collect the details in order to complete it.

The endpoint takes the same payload as Customers, but checks that the customer fields are populated correctly for the billing request scheme.

Whatever is provided to this endpoint is used to update the referenced customer, and will take effect immediately after the request is successful.

func (*BillingRequestService) ConfirmPayerDetails

ConfirmPayerDetails This is needed when you have mandate_request. As a scheme compliance rule we are required to allow the payer to crosscheck the details entered by them and confirm it.

func (*BillingRequestService) Create

Create

func (*BillingRequestService) Fulfil

Fulfil If a billing request is ready to be fulfilled, call this endpoint to cause it to fulfil, executing the payment.

func (*BillingRequestService) Get

func (s *BillingRequestService) Get(ctx context.Context, identity string, opts ...RequestOption) (*BillingRequest, error)

Get Fetches a billing request

func (*BillingRequestService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your billing_requests.

func (*BillingRequestService) Notify

Notify Notifies the customer linked to the billing request, asking them to authorise it. Currently, the customer can only be notified by email.

type BillingRequestTemplate

type BillingRequestTemplate struct {
	AuthorisationUrl          string                 `url:"authorisation_url,omitempty" json:"authorisation_url,omitempty"`
	CreatedAt                 string                 `url:"created_at,omitempty" json:"created_at,omitempty"`
	Id                        string                 `url:"id,omitempty" json:"id,omitempty"`
	MandateRequestCurrency    string                 `url:"mandate_request_currency,omitempty" json:"mandate_request_currency,omitempty"`
	MandateRequestMetadata    map[string]interface{} `url:"mandate_request_metadata,omitempty" json:"mandate_request_metadata,omitempty"`
	MandateRequestScheme      string                 `url:"mandate_request_scheme,omitempty" json:"mandate_request_scheme,omitempty"`
	MandateRequestVerify      string                 `url:"mandate_request_verify,omitempty" json:"mandate_request_verify,omitempty"`
	Metadata                  map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	Name                      string                 `url:"name,omitempty" json:"name,omitempty"`
	PaymentRequestAmount      int                    `url:"payment_request_amount,omitempty" json:"payment_request_amount,omitempty"`
	PaymentRequestCurrency    string                 `url:"payment_request_currency,omitempty" json:"payment_request_currency,omitempty"`
	PaymentRequestDescription string                 `url:"payment_request_description,omitempty" json:"payment_request_description,omitempty"`
	PaymentRequestMetadata    map[string]interface{} `url:"payment_request_metadata,omitempty" json:"payment_request_metadata,omitempty"`
	PaymentRequestScheme      string                 `url:"payment_request_scheme,omitempty" json:"payment_request_scheme,omitempty"`
	RedirectUri               string                 `url:"redirect_uri,omitempty" json:"redirect_uri,omitempty"`
	UpdatedAt                 string                 `url:"updated_at,omitempty" json:"updated_at,omitempty"`
}

BillingRequestTemplate model

type BillingRequestTemplateCreateParams

type BillingRequestTemplateCreateParams struct {
	Links struct {
		Creditor string `url:"creditor,omitempty" json:"creditor,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	MandateRequestCurrency    string                 `url:"mandate_request_currency,omitempty" json:"mandate_request_currency,omitempty"`
	MandateRequestMetadata    map[string]interface{} `url:"mandate_request_metadata,omitempty" json:"mandate_request_metadata,omitempty"`
	MandateRequestScheme      string                 `url:"mandate_request_scheme,omitempty" json:"mandate_request_scheme,omitempty"`
	MandateRequestVerify      string                 `url:"mandate_request_verify,omitempty" json:"mandate_request_verify,omitempty"`
	Metadata                  map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	Name                      string                 `url:"name,omitempty" json:"name,omitempty"`
	PaymentRequestAmount      int                    `url:"payment_request_amount,omitempty" json:"payment_request_amount,omitempty"`
	PaymentRequestCurrency    string                 `url:"payment_request_currency,omitempty" json:"payment_request_currency,omitempty"`
	PaymentRequestDescription string                 `url:"payment_request_description,omitempty" json:"payment_request_description,omitempty"`
	PaymentRequestMetadata    map[string]interface{} `url:"payment_request_metadata,omitempty" json:"payment_request_metadata,omitempty"`
	PaymentRequestScheme      string                 `url:"payment_request_scheme,omitempty" json:"payment_request_scheme,omitempty"`
	RedirectUri               string                 `url:"redirect_uri,omitempty" json:"redirect_uri,omitempty"`
}

BillingRequestTemplateCreateParams parameters

type BillingRequestTemplateListPagingIterator

type BillingRequestTemplateListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*BillingRequestTemplateListPagingIterator) Next

func (*BillingRequestTemplateListPagingIterator) Value

type BillingRequestTemplateListParams

type BillingRequestTemplateListParams struct {
	After  string `url:"after,omitempty" json:"after,omitempty"`
	Before string `url:"before,omitempty" json:"before,omitempty"`
	Limit  int    `url:"limit,omitempty" json:"limit,omitempty"`
}

BillingRequestTemplateListParams parameters

type BillingRequestTemplateListResult

type BillingRequestTemplateListResult struct {
	BillingRequestTemplates []BillingRequestTemplate `json:"billing_request_templates"`
	Meta                    struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

BillingRequestTemplateListResult response including pagination metadata

type BillingRequestTemplateService

type BillingRequestTemplateService struct {
	// contains filtered or unexported fields
}

BillingRequestTemplateService manages billing_request_templates

func (*BillingRequestTemplateService) Create

Create

func (*BillingRequestTemplateService) Get

Get Fetches a Billing Request Template

func (*BillingRequestTemplateService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your Billing Request Templates.

func (*BillingRequestTemplateService) Update

Update Updates a Billing Request Template, which will affect all future Billing Requests created by this template.

type BillingRequestTemplateUpdateParams

type BillingRequestTemplateUpdateParams struct {
	MandateRequestCurrency    string                 `url:"mandate_request_currency,omitempty" json:"mandate_request_currency,omitempty"`
	MandateRequestMetadata    map[string]interface{} `url:"mandate_request_metadata,omitempty" json:"mandate_request_metadata,omitempty"`
	MandateRequestScheme      string                 `url:"mandate_request_scheme,omitempty" json:"mandate_request_scheme,omitempty"`
	MandateRequestVerify      string                 `url:"mandate_request_verify,omitempty" json:"mandate_request_verify,omitempty"`
	Metadata                  map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	Name                      string                 `url:"name,omitempty" json:"name,omitempty"`
	PaymentRequestAmount      int                    `url:"payment_request_amount,omitempty" json:"payment_request_amount,omitempty"`
	PaymentRequestCurrency    string                 `url:"payment_request_currency,omitempty" json:"payment_request_currency,omitempty"`
	PaymentRequestDescription string                 `url:"payment_request_description,omitempty" json:"payment_request_description,omitempty"`
	PaymentRequestMetadata    map[string]interface{} `url:"payment_request_metadata,omitempty" json:"payment_request_metadata,omitempty"`
	PaymentRequestScheme      string                 `url:"payment_request_scheme,omitempty" json:"payment_request_scheme,omitempty"`
	RedirectUri               string                 `url:"redirect_uri,omitempty" json:"redirect_uri,omitempty"`
}

BillingRequestTemplateUpdateParams parameters

type Block

type Block struct {
	Active            bool   `url:"active,omitempty" json:"active,omitempty"`
	BlockType         string `url:"block_type,omitempty" json:"block_type,omitempty"`
	CreatedAt         string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Id                string `url:"id,omitempty" json:"id,omitempty"`
	ReasonDescription string `url:"reason_description,omitempty" json:"reason_description,omitempty"`
	ReasonType        string `url:"reason_type,omitempty" json:"reason_type,omitempty"`
	ResourceReference string `url:"resource_reference,omitempty" json:"resource_reference,omitempty"`
	UpdatedAt         string `url:"updated_at,omitempty" json:"updated_at,omitempty"`
}

Block model

type BlockBlockByRefParams

type BlockBlockByRefParams struct {
	Active            bool   `url:"active,omitempty" json:"active,omitempty"`
	ReasonDescription string `url:"reason_description,omitempty" json:"reason_description,omitempty"`
	ReasonType        string `url:"reason_type,omitempty" json:"reason_type,omitempty"`
	ReferenceType     string `url:"reference_type,omitempty" json:"reference_type,omitempty"`
	ReferenceValue    string `url:"reference_value,omitempty" json:"reference_value,omitempty"`
}

BlockBlockByRefParams parameters

type BlockBlockByRefResult

type BlockBlockByRefResult struct {
	Blocks []struct {
		Active            bool   `url:"active,omitempty" json:"active,omitempty"`
		BlockType         string `url:"block_type,omitempty" json:"block_type,omitempty"`
		CreatedAt         string `url:"created_at,omitempty" json:"created_at,omitempty"`
		Id                string `url:"id,omitempty" json:"id,omitempty"`
		ReasonDescription string `url:"reason_description,omitempty" json:"reason_description,omitempty"`
		ReasonType        string `url:"reason_type,omitempty" json:"reason_type,omitempty"`
		ResourceReference string `url:"resource_reference,omitempty" json:"resource_reference,omitempty"`
		UpdatedAt         string `url:"updated_at,omitempty" json:"updated_at,omitempty"`
	} `url:"blocks,omitempty" json:"blocks,omitempty"`
	Meta struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `url:"meta,omitempty" json:"meta,omitempty"`
}

type BlockCreateParams

type BlockCreateParams struct {
	Active            bool   `url:"active,omitempty" json:"active,omitempty"`
	BlockType         string `url:"block_type,omitempty" json:"block_type,omitempty"`
	ReasonDescription string `url:"reason_description,omitempty" json:"reason_description,omitempty"`
	ReasonType        string `url:"reason_type,omitempty" json:"reason_type,omitempty"`
	ResourceReference string `url:"resource_reference,omitempty" json:"resource_reference,omitempty"`
}

BlockCreateParams parameters

type BlockListPagingIterator

type BlockListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*BlockListPagingIterator) Next

func (c *BlockListPagingIterator) Next() bool

func (*BlockListPagingIterator) Value

type BlockListParams

type BlockListParams struct {
	After      string `url:"after,omitempty" json:"after,omitempty"`
	Before     string `url:"before,omitempty" json:"before,omitempty"`
	Block      string `url:"block,omitempty" json:"block,omitempty"`
	BlockType  string `url:"block_type,omitempty" json:"block_type,omitempty"`
	CreatedAt  string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Limit      int    `url:"limit,omitempty" json:"limit,omitempty"`
	ReasonType string `url:"reason_type,omitempty" json:"reason_type,omitempty"`
	UpdatedAt  string `url:"updated_at,omitempty" json:"updated_at,omitempty"`
}

BlockListParams parameters

type BlockListResult

type BlockListResult struct {
	Blocks []Block `json:"blocks"`
	Meta   struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

BlockListResult response including pagination metadata

type BlockService

type BlockService struct {
	// contains filtered or unexported fields
}

BlockService manages blocks

func (*BlockService) All

func (*BlockService) BlockByRef

BlockByRef Creates new blocks for a given reference. By default blocks will be active. Returns 201 if at least one block was created. Returns 200 if there were no new blocks created.

func (*BlockService) Create

func (s *BlockService) Create(ctx context.Context, p BlockCreateParams, opts ...RequestOption) (*Block, error)

Create Creates a new Block of a given type. By default it will be active.

func (*BlockService) Disable

func (s *BlockService) Disable(ctx context.Context, identity string, opts ...RequestOption) (*Block, error)

Disable Disables a block so that it no longer will prevent mandate creation.

func (*BlockService) Enable

func (s *BlockService) Enable(ctx context.Context, identity string, opts ...RequestOption) (*Block, error)

Enable Enables a previously disabled block so that it will prevent mandate creation

func (*BlockService) Get

func (s *BlockService) Get(ctx context.Context, identity string, opts ...RequestOption) (*Block, error)

Get Retrieves the details of an existing block.

func (*BlockService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your blocks.

type Creditor

type Creditor struct {
	AddressLine1              string `url:"address_line1,omitempty" json:"address_line1,omitempty"`
	AddressLine2              string `url:"address_line2,omitempty" json:"address_line2,omitempty"`
	AddressLine3              string `url:"address_line3,omitempty" json:"address_line3,omitempty"`
	CanCreateRefunds          bool   `url:"can_create_refunds,omitempty" json:"can_create_refunds,omitempty"`
	City                      string `url:"city,omitempty" json:"city,omitempty"`
	CountryCode               string `url:"country_code,omitempty" json:"country_code,omitempty"`
	CreatedAt                 string `url:"created_at,omitempty" json:"created_at,omitempty"`
	CustomPaymentPagesEnabled bool   `url:"custom_payment_pages_enabled,omitempty" json:"custom_payment_pages_enabled,omitempty"`
	FxPayoutCurrency          string `url:"fx_payout_currency,omitempty" json:"fx_payout_currency,omitempty"`
	Id                        string `url:"id,omitempty" json:"id,omitempty"`
	Links                     struct {
		DefaultAudPayoutAccount string `url:"default_aud_payout_account,omitempty" json:"default_aud_payout_account,omitempty"`
		DefaultCadPayoutAccount string `url:"default_cad_payout_account,omitempty" json:"default_cad_payout_account,omitempty"`
		DefaultDkkPayoutAccount string `url:"default_dkk_payout_account,omitempty" json:"default_dkk_payout_account,omitempty"`
		DefaultEurPayoutAccount string `url:"default_eur_payout_account,omitempty" json:"default_eur_payout_account,omitempty"`
		DefaultGbpPayoutAccount string `url:"default_gbp_payout_account,omitempty" json:"default_gbp_payout_account,omitempty"`
		DefaultNzdPayoutAccount string `url:"default_nzd_payout_account,omitempty" json:"default_nzd_payout_account,omitempty"`
		DefaultSekPayoutAccount string `url:"default_sek_payout_account,omitempty" json:"default_sek_payout_account,omitempty"`
		DefaultUsdPayoutAccount string `url:"default_usd_payout_account,omitempty" json:"default_usd_payout_account,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	LogoUrl                             string `url:"logo_url,omitempty" json:"logo_url,omitempty"`
	MandateImportsEnabled               bool   `url:"mandate_imports_enabled,omitempty" json:"mandate_imports_enabled,omitempty"`
	MerchantResponsibleForNotifications bool   `url:"merchant_responsible_for_notifications,omitempty" json:"merchant_responsible_for_notifications,omitempty"`
	Name                                string `url:"name,omitempty" json:"name,omitempty"`
	PostalCode                          string `url:"postal_code,omitempty" json:"postal_code,omitempty"`
	Region                              string `url:"region,omitempty" json:"region,omitempty"`
	SchemeIdentifiers                   []struct {
		AddressLine1               string `url:"address_line1,omitempty" json:"address_line1,omitempty"`
		AddressLine2               string `url:"address_line2,omitempty" json:"address_line2,omitempty"`
		AddressLine3               string `url:"address_line3,omitempty" json:"address_line3,omitempty"`
		CanSpecifyMandateReference bool   `url:"can_specify_mandate_reference,omitempty" json:"can_specify_mandate_reference,omitempty"`
		City                       string `url:"city,omitempty" json:"city,omitempty"`
		CountryCode                string `url:"country_code,omitempty" json:"country_code,omitempty"`
		Currency                   string `url:"currency,omitempty" json:"currency,omitempty"`
		Email                      string `url:"email,omitempty" json:"email,omitempty"`
		MinimumAdvanceNotice       int    `url:"minimum_advance_notice,omitempty" json:"minimum_advance_notice,omitempty"`
		Name                       string `url:"name,omitempty" json:"name,omitempty"`
		PhoneNumber                string `url:"phone_number,omitempty" json:"phone_number,omitempty"`
		PostalCode                 string `url:"postal_code,omitempty" json:"postal_code,omitempty"`
		Reference                  string `url:"reference,omitempty" json:"reference,omitempty"`
		Region                     string `url:"region,omitempty" json:"region,omitempty"`
		Scheme                     string `url:"scheme,omitempty" json:"scheme,omitempty"`
	} `url:"scheme_identifiers,omitempty" json:"scheme_identifiers,omitempty"`
	VerificationStatus string `url:"verification_status,omitempty" json:"verification_status,omitempty"`
}

Creditor model

type CreditorBankAccount

type CreditorBankAccount struct {
	AccountHolderName   string `url:"account_holder_name,omitempty" json:"account_holder_name,omitempty"`
	AccountNumberEnding string `url:"account_number_ending,omitempty" json:"account_number_ending,omitempty"`
	AccountType         string `url:"account_type,omitempty" json:"account_type,omitempty"`
	BankName            string `url:"bank_name,omitempty" json:"bank_name,omitempty"`
	CountryCode         string `url:"country_code,omitempty" json:"country_code,omitempty"`
	CreatedAt           string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Currency            string `url:"currency,omitempty" json:"currency,omitempty"`
	Enabled             bool   `url:"enabled,omitempty" json:"enabled,omitempty"`
	Id                  string `url:"id,omitempty" json:"id,omitempty"`
	Links               struct {
		Creditor string `url:"creditor,omitempty" json:"creditor,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

CreditorBankAccount model

type CreditorBankAccountCreateParams

type CreditorBankAccountCreateParams struct {
	AccountHolderName string `url:"account_holder_name,omitempty" json:"account_holder_name,omitempty"`
	AccountNumber     string `url:"account_number,omitempty" json:"account_number,omitempty"`
	AccountType       string `url:"account_type,omitempty" json:"account_type,omitempty"`
	BankCode          string `url:"bank_code,omitempty" json:"bank_code,omitempty"`
	BranchCode        string `url:"branch_code,omitempty" json:"branch_code,omitempty"`
	CountryCode       string `url:"country_code,omitempty" json:"country_code,omitempty"`
	Currency          string `url:"currency,omitempty" json:"currency,omitempty"`
	Iban              string `url:"iban,omitempty" json:"iban,omitempty"`
	Links             struct {
		Creditor string `url:"creditor,omitempty" json:"creditor,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata                  map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	SetAsDefaultPayoutAccount bool                   `url:"set_as_default_payout_account,omitempty" json:"set_as_default_payout_account,omitempty"`
}

CreditorBankAccountCreateParams parameters

type CreditorBankAccountListPagingIterator

type CreditorBankAccountListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*CreditorBankAccountListPagingIterator) Next

func (*CreditorBankAccountListPagingIterator) Value

type CreditorBankAccountListParams

type CreditorBankAccountListParams struct {
	After     string `url:"after,omitempty" json:"after,omitempty"`
	Before    string `url:"before,omitempty" json:"before,omitempty"`
	CreatedAt struct {
		Gt  string `url:"gt,omitempty" json:"gt,omitempty"`
		Gte string `url:"gte,omitempty" json:"gte,omitempty"`
		Lt  string `url:"lt,omitempty" json:"lt,omitempty"`
		Lte string `url:"lte,omitempty" json:"lte,omitempty"`
	} `url:"created_at,omitempty" json:"created_at,omitempty"`
	Creditor string `url:"creditor,omitempty" json:"creditor,omitempty"`
	Enabled  bool   `url:"enabled,omitempty" json:"enabled,omitempty"`
	Limit    int    `url:"limit,omitempty" json:"limit,omitempty"`
}

CreditorBankAccountListParams parameters

type CreditorBankAccountListResult

type CreditorBankAccountListResult struct {
	CreditorBankAccounts []CreditorBankAccount `json:"creditor_bank_accounts"`
	Meta                 struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

CreditorBankAccountListResult response including pagination metadata

type CreditorBankAccountService

type CreditorBankAccountService struct {
	// contains filtered or unexported fields
}

CreditorBankAccountService manages creditor_bank_accounts

func (*CreditorBankAccountService) Create

Create Creates a new creditor bank account object.

func (*CreditorBankAccountService) Disable

Disable Immediately disables the bank account, no money can be paid out to a disabled account.

This will return a `disable_failed` error if the bank account has already been disabled.

A disabled bank account can be re-enabled by creating a new bank account resource with the same details.

func (*CreditorBankAccountService) Get

Get Retrieves the details of an existing creditor bank account.

func (*CreditorBankAccountService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your creditor bank accounts.

type CreditorCreateParams

type CreditorCreateParams struct {
	AddressLine1 string                 `url:"address_line1,omitempty" json:"address_line1,omitempty"`
	AddressLine2 string                 `url:"address_line2,omitempty" json:"address_line2,omitempty"`
	AddressLine3 string                 `url:"address_line3,omitempty" json:"address_line3,omitempty"`
	City         string                 `url:"city,omitempty" json:"city,omitempty"`
	CountryCode  string                 `url:"country_code,omitempty" json:"country_code,omitempty"`
	Links        map[string]interface{} `url:"links,omitempty" json:"links,omitempty"`
	Name         string                 `url:"name,omitempty" json:"name,omitempty"`
	PostalCode   string                 `url:"postal_code,omitempty" json:"postal_code,omitempty"`
	Region       string                 `url:"region,omitempty" json:"region,omitempty"`
}

CreditorCreateParams parameters

type CreditorGetParams

type CreditorGetParams map[string]interface{}

CreditorGetParams parameters

type CreditorListPagingIterator

type CreditorListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*CreditorListPagingIterator) Next

func (c *CreditorListPagingIterator) Next() bool

func (*CreditorListPagingIterator) Value

type CreditorListParams

type CreditorListParams struct {
	After     string `url:"after,omitempty" json:"after,omitempty"`
	Before    string `url:"before,omitempty" json:"before,omitempty"`
	CreatedAt struct {
		Gt  string `url:"gt,omitempty" json:"gt,omitempty"`
		Gte string `url:"gte,omitempty" json:"gte,omitempty"`
		Lt  string `url:"lt,omitempty" json:"lt,omitempty"`
		Lte string `url:"lte,omitempty" json:"lte,omitempty"`
	} `url:"created_at,omitempty" json:"created_at,omitempty"`
	Limit int `url:"limit,omitempty" json:"limit,omitempty"`
}

CreditorListParams parameters

type CreditorListResult

type CreditorListResult struct {
	Creditors []Creditor `json:"creditors"`
	Meta      struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

CreditorListResult response including pagination metadata

type CreditorService

type CreditorService struct {
	// contains filtered or unexported fields
}

CreditorService manages creditors

func (*CreditorService) All

func (*CreditorService) Create

Create Creates a new creditor.

func (*CreditorService) Get

func (s *CreditorService) Get(ctx context.Context, identity string, p CreditorGetParams, opts ...RequestOption) (*Creditor, error)

Get Retrieves the details of an existing creditor.

func (*CreditorService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your creditors.

func (*CreditorService) Update

func (s *CreditorService) Update(ctx context.Context, identity string, p CreditorUpdateParams, opts ...RequestOption) (*Creditor, error)

Update Updates a creditor object. Supports all of the fields supported when creating a creditor.

type CreditorUpdateParams

type CreditorUpdateParams struct {
	AddressLine1 string `url:"address_line1,omitempty" json:"address_line1,omitempty"`
	AddressLine2 string `url:"address_line2,omitempty" json:"address_line2,omitempty"`
	AddressLine3 string `url:"address_line3,omitempty" json:"address_line3,omitempty"`
	City         string `url:"city,omitempty" json:"city,omitempty"`
	CountryCode  string `url:"country_code,omitempty" json:"country_code,omitempty"`
	Links        struct {
		DefaultAudPayoutAccount string `url:"default_aud_payout_account,omitempty" json:"default_aud_payout_account,omitempty"`
		DefaultCadPayoutAccount string `url:"default_cad_payout_account,omitempty" json:"default_cad_payout_account,omitempty"`
		DefaultDkkPayoutAccount string `url:"default_dkk_payout_account,omitempty" json:"default_dkk_payout_account,omitempty"`
		DefaultEurPayoutAccount string `url:"default_eur_payout_account,omitempty" json:"default_eur_payout_account,omitempty"`
		DefaultGbpPayoutAccount string `url:"default_gbp_payout_account,omitempty" json:"default_gbp_payout_account,omitempty"`
		DefaultNzdPayoutAccount string `url:"default_nzd_payout_account,omitempty" json:"default_nzd_payout_account,omitempty"`
		DefaultSekPayoutAccount string `url:"default_sek_payout_account,omitempty" json:"default_sek_payout_account,omitempty"`
		DefaultUsdPayoutAccount string `url:"default_usd_payout_account,omitempty" json:"default_usd_payout_account,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Name       string `url:"name,omitempty" json:"name,omitempty"`
	PostalCode string `url:"postal_code,omitempty" json:"postal_code,omitempty"`
	Region     string `url:"region,omitempty" json:"region,omitempty"`
}

CreditorUpdateParams parameters

type CurrencyExchangeRate

type CurrencyExchangeRate struct {
	Rate   string `url:"rate,omitempty" json:"rate,omitempty"`
	Source string `url:"source,omitempty" json:"source,omitempty"`
	Target string `url:"target,omitempty" json:"target,omitempty"`
	Time   string `url:"time,omitempty" json:"time,omitempty"`
}

CurrencyExchangeRate model

type CurrencyExchangeRateListPagingIterator

type CurrencyExchangeRateListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*CurrencyExchangeRateListPagingIterator) Next

func (*CurrencyExchangeRateListPagingIterator) Value

type CurrencyExchangeRateListParams

type CurrencyExchangeRateListParams struct {
	After     string `url:"after,omitempty" json:"after,omitempty"`
	Before    string `url:"before,omitempty" json:"before,omitempty"`
	CreatedAt struct {
		Gt  string `url:"gt,omitempty" json:"gt,omitempty"`
		Gte string `url:"gte,omitempty" json:"gte,omitempty"`
		Lt  string `url:"lt,omitempty" json:"lt,omitempty"`
		Lte string `url:"lte,omitempty" json:"lte,omitempty"`
	} `url:"created_at,omitempty" json:"created_at,omitempty"`
	Limit  int    `url:"limit,omitempty" json:"limit,omitempty"`
	Source string `url:"source,omitempty" json:"source,omitempty"`
	Target string `url:"target,omitempty" json:"target,omitempty"`
}

CurrencyExchangeRateListParams parameters

type CurrencyExchangeRateListResult

type CurrencyExchangeRateListResult struct {
	CurrencyExchangeRates []CurrencyExchangeRate `json:"currency_exchange_rates"`
	Meta                  struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

CurrencyExchangeRateListResult response including pagination metadata

type CurrencyExchangeRateService

type CurrencyExchangeRateService struct {
	// contains filtered or unexported fields
}

CurrencyExchangeRateService manages currency_exchange_rates

func (*CurrencyExchangeRateService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of all exchange rates.

type Customer

type Customer struct {
	AddressLine1          string                 `url:"address_line1,omitempty" json:"address_line1,omitempty"`
	AddressLine2          string                 `url:"address_line2,omitempty" json:"address_line2,omitempty"`
	AddressLine3          string                 `url:"address_line3,omitempty" json:"address_line3,omitempty"`
	City                  string                 `url:"city,omitempty" json:"city,omitempty"`
	CompanyName           string                 `url:"company_name,omitempty" json:"company_name,omitempty"`
	CountryCode           string                 `url:"country_code,omitempty" json:"country_code,omitempty"`
	CreatedAt             string                 `url:"created_at,omitempty" json:"created_at,omitempty"`
	DanishIdentityNumber  string                 `url:"danish_identity_number,omitempty" json:"danish_identity_number,omitempty"`
	Email                 string                 `url:"email,omitempty" json:"email,omitempty"`
	FamilyName            string                 `url:"family_name,omitempty" json:"family_name,omitempty"`
	GivenName             string                 `url:"given_name,omitempty" json:"given_name,omitempty"`
	Id                    string                 `url:"id,omitempty" json:"id,omitempty"`
	Language              string                 `url:"language,omitempty" json:"language,omitempty"`
	Metadata              map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	PhoneNumber           string                 `url:"phone_number,omitempty" json:"phone_number,omitempty"`
	PostalCode            string                 `url:"postal_code,omitempty" json:"postal_code,omitempty"`
	Region                string                 `url:"region,omitempty" json:"region,omitempty"`
	SwedishIdentityNumber string                 `url:"swedish_identity_number,omitempty" json:"swedish_identity_number,omitempty"`
}

Customer model

type CustomerBankAccount

type CustomerBankAccount struct {
	AccountHolderName   string `url:"account_holder_name,omitempty" json:"account_holder_name,omitempty"`
	AccountNumberEnding string `url:"account_number_ending,omitempty" json:"account_number_ending,omitempty"`
	AccountType         string `url:"account_type,omitempty" json:"account_type,omitempty"`
	BankName            string `url:"bank_name,omitempty" json:"bank_name,omitempty"`
	CountryCode         string `url:"country_code,omitempty" json:"country_code,omitempty"`
	CreatedAt           string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Currency            string `url:"currency,omitempty" json:"currency,omitempty"`
	Enabled             bool   `url:"enabled,omitempty" json:"enabled,omitempty"`
	Id                  string `url:"id,omitempty" json:"id,omitempty"`
	Links               struct {
		Customer string `url:"customer,omitempty" json:"customer,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

CustomerBankAccount model

type CustomerBankAccountCreateParams

type CustomerBankAccountCreateParams struct {
	AccountHolderName string `url:"account_holder_name,omitempty" json:"account_holder_name,omitempty"`
	AccountNumber     string `url:"account_number,omitempty" json:"account_number,omitempty"`
	AccountType       string `url:"account_type,omitempty" json:"account_type,omitempty"`
	BankCode          string `url:"bank_code,omitempty" json:"bank_code,omitempty"`
	BranchCode        string `url:"branch_code,omitempty" json:"branch_code,omitempty"`
	CountryCode       string `url:"country_code,omitempty" json:"country_code,omitempty"`
	Currency          string `url:"currency,omitempty" json:"currency,omitempty"`
	Iban              string `url:"iban,omitempty" json:"iban,omitempty"`
	Links             struct {
		Customer                 string `url:"customer,omitempty" json:"customer,omitempty"`
		CustomerBankAccountToken string `url:"customer_bank_account_token,omitempty" json:"customer_bank_account_token,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

CustomerBankAccountCreateParams parameters

type CustomerBankAccountListPagingIterator

type CustomerBankAccountListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*CustomerBankAccountListPagingIterator) Next

func (*CustomerBankAccountListPagingIterator) Value

type CustomerBankAccountListParams

type CustomerBankAccountListParams struct {
	After     string `url:"after,omitempty" json:"after,omitempty"`
	Before    string `url:"before,omitempty" json:"before,omitempty"`
	CreatedAt struct {
		Gt  string `url:"gt,omitempty" json:"gt,omitempty"`
		Gte string `url:"gte,omitempty" json:"gte,omitempty"`
		Lt  string `url:"lt,omitempty" json:"lt,omitempty"`
		Lte string `url:"lte,omitempty" json:"lte,omitempty"`
	} `url:"created_at,omitempty" json:"created_at,omitempty"`
	Customer string `url:"customer,omitempty" json:"customer,omitempty"`
	Enabled  bool   `url:"enabled,omitempty" json:"enabled,omitempty"`
	Limit    int    `url:"limit,omitempty" json:"limit,omitempty"`
}

CustomerBankAccountListParams parameters

type CustomerBankAccountListResult

type CustomerBankAccountListResult struct {
	CustomerBankAccounts []CustomerBankAccount `json:"customer_bank_accounts"`
	Meta                 struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

CustomerBankAccountListResult response including pagination metadata

type CustomerBankAccountService

type CustomerBankAccountService struct {
	// contains filtered or unexported fields
}

CustomerBankAccountService manages customer_bank_accounts

func (*CustomerBankAccountService) Create

Create Creates a new customer bank account object.

There are three different ways to supply bank account details:

- [Local details](#appendix-local-bank-details)

- IBAN

- [Customer Bank Account Tokens](#javascript-flow-create-a-customer-bank-account-token)

For more information on the different fields required in each country, see [local bank details](#appendix-local-bank-details).

func (*CustomerBankAccountService) Disable

Disable Immediately cancels all associated mandates and cancellable payments.

This will return a `disable_failed` error if the bank account has already been disabled.

A disabled bank account can be re-enabled by creating a new bank account resource with the same details.

func (*CustomerBankAccountService) Get

Get Retrieves the details of an existing bank account.

func (*CustomerBankAccountService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your bank accounts.

func (*CustomerBankAccountService) Update

Update Updates a customer bank account object. Only the metadata parameter is allowed.

type CustomerBankAccountUpdateParams

type CustomerBankAccountUpdateParams struct {
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

CustomerBankAccountUpdateParams parameters

type CustomerCreateParams

type CustomerCreateParams struct {
	AddressLine1          string                 `url:"address_line1,omitempty" json:"address_line1,omitempty"`
	AddressLine2          string                 `url:"address_line2,omitempty" json:"address_line2,omitempty"`
	AddressLine3          string                 `url:"address_line3,omitempty" json:"address_line3,omitempty"`
	City                  string                 `url:"city,omitempty" json:"city,omitempty"`
	CompanyName           string                 `url:"company_name,omitempty" json:"company_name,omitempty"`
	CountryCode           string                 `url:"country_code,omitempty" json:"country_code,omitempty"`
	DanishIdentityNumber  string                 `url:"danish_identity_number,omitempty" json:"danish_identity_number,omitempty"`
	Email                 string                 `url:"email,omitempty" json:"email,omitempty"`
	FamilyName            string                 `url:"family_name,omitempty" json:"family_name,omitempty"`
	GivenName             string                 `url:"given_name,omitempty" json:"given_name,omitempty"`
	Language              string                 `url:"language,omitempty" json:"language,omitempty"`
	Metadata              map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	PhoneNumber           string                 `url:"phone_number,omitempty" json:"phone_number,omitempty"`
	PostalCode            string                 `url:"postal_code,omitempty" json:"postal_code,omitempty"`
	Region                string                 `url:"region,omitempty" json:"region,omitempty"`
	SwedishIdentityNumber string                 `url:"swedish_identity_number,omitempty" json:"swedish_identity_number,omitempty"`
}

CustomerCreateParams parameters

type CustomerListPagingIterator

type CustomerListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*CustomerListPagingIterator) Next

func (c *CustomerListPagingIterator) Next() bool

func (*CustomerListPagingIterator) Value

type CustomerListParams

type CustomerListParams struct {
	After     string `url:"after,omitempty" json:"after,omitempty"`
	Before    string `url:"before,omitempty" json:"before,omitempty"`
	CreatedAt struct {
		Gt  string `url:"gt,omitempty" json:"gt,omitempty"`
		Gte string `url:"gte,omitempty" json:"gte,omitempty"`
		Lt  string `url:"lt,omitempty" json:"lt,omitempty"`
		Lte string `url:"lte,omitempty" json:"lte,omitempty"`
	} `url:"created_at,omitempty" json:"created_at,omitempty"`
	Currency      string `url:"currency,omitempty" json:"currency,omitempty"`
	Limit         int    `url:"limit,omitempty" json:"limit,omitempty"`
	SortDirection string `url:"sort_direction,omitempty" json:"sort_direction,omitempty"`
	SortField     string `url:"sort_field,omitempty" json:"sort_field,omitempty"`
}

CustomerListParams parameters

type CustomerListResult

type CustomerListResult struct {
	Customers []Customer `json:"customers"`
	Meta      struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

CustomerListResult response including pagination metadata

type CustomerNotification

type CustomerNotification struct {
	ActionTaken   string `url:"action_taken,omitempty" json:"action_taken,omitempty"`
	ActionTakenAt string `url:"action_taken_at,omitempty" json:"action_taken_at,omitempty"`
	ActionTakenBy string `url:"action_taken_by,omitempty" json:"action_taken_by,omitempty"`
	Id            string `url:"id,omitempty" json:"id,omitempty"`
	Links         struct {
		Customer     string `url:"customer,omitempty" json:"customer,omitempty"`
		Event        string `url:"event,omitempty" json:"event,omitempty"`
		Mandate      string `url:"mandate,omitempty" json:"mandate,omitempty"`
		Payment      string `url:"payment,omitempty" json:"payment,omitempty"`
		Refund       string `url:"refund,omitempty" json:"refund,omitempty"`
		Subscription string `url:"subscription,omitempty" json:"subscription,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Type string `url:"type,omitempty" json:"type,omitempty"`
}

CustomerNotification model

type CustomerNotificationHandleParams

type CustomerNotificationHandleParams map[string]interface{}

CustomerNotificationHandleParams parameters

type CustomerNotificationService

type CustomerNotificationService struct {
	// contains filtered or unexported fields
}

CustomerNotificationService manages customer_notifications

func (*CustomerNotificationService) Handle

Handle "Handling" a notification means that you have sent the notification yourself (and don't want GoCardless to send it). If the notification has already been actioned, or the deadline to notify has passed, this endpoint will return an `already_actioned` error and you should not take further action. This endpoint takes no additional parameters.

type CustomerRemoveParams

type CustomerRemoveParams map[string]interface{}

CustomerRemoveParams parameters

type CustomerService

type CustomerService struct {
	// contains filtered or unexported fields
}

CustomerService manages customers

func (*CustomerService) All

func (*CustomerService) Create

Create Creates a new customer object.

func (*CustomerService) Get

func (s *CustomerService) Get(ctx context.Context, identity string, opts ...RequestOption) (*Customer, error)

Get Retrieves the details of an existing customer.

func (*CustomerService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your customers.

func (*CustomerService) Remove

func (s *CustomerService) Remove(ctx context.Context, identity string, p CustomerRemoveParams, opts ...RequestOption) (*Customer, error)

Remove Removed customers will not appear in search results or lists of customers (in our API or exports), and it will not be possible to load an individually removed customer by ID.

<p class="restricted-notice"><strong>The action of removing a customer cannot be reversed, so please use with care.</strong></p>

func (*CustomerService) Update

func (s *CustomerService) Update(ctx context.Context, identity string, p CustomerUpdateParams, opts ...RequestOption) (*Customer, error)

Update Updates a customer object. Supports all of the fields supported when creating a customer.

type CustomerUpdateParams

type CustomerUpdateParams struct {
	AddressLine1          string                 `url:"address_line1,omitempty" json:"address_line1,omitempty"`
	AddressLine2          string                 `url:"address_line2,omitempty" json:"address_line2,omitempty"`
	AddressLine3          string                 `url:"address_line3,omitempty" json:"address_line3,omitempty"`
	City                  string                 `url:"city,omitempty" json:"city,omitempty"`
	CompanyName           string                 `url:"company_name,omitempty" json:"company_name,omitempty"`
	CountryCode           string                 `url:"country_code,omitempty" json:"country_code,omitempty"`
	DanishIdentityNumber  string                 `url:"danish_identity_number,omitempty" json:"danish_identity_number,omitempty"`
	Email                 string                 `url:"email,omitempty" json:"email,omitempty"`
	FamilyName            string                 `url:"family_name,omitempty" json:"family_name,omitempty"`
	GivenName             string                 `url:"given_name,omitempty" json:"given_name,omitempty"`
	Language              string                 `url:"language,omitempty" json:"language,omitempty"`
	Metadata              map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	PhoneNumber           string                 `url:"phone_number,omitempty" json:"phone_number,omitempty"`
	PostalCode            string                 `url:"postal_code,omitempty" json:"postal_code,omitempty"`
	Region                string                 `url:"region,omitempty" json:"region,omitempty"`
	SwedishIdentityNumber string                 `url:"swedish_identity_number,omitempty" json:"swedish_identity_number,omitempty"`
}

CustomerUpdateParams parameters

type Event

type Event struct {
	Action                string `url:"action,omitempty" json:"action,omitempty"`
	CreatedAt             string `url:"created_at,omitempty" json:"created_at,omitempty"`
	CustomerNotifications []struct {
		Deadline  string `url:"deadline,omitempty" json:"deadline,omitempty"`
		Id        string `url:"id,omitempty" json:"id,omitempty"`
		Mandatory bool   `url:"mandatory,omitempty" json:"mandatory,omitempty"`
		Type      string `url:"type,omitempty" json:"type,omitempty"`
	} `url:"customer_notifications,omitempty" json:"customer_notifications,omitempty"`
	Details struct {
		BankAccountId    string `url:"bank_account_id,omitempty" json:"bank_account_id,omitempty"`
		Cause            string `url:"cause,omitempty" json:"cause,omitempty"`
		Currency         string `url:"currency,omitempty" json:"currency,omitempty"`
		Description      string `url:"description,omitempty" json:"description,omitempty"`
		NotRetriedReason string `url:"not_retried_reason,omitempty" json:"not_retried_reason,omitempty"`
		Origin           string `url:"origin,omitempty" json:"origin,omitempty"`
		Property         string `url:"property,omitempty" json:"property,omitempty"`
		ReasonCode       string `url:"reason_code,omitempty" json:"reason_code,omitempty"`
		Scheme           string `url:"scheme,omitempty" json:"scheme,omitempty"`
		WillAttemptRetry bool   `url:"will_attempt_retry,omitempty" json:"will_attempt_retry,omitempty"`
	} `url:"details,omitempty" json:"details,omitempty"`
	Id    string `url:"id,omitempty" json:"id,omitempty"`
	Links struct {
		BankAuthorisation           string `url:"bank_authorisation,omitempty" json:"bank_authorisation,omitempty"`
		BillingRequest              string `url:"billing_request,omitempty" json:"billing_request,omitempty"`
		BillingRequestFlow          string `url:"billing_request_flow,omitempty" json:"billing_request_flow,omitempty"`
		Creditor                    string `url:"creditor,omitempty" json:"creditor,omitempty"`
		Customer                    string `url:"customer,omitempty" json:"customer,omitempty"`
		CustomerBankAccount         string `url:"customer_bank_account,omitempty" json:"customer_bank_account,omitempty"`
		InstalmentSchedule          string `url:"instalment_schedule,omitempty" json:"instalment_schedule,omitempty"`
		Mandate                     string `url:"mandate,omitempty" json:"mandate,omitempty"`
		MandateRequestMandate       string `url:"mandate_request_mandate,omitempty" json:"mandate_request_mandate,omitempty"`
		NewCustomerBankAccount      string `url:"new_customer_bank_account,omitempty" json:"new_customer_bank_account,omitempty"`
		NewMandate                  string `url:"new_mandate,omitempty" json:"new_mandate,omitempty"`
		Organisation                string `url:"organisation,omitempty" json:"organisation,omitempty"`
		ParentEvent                 string `url:"parent_event,omitempty" json:"parent_event,omitempty"`
		PayerAuthorisation          string `url:"payer_authorisation,omitempty" json:"payer_authorisation,omitempty"`
		Payment                     string `url:"payment,omitempty" json:"payment,omitempty"`
		PaymentRequestPayment       string `url:"payment_request_payment,omitempty" json:"payment_request_payment,omitempty"`
		Payout                      string `url:"payout,omitempty" json:"payout,omitempty"`
		PreviousCustomerBankAccount string `url:"previous_customer_bank_account,omitempty" json:"previous_customer_bank_account,omitempty"`
		Refund                      string `url:"refund,omitempty" json:"refund,omitempty"`
		Subscription                string `url:"subscription,omitempty" json:"subscription,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata     map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	ResourceType string                 `url:"resource_type,omitempty" json:"resource_type,omitempty"`
}

Event model

type EventHandler

type EventHandler interface {
	HandleEvent(Event) error
}

EventHandler is the interface that must be implemented to handle events from a webhook.

type EventHandlerFunc

type EventHandlerFunc func(Event) error

EventHandlerFunc can be used to convert a function into an EventHandler

func (EventHandlerFunc) HandleEvent

func (h EventHandlerFunc) HandleEvent(e Event) error

HandleEvent will call the EventHandlerFunc function

type EventListPagingIterator

type EventListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*EventListPagingIterator) Next

func (c *EventListPagingIterator) Next() bool

func (*EventListPagingIterator) Value

type EventListParams

type EventListParams struct {
	Action         string `url:"action,omitempty" json:"action,omitempty"`
	After          string `url:"after,omitempty" json:"after,omitempty"`
	Before         string `url:"before,omitempty" json:"before,omitempty"`
	BillingRequest string `url:"billing_request,omitempty" json:"billing_request,omitempty"`
	CreatedAt      struct {
		Gt  string `url:"gt,omitempty" json:"gt,omitempty"`
		Gte string `url:"gte,omitempty" json:"gte,omitempty"`
		Lt  string `url:"lt,omitempty" json:"lt,omitempty"`
		Lte string `url:"lte,omitempty" json:"lte,omitempty"`
	} `url:"created_at,omitempty" json:"created_at,omitempty"`
	Include            string `url:"include,omitempty" json:"include,omitempty"`
	Limit              int    `url:"limit,omitempty" json:"limit,omitempty"`
	Mandate            string `url:"mandate,omitempty" json:"mandate,omitempty"`
	ParentEvent        string `url:"parent_event,omitempty" json:"parent_event,omitempty"`
	PayerAuthorisation string `url:"payer_authorisation,omitempty" json:"payer_authorisation,omitempty"`
	Payment            string `url:"payment,omitempty" json:"payment,omitempty"`
	Payout             string `url:"payout,omitempty" json:"payout,omitempty"`
	Refund             string `url:"refund,omitempty" json:"refund,omitempty"`
	ResourceType       string `url:"resource_type,omitempty" json:"resource_type,omitempty"`
	Subscription       string `url:"subscription,omitempty" json:"subscription,omitempty"`
}

EventListParams parameters

type EventListResult

type EventListResult struct {
	Events []Event `json:"events"`
	Meta   struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

EventListResult response including pagination metadata

type EventService

type EventService struct {
	// contains filtered or unexported fields
}

EventService manages events

func (*EventService) All

func (*EventService) Get

func (s *EventService) Get(ctx context.Context, identity string, opts ...RequestOption) (*Event, error)

Get Retrieves the details of a single event.

func (*EventService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your events.

type InstalmentSchedule

type InstalmentSchedule struct {
	CreatedAt string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Currency  string `url:"currency,omitempty" json:"currency,omitempty"`
	Id        string `url:"id,omitempty" json:"id,omitempty"`
	Links     struct {
		Customer string   `url:"customer,omitempty" json:"customer,omitempty"`
		Mandate  string   `url:"mandate,omitempty" json:"mandate,omitempty"`
		Payments []string `url:"payments,omitempty" json:"payments,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata      map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	Name          string                 `url:"name,omitempty" json:"name,omitempty"`
	PaymentErrors map[string]interface{} `url:"payment_errors,omitempty" json:"payment_errors,omitempty"`
	Status        string                 `url:"status,omitempty" json:"status,omitempty"`
	TotalAmount   int                    `url:"total_amount,omitempty" json:"total_amount,omitempty"`
}

InstalmentSchedule model

type InstalmentScheduleCancelParams

type InstalmentScheduleCancelParams map[string]interface{}

InstalmentScheduleCancelParams parameters

type InstalmentScheduleCreateWithDatesParams

type InstalmentScheduleCreateWithDatesParams struct {
	AppFee      int    `url:"app_fee,omitempty" json:"app_fee,omitempty"`
	Currency    string `url:"currency,omitempty" json:"currency,omitempty"`
	Instalments []struct {
		Amount      int    `url:"amount,omitempty" json:"amount,omitempty"`
		ChargeDate  string `url:"charge_date,omitempty" json:"charge_date,omitempty"`
		Description string `url:"description,omitempty" json:"description,omitempty"`
	} `url:"instalments,omitempty" json:"instalments,omitempty"`
	Links struct {
		Mandate string `url:"mandate,omitempty" json:"mandate,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata         map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	Name             string                 `url:"name,omitempty" json:"name,omitempty"`
	PaymentReference string                 `url:"payment_reference,omitempty" json:"payment_reference,omitempty"`
	RetryIfPossible  bool                   `url:"retry_if_possible,omitempty" json:"retry_if_possible,omitempty"`
	TotalAmount      int                    `url:"total_amount,omitempty" json:"total_amount,omitempty"`
}

InstalmentScheduleCreateWithDatesParams parameters

type InstalmentScheduleCreateWithScheduleParams

type InstalmentScheduleCreateWithScheduleParams struct {
	AppFee      int    `url:"app_fee,omitempty" json:"app_fee,omitempty"`
	Currency    string `url:"currency,omitempty" json:"currency,omitempty"`
	Instalments struct {
		Amounts      []int  `url:"amounts,omitempty" json:"amounts,omitempty"`
		Interval     int    `url:"interval,omitempty" json:"interval,omitempty"`
		IntervalUnit string `url:"interval_unit,omitempty" json:"interval_unit,omitempty"`
		StartDate    string `url:"start_date,omitempty" json:"start_date,omitempty"`
	} `url:"instalments,omitempty" json:"instalments,omitempty"`
	Links struct {
		Mandate string `url:"mandate,omitempty" json:"mandate,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata         map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	Name             string                 `url:"name,omitempty" json:"name,omitempty"`
	PaymentReference string                 `url:"payment_reference,omitempty" json:"payment_reference,omitempty"`
	RetryIfPossible  bool                   `url:"retry_if_possible,omitempty" json:"retry_if_possible,omitempty"`
	TotalAmount      int                    `url:"total_amount,omitempty" json:"total_amount,omitempty"`
}

InstalmentScheduleCreateWithScheduleParams parameters

type InstalmentScheduleListPagingIterator

type InstalmentScheduleListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*InstalmentScheduleListPagingIterator) Next

func (*InstalmentScheduleListPagingIterator) Value

type InstalmentScheduleListParams

type InstalmentScheduleListParams struct {
	After     string `url:"after,omitempty" json:"after,omitempty"`
	Before    string `url:"before,omitempty" json:"before,omitempty"`
	CreatedAt struct {
		Gt  string `url:"gt,omitempty" json:"gt,omitempty"`
		Gte string `url:"gte,omitempty" json:"gte,omitempty"`
		Lt  string `url:"lt,omitempty" json:"lt,omitempty"`
		Lte string `url:"lte,omitempty" json:"lte,omitempty"`
	} `url:"created_at,omitempty" json:"created_at,omitempty"`
	Customer string   `url:"customer,omitempty" json:"customer,omitempty"`
	Limit    int      `url:"limit,omitempty" json:"limit,omitempty"`
	Mandate  string   `url:"mandate,omitempty" json:"mandate,omitempty"`
	Status   []string `url:"status,omitempty" json:"status,omitempty"`
}

InstalmentScheduleListParams parameters

type InstalmentScheduleListResult

type InstalmentScheduleListResult struct {
	InstalmentSchedules []InstalmentSchedule `json:"instalment_schedules"`
	Meta                struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

InstalmentScheduleListResult response including pagination metadata

type InstalmentScheduleService

type InstalmentScheduleService struct {
	// contains filtered or unexported fields
}

InstalmentScheduleService manages instalment_schedules

func (*InstalmentScheduleService) Cancel

Cancel Immediately cancels an instalment schedule; no further payments will be collected for it.

This will fail with a `cancellation_failed` error if the instalment schedule is already cancelled or has completed.

func (*InstalmentScheduleService) CreateWithDates

CreateWithDates Creates a new instalment schedule object, along with the associated payments. This API is recommended if you know the specific dates you wish to charge. Otherwise, please check out the [scheduling version](#instalment-schedules-create-with-schedule).

The `instalments` property is an array of payment properties (`amount` and `charge_date`).

It can take quite a while to create the associated payments, so the API will return the status as `pending` initially. When processing has completed, a subsequent GET request for the instalment schedule will either have the status `success` and link to the created payments, or the status `error` and detailed information about the failures.

func (*InstalmentScheduleService) CreateWithSchedule

CreateWithSchedule Creates a new instalment schedule object, along with the associated payments. This API is recommended if you wish to use the GoCardless scheduling logic. For finer control over the individual dates, please check out the [alternative version](#instalment-schedules-create-with-dates).

It can take quite a while to create the associated payments, so the API will return the status as `pending` initially. When processing has completed, a subsequent GET request for the instalment schedule will either have the status `success` and link to the created payments, or the status `error` and detailed information about the failures.

func (*InstalmentScheduleService) Get

Get Retrieves the details of an existing instalment schedule.

func (*InstalmentScheduleService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your instalment schedules.

func (*InstalmentScheduleService) Update

Update Updates an instalment schedule. This accepts only the metadata parameter.

type InstalmentScheduleUpdateParams

type InstalmentScheduleUpdateParams struct {
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

InstalmentScheduleUpdateParams parameters

type Institution

type Institution struct {
	CountryCode string `url:"country_code,omitempty" json:"country_code,omitempty"`
	IconUrl     string `url:"icon_url,omitempty" json:"icon_url,omitempty"`
	Id          string `url:"id,omitempty" json:"id,omitempty"`
	LogoUrl     string `url:"logo_url,omitempty" json:"logo_url,omitempty"`
	Name        string `url:"name,omitempty" json:"name,omitempty"`
}

Institution model

type InstitutionListParams

type InstitutionListParams struct {
	CountryCode string `url:"country_code,omitempty" json:"country_code,omitempty"`
}

InstitutionListParams parameters

type InstitutionListResult

type InstitutionListResult struct {
	Institutions []Institution `json:"institutions"`
	Meta         struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

InstitutionListResult response including pagination metadata

type InstitutionService

type InstitutionService struct {
	// contains filtered or unexported fields
}

InstitutionService manages institutions

func (*InstitutionService) List

List Returns a list of all supported institutions.

type Mandate

type Mandate struct {
	CreatedAt string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Id        string `url:"id,omitempty" json:"id,omitempty"`
	Links     struct {
		Creditor            string `url:"creditor,omitempty" json:"creditor,omitempty"`
		Customer            string `url:"customer,omitempty" json:"customer,omitempty"`
		CustomerBankAccount string `url:"customer_bank_account,omitempty" json:"customer_bank_account,omitempty"`
		NewMandate          string `url:"new_mandate,omitempty" json:"new_mandate,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata                map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	NextPossibleChargeDate  string                 `url:"next_possible_charge_date,omitempty" json:"next_possible_charge_date,omitempty"`
	PaymentsRequireApproval bool                   `url:"payments_require_approval,omitempty" json:"payments_require_approval,omitempty"`
	Reference               string                 `url:"reference,omitempty" json:"reference,omitempty"`
	Scheme                  string                 `url:"scheme,omitempty" json:"scheme,omitempty"`
	Status                  string                 `url:"status,omitempty" json:"status,omitempty"`
}

Mandate model

type MandateCancelParams

type MandateCancelParams struct {
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

MandateCancelParams parameters

type MandateCreateParams

type MandateCreateParams struct {
	Links struct {
		Creditor            string `url:"creditor,omitempty" json:"creditor,omitempty"`
		CustomerBankAccount string `url:"customer_bank_account,omitempty" json:"customer_bank_account,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata       map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	PayerIpAddress string                 `url:"payer_ip_address,omitempty" json:"payer_ip_address,omitempty"`
	Reference      string                 `url:"reference,omitempty" json:"reference,omitempty"`
	Scheme         string                 `url:"scheme,omitempty" json:"scheme,omitempty"`
}

MandateCreateParams parameters

type MandateImport

type MandateImport struct {
	CreatedAt string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Id        string `url:"id,omitempty" json:"id,omitempty"`
	Scheme    string `url:"scheme,omitempty" json:"scheme,omitempty"`
	Status    string `url:"status,omitempty" json:"status,omitempty"`
}

MandateImport model

type MandateImportCancelParams

type MandateImportCancelParams map[string]interface{}

MandateImportCancelParams parameters

type MandateImportCreateParams

type MandateImportCreateParams struct {
	Scheme string `url:"scheme,omitempty" json:"scheme,omitempty"`
}

MandateImportCreateParams parameters

type MandateImportEntry

type MandateImportEntry struct {
	CreatedAt string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Links     struct {
		Customer            string `url:"customer,omitempty" json:"customer,omitempty"`
		CustomerBankAccount string `url:"customer_bank_account,omitempty" json:"customer_bank_account,omitempty"`
		Mandate             string `url:"mandate,omitempty" json:"mandate,omitempty"`
		MandateImport       string `url:"mandate_import,omitempty" json:"mandate_import,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	RecordIdentifier string `url:"record_identifier,omitempty" json:"record_identifier,omitempty"`
}

MandateImportEntry model

type MandateImportEntryCreateParams

type MandateImportEntryCreateParams struct {
	Amendment struct {
		OriginalCreditorId       string `url:"original_creditor_id,omitempty" json:"original_creditor_id,omitempty"`
		OriginalCreditorName     string `url:"original_creditor_name,omitempty" json:"original_creditor_name,omitempty"`
		OriginalMandateReference string `url:"original_mandate_reference,omitempty" json:"original_mandate_reference,omitempty"`
	} `url:"amendment,omitempty" json:"amendment,omitempty"`
	BankAccount struct {
		AccountHolderName string `url:"account_holder_name,omitempty" json:"account_holder_name,omitempty"`
		AccountNumber     string `url:"account_number,omitempty" json:"account_number,omitempty"`
		BankCode          string `url:"bank_code,omitempty" json:"bank_code,omitempty"`
		BranchCode        string `url:"branch_code,omitempty" json:"branch_code,omitempty"`
		CountryCode       string `url:"country_code,omitempty" json:"country_code,omitempty"`
		Iban              string `url:"iban,omitempty" json:"iban,omitempty"`
	} `url:"bank_account,omitempty" json:"bank_account,omitempty"`
	Customer struct {
		AddressLine1          string `url:"address_line1,omitempty" json:"address_line1,omitempty"`
		AddressLine2          string `url:"address_line2,omitempty" json:"address_line2,omitempty"`
		AddressLine3          string `url:"address_line3,omitempty" json:"address_line3,omitempty"`
		City                  string `url:"city,omitempty" json:"city,omitempty"`
		CompanyName           string `url:"company_name,omitempty" json:"company_name,omitempty"`
		CountryCode           string `url:"country_code,omitempty" json:"country_code,omitempty"`
		DanishIdentityNumber  string `url:"danish_identity_number,omitempty" json:"danish_identity_number,omitempty"`
		Email                 string `url:"email,omitempty" json:"email,omitempty"`
		FamilyName            string `url:"family_name,omitempty" json:"family_name,omitempty"`
		GivenName             string `url:"given_name,omitempty" json:"given_name,omitempty"`
		Language              string `url:"language,omitempty" json:"language,omitempty"`
		PhoneNumber           string `url:"phone_number,omitempty" json:"phone_number,omitempty"`
		PostalCode            string `url:"postal_code,omitempty" json:"postal_code,omitempty"`
		Region                string `url:"region,omitempty" json:"region,omitempty"`
		SwedishIdentityNumber string `url:"swedish_identity_number,omitempty" json:"swedish_identity_number,omitempty"`
	} `url:"customer,omitempty" json:"customer,omitempty"`
	Links struct {
		MandateImport string `url:"mandate_import,omitempty" json:"mandate_import,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	RecordIdentifier string `url:"record_identifier,omitempty" json:"record_identifier,omitempty"`
}

MandateImportEntryCreateParams parameters

type MandateImportEntryListPagingIterator

type MandateImportEntryListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*MandateImportEntryListPagingIterator) Next

func (*MandateImportEntryListPagingIterator) Value

type MandateImportEntryListParams

type MandateImportEntryListParams struct {
	After         string `url:"after,omitempty" json:"after,omitempty"`
	Before        string `url:"before,omitempty" json:"before,omitempty"`
	Limit         int    `url:"limit,omitempty" json:"limit,omitempty"`
	MandateImport string `url:"mandate_import,omitempty" json:"mandate_import,omitempty"`
}

MandateImportEntryListParams parameters

type MandateImportEntryListResult

type MandateImportEntryListResult struct {
	MandateImportEntries []MandateImportEntry `json:"mandate_import_entries"`
	Meta                 struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

MandateImportEntryListResult response including pagination metadata

type MandateImportEntryService

type MandateImportEntryService struct {
	// contains filtered or unexported fields
}

MandateImportEntryService manages mandate_import_entries

func (*MandateImportEntryService) Create

Create For an existing [mandate import](#core-endpoints-mandate-imports), this endpoint can be used to add individual mandates to be imported into GoCardless.

You can add no more than 30,000 rows to a single mandate import. If you attempt to go over this limit, the API will return a `record_limit_exceeded` error.

func (*MandateImportEntryService) List

List For an existing mandate import, this endpoint lists all of the entries attached.

After a mandate import has been submitted, you can use this endpoint to associate records in your system (using the `record_identifier` that you provided when creating the mandate import).

type MandateImportGetParams

type MandateImportGetParams map[string]interface{}

MandateImportGetParams parameters

type MandateImportService

type MandateImportService struct {
	// contains filtered or unexported fields
}

MandateImportService manages mandate_imports

func (*MandateImportService) Cancel

Cancel Cancels the mandate import, which aborts the import process and stops the mandates being set up in GoCardless. Once the import has been cancelled, it can no longer have entries added to it. Mandate imports which have already been submitted or processed cannot be cancelled.

func (*MandateImportService) Create

Create Mandate imports are first created, before mandates are added one-at-a-time, so this endpoint merely signals the start of the import process. Once you've finished adding entries to an import, you should [submit](#mandate-imports-submit-a-mandate-import) it.

func (*MandateImportService) Get

Get Returns a single mandate import.

func (*MandateImportService) Submit

Submit Submits the mandate import, which allows it to be processed by a member of the GoCardless team. Once the import has been submitted, it can no longer have entries added to it.

In our sandbox environment, to aid development, we automatically process mandate imports approximately 10 seconds after they are submitted. This will allow you to test both the "submitted" response and wait for the webhook to confirm the processing has begun.

type MandateImportSubmitParams

type MandateImportSubmitParams map[string]interface{}

MandateImportSubmitParams parameters

type MandateListPagingIterator

type MandateListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*MandateListPagingIterator) Next

func (c *MandateListPagingIterator) Next() bool

func (*MandateListPagingIterator) Value

type MandateListParams

type MandateListParams struct {
	After     string `url:"after,omitempty" json:"after,omitempty"`
	Before    string `url:"before,omitempty" json:"before,omitempty"`
	CreatedAt struct {
		Gt  string `url:"gt,omitempty" json:"gt,omitempty"`
		Gte string `url:"gte,omitempty" json:"gte,omitempty"`
		Lt  string `url:"lt,omitempty" json:"lt,omitempty"`
		Lte string `url:"lte,omitempty" json:"lte,omitempty"`
	} `url:"created_at,omitempty" json:"created_at,omitempty"`
	Creditor            string   `url:"creditor,omitempty" json:"creditor,omitempty"`
	Customer            string   `url:"customer,omitempty" json:"customer,omitempty"`
	CustomerBankAccount string   `url:"customer_bank_account,omitempty" json:"customer_bank_account,omitempty"`
	Limit               int      `url:"limit,omitempty" json:"limit,omitempty"`
	Reference           string   `url:"reference,omitempty" json:"reference,omitempty"`
	Scheme              []string `url:"scheme,omitempty" json:"scheme,omitempty"`
	Status              []string `url:"status,omitempty" json:"status,omitempty"`
}

MandateListParams parameters

type MandateListResult

type MandateListResult struct {
	Mandates []Mandate `json:"mandates"`
	Meta     struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

MandateListResult response including pagination metadata

type MandatePdf

type MandatePdf struct {
	ExpiresAt string `url:"expires_at,omitempty" json:"expires_at,omitempty"`
	Url       string `url:"url,omitempty" json:"url,omitempty"`
}

MandatePdf model

type MandatePdfCreateParams

type MandatePdfCreateParams struct {
	AccountHolderName    string `url:"account_holder_name,omitempty" json:"account_holder_name,omitempty"`
	AccountNumber        string `url:"account_number,omitempty" json:"account_number,omitempty"`
	AccountType          string `url:"account_type,omitempty" json:"account_type,omitempty"`
	AddressLine1         string `url:"address_line1,omitempty" json:"address_line1,omitempty"`
	AddressLine2         string `url:"address_line2,omitempty" json:"address_line2,omitempty"`
	AddressLine3         string `url:"address_line3,omitempty" json:"address_line3,omitempty"`
	BankCode             string `url:"bank_code,omitempty" json:"bank_code,omitempty"`
	Bic                  string `url:"bic,omitempty" json:"bic,omitempty"`
	BranchCode           string `url:"branch_code,omitempty" json:"branch_code,omitempty"`
	City                 string `url:"city,omitempty" json:"city,omitempty"`
	CountryCode          string `url:"country_code,omitempty" json:"country_code,omitempty"`
	DanishIdentityNumber string `url:"danish_identity_number,omitempty" json:"danish_identity_number,omitempty"`
	Iban                 string `url:"iban,omitempty" json:"iban,omitempty"`
	Links                struct {
		Mandate string `url:"mandate,omitempty" json:"mandate,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	MandateReference      string `url:"mandate_reference,omitempty" json:"mandate_reference,omitempty"`
	PayerIpAddress        string `url:"payer_ip_address,omitempty" json:"payer_ip_address,omitempty"`
	PhoneNumber           string `url:"phone_number,omitempty" json:"phone_number,omitempty"`
	PostalCode            string `url:"postal_code,omitempty" json:"postal_code,omitempty"`
	Region                string `url:"region,omitempty" json:"region,omitempty"`
	Scheme                string `url:"scheme,omitempty" json:"scheme,omitempty"`
	SignatureDate         string `url:"signature_date,omitempty" json:"signature_date,omitempty"`
	SubscriptionAmount    int    `url:"subscription_amount,omitempty" json:"subscription_amount,omitempty"`
	SubscriptionFrequency string `url:"subscription_frequency,omitempty" json:"subscription_frequency,omitempty"`
	SwedishIdentityNumber string `url:"swedish_identity_number,omitempty" json:"swedish_identity_number,omitempty"`
}

MandatePdfCreateParams parameters

type MandatePdfService

type MandatePdfService struct {
	// contains filtered or unexported fields
}

MandatePdfService manages mandate_pdfs

func (*MandatePdfService) Create

Create Generates a PDF mandate and returns its temporary URL.

Customer and bank account details can be left blank (for a blank mandate), provided manually, or inferred from the ID of an existing [mandate](#core-endpoints-mandates).

By default, we'll generate PDF mandates in English.

To generate a PDF mandate in another language, set the `Accept-Language` header when creating the PDF mandate to the relevant [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code supported for the scheme.

| Scheme | Supported languages

|

| :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------- | | ACH | English (`en`)

|

| Autogiro | English (`en`), Swedish (`sv`)

|

| Bacs | English (`en`)

|

| BECS | English (`en`)

|

| BECS NZ | English (`en`)

|

| Betalingsservice | Danish (`da`), English (`en`)

|

| PAD | English (`en`)

|

| SEPA Core | Danish (`da`), Dutch (`nl`), English (`en`), French (`fr`), German (`de`), Italian (`it`), Portuguese (`pt`), Spanish (`es`), Swedish (`sv`) |

type MandateReinstateParams

type MandateReinstateParams struct {
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

MandateReinstateParams parameters

type MandateService

type MandateService struct {
	// contains filtered or unexported fields
}

MandateService manages mandates

func (*MandateService) All

func (*MandateService) Cancel

func (s *MandateService) Cancel(ctx context.Context, identity string, p MandateCancelParams, opts ...RequestOption) (*Mandate, error)

Cancel Immediately cancels a mandate and all associated cancellable payments. Any metadata supplied to this endpoint will be stored on the mandate cancellation event it causes.

This will fail with a `cancellation_failed` error if the mandate is already cancelled.

func (*MandateService) Create

Create Creates a new mandate object.

func (*MandateService) Get

func (s *MandateService) Get(ctx context.Context, identity string, opts ...RequestOption) (*Mandate, error)

Get Retrieves the details of an existing mandate.

func (*MandateService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your mandates.

func (*MandateService) Reinstate

func (s *MandateService) Reinstate(ctx context.Context, identity string, p MandateReinstateParams, opts ...RequestOption) (*Mandate, error)

Reinstate <a name="mandate_not_inactive"></a>Reinstates a cancelled or expired mandate to the banks. You will receive a `resubmission_requested` webhook, but after that reinstating the mandate follows the same process as its initial creation, so you will receive a `submitted` webhook, followed by a `reinstated` or `failed` webhook up to two working days later. Any metadata supplied to this endpoint will be stored on the `resubmission_requested` event it causes.

This will fail with a `mandate_not_inactive` error if the mandate is already being submitted, or is active.

Mandates can be resubmitted up to 10 times.

func (*MandateService) Update

func (s *MandateService) Update(ctx context.Context, identity string, p MandateUpdateParams, opts ...RequestOption) (*Mandate, error)

Update Updates a mandate object. This accepts only the metadata parameter.

type MandateUpdateParams

type MandateUpdateParams struct {
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

MandateUpdateParams parameters

type Option

type Option func(*options) error

Option used to initialise the client

func WithClient

func WithClient(c *http.Client) Option

WithClient configures the net/http client

func WithEndpoint

func WithEndpoint(endpoint string) Option

WithEndpoint configures the endpoint hosting the API

type PagingIterator

type PagingIterator interface {
	Next() bool
	Value(context.Context) interface{}
}

type PayerAuthorisation

type PayerAuthorisation struct {
	BankAccount struct {
		AccountHolderName   string                 `url:"account_holder_name,omitempty" json:"account_holder_name,omitempty"`
		AccountNumber       string                 `url:"account_number,omitempty" json:"account_number,omitempty"`
		AccountNumberEnding string                 `url:"account_number_ending,omitempty" json:"account_number_ending,omitempty"`
		AccountNumberSuffix string                 `url:"account_number_suffix,omitempty" json:"account_number_suffix,omitempty"`
		AccountType         string                 `url:"account_type,omitempty" json:"account_type,omitempty"`
		BankCode            string                 `url:"bank_code,omitempty" json:"bank_code,omitempty"`
		BranchCode          string                 `url:"branch_code,omitempty" json:"branch_code,omitempty"`
		CountryCode         string                 `url:"country_code,omitempty" json:"country_code,omitempty"`
		Currency            string                 `url:"currency,omitempty" json:"currency,omitempty"`
		Iban                string                 `url:"iban,omitempty" json:"iban,omitempty"`
		Metadata            map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	} `url:"bank_account,omitempty" json:"bank_account,omitempty"`
	CreatedAt string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Customer  struct {
		AddressLine1          string                 `url:"address_line1,omitempty" json:"address_line1,omitempty"`
		AddressLine2          string                 `url:"address_line2,omitempty" json:"address_line2,omitempty"`
		AddressLine3          string                 `url:"address_line3,omitempty" json:"address_line3,omitempty"`
		City                  string                 `url:"city,omitempty" json:"city,omitempty"`
		CompanyName           string                 `url:"company_name,omitempty" json:"company_name,omitempty"`
		CountryCode           string                 `url:"country_code,omitempty" json:"country_code,omitempty"`
		DanishIdentityNumber  string                 `url:"danish_identity_number,omitempty" json:"danish_identity_number,omitempty"`
		Email                 string                 `url:"email,omitempty" json:"email,omitempty"`
		FamilyName            string                 `url:"family_name,omitempty" json:"family_name,omitempty"`
		GivenName             string                 `url:"given_name,omitempty" json:"given_name,omitempty"`
		Locale                string                 `url:"locale,omitempty" json:"locale,omitempty"`
		Metadata              map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
		PostalCode            string                 `url:"postal_code,omitempty" json:"postal_code,omitempty"`
		Region                string                 `url:"region,omitempty" json:"region,omitempty"`
		SwedishIdentityNumber string                 `url:"swedish_identity_number,omitempty" json:"swedish_identity_number,omitempty"`
	} `url:"customer,omitempty" json:"customer,omitempty"`
	Id               string `url:"id,omitempty" json:"id,omitempty"`
	IncompleteFields []struct {
		Field          string `url:"field,omitempty" json:"field,omitempty"`
		Message        string `url:"message,omitempty" json:"message,omitempty"`
		RequestPointer string `url:"request_pointer,omitempty" json:"request_pointer,omitempty"`
	} `url:"incomplete_fields,omitempty" json:"incomplete_fields,omitempty"`
	Links struct {
		BankAccount string `url:"bank_account,omitempty" json:"bank_account,omitempty"`
		Customer    string `url:"customer,omitempty" json:"customer,omitempty"`
		Mandate     string `url:"mandate,omitempty" json:"mandate,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Mandate struct {
		Metadata       map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
		PayerIpAddress string                 `url:"payer_ip_address,omitempty" json:"payer_ip_address,omitempty"`
		Reference      string                 `url:"reference,omitempty" json:"reference,omitempty"`
		Scheme         string                 `url:"scheme,omitempty" json:"scheme,omitempty"`
	} `url:"mandate,omitempty" json:"mandate,omitempty"`
	Status string `url:"status,omitempty" json:"status,omitempty"`
}

PayerAuthorisation model

type PayerAuthorisationCreateParams

type PayerAuthorisationCreateParams struct {
	BankAccount struct {
		AccountHolderName   string                 `url:"account_holder_name,omitempty" json:"account_holder_name,omitempty"`
		AccountNumber       string                 `url:"account_number,omitempty" json:"account_number,omitempty"`
		AccountNumberEnding string                 `url:"account_number_ending,omitempty" json:"account_number_ending,omitempty"`
		AccountNumberSuffix string                 `url:"account_number_suffix,omitempty" json:"account_number_suffix,omitempty"`
		AccountType         string                 `url:"account_type,omitempty" json:"account_type,omitempty"`
		BankCode            string                 `url:"bank_code,omitempty" json:"bank_code,omitempty"`
		BranchCode          string                 `url:"branch_code,omitempty" json:"branch_code,omitempty"`
		CountryCode         string                 `url:"country_code,omitempty" json:"country_code,omitempty"`
		Currency            string                 `url:"currency,omitempty" json:"currency,omitempty"`
		Iban                string                 `url:"iban,omitempty" json:"iban,omitempty"`
		Metadata            map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	} `url:"bank_account,omitempty" json:"bank_account,omitempty"`
	Customer struct {
		AddressLine1          string                 `url:"address_line1,omitempty" json:"address_line1,omitempty"`
		AddressLine2          string                 `url:"address_line2,omitempty" json:"address_line2,omitempty"`
		AddressLine3          string                 `url:"address_line3,omitempty" json:"address_line3,omitempty"`
		City                  string                 `url:"city,omitempty" json:"city,omitempty"`
		CompanyName           string                 `url:"company_name,omitempty" json:"company_name,omitempty"`
		CountryCode           string                 `url:"country_code,omitempty" json:"country_code,omitempty"`
		DanishIdentityNumber  string                 `url:"danish_identity_number,omitempty" json:"danish_identity_number,omitempty"`
		Email                 string                 `url:"email,omitempty" json:"email,omitempty"`
		FamilyName            string                 `url:"family_name,omitempty" json:"family_name,omitempty"`
		GivenName             string                 `url:"given_name,omitempty" json:"given_name,omitempty"`
		Locale                string                 `url:"locale,omitempty" json:"locale,omitempty"`
		Metadata              map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
		PostalCode            string                 `url:"postal_code,omitempty" json:"postal_code,omitempty"`
		Region                string                 `url:"region,omitempty" json:"region,omitempty"`
		SwedishIdentityNumber string                 `url:"swedish_identity_number,omitempty" json:"swedish_identity_number,omitempty"`
	} `url:"customer,omitempty" json:"customer,omitempty"`
	Mandate struct {
		Metadata       map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
		PayerIpAddress string                 `url:"payer_ip_address,omitempty" json:"payer_ip_address,omitempty"`
		Reference      string                 `url:"reference,omitempty" json:"reference,omitempty"`
		Scheme         string                 `url:"scheme,omitempty" json:"scheme,omitempty"`
	} `url:"mandate,omitempty" json:"mandate,omitempty"`
}

PayerAuthorisationCreateParams parameters

type PayerAuthorisationService

type PayerAuthorisationService struct {
	// contains filtered or unexported fields
}

PayerAuthorisationService manages payer_authorisations

func (*PayerAuthorisationService) Confirm

func (s *PayerAuthorisationService) Confirm(ctx context.Context, identity string, opts ...RequestOption) (*PayerAuthorisation, error)

Confirm Confirms the Payer Authorisation, indicating that the resources are ready to be created. A Payer Authorisation cannot be confirmed if it hasn't been submitted yet.

<p class="notice">

The main use of the confirm endpoint is to enable integrators to

acknowledge the end of the setup process.

They might want to make the payers go through some other steps after they

go through our flow or make them go through the necessary verification mechanism (upcoming feature). </p>

func (*PayerAuthorisationService) Create

Create Creates a Payer Authorisation. The resource is saved to the database even if incomplete. An empty array of incomplete_fields means that the resource is valid. The ID of the resource is used for the other actions. This endpoint has been designed this way so you do not need to save any payer data on your servers or the browser while still being able to implement a progressive solution, such as a multi-step form.

func (*PayerAuthorisationService) Get

Get Retrieves the details of a single existing Payer Authorisation. It can be used for polling the status of a Payer Authorisation.

func (*PayerAuthorisationService) Submit

Submit Submits all the data previously pushed to this PayerAuthorisation for verification. This time, a 200 HTTP status is returned if the resource is valid and a 422 error response in case of validation errors. After it is successfully submitted, the Payer Authorisation can no longer be edited.

func (*PayerAuthorisationService) Update

Update Updates a Payer Authorisation. Updates the Payer Authorisation with the request data. Can be invoked as many times as needed. Only fields present in the request will be modified. An empty array of incomplete_fields means that the resource is valid. This endpoint has been designed this way so you do not need to save any payer data on your servers or the browser while still being able to implement a progressive solution, such a multi-step form. <p class="notice"> Note that in order to update the `metadata` attribute values it must be sent completely as it overrides the previously existing values. </p>

type PayerAuthorisationUpdateParams

type PayerAuthorisationUpdateParams struct {
	BankAccount struct {
		AccountHolderName   string                 `url:"account_holder_name,omitempty" json:"account_holder_name,omitempty"`
		AccountNumber       string                 `url:"account_number,omitempty" json:"account_number,omitempty"`
		AccountNumberEnding string                 `url:"account_number_ending,omitempty" json:"account_number_ending,omitempty"`
		AccountNumberSuffix string                 `url:"account_number_suffix,omitempty" json:"account_number_suffix,omitempty"`
		AccountType         string                 `url:"account_type,omitempty" json:"account_type,omitempty"`
		BankCode            string                 `url:"bank_code,omitempty" json:"bank_code,omitempty"`
		BranchCode          string                 `url:"branch_code,omitempty" json:"branch_code,omitempty"`
		CountryCode         string                 `url:"country_code,omitempty" json:"country_code,omitempty"`
		Currency            string                 `url:"currency,omitempty" json:"currency,omitempty"`
		Iban                string                 `url:"iban,omitempty" json:"iban,omitempty"`
		Metadata            map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	} `url:"bank_account,omitempty" json:"bank_account,omitempty"`
	Customer struct {
		AddressLine1          string                 `url:"address_line1,omitempty" json:"address_line1,omitempty"`
		AddressLine2          string                 `url:"address_line2,omitempty" json:"address_line2,omitempty"`
		AddressLine3          string                 `url:"address_line3,omitempty" json:"address_line3,omitempty"`
		City                  string                 `url:"city,omitempty" json:"city,omitempty"`
		CompanyName           string                 `url:"company_name,omitempty" json:"company_name,omitempty"`
		CountryCode           string                 `url:"country_code,omitempty" json:"country_code,omitempty"`
		DanishIdentityNumber  string                 `url:"danish_identity_number,omitempty" json:"danish_identity_number,omitempty"`
		Email                 string                 `url:"email,omitempty" json:"email,omitempty"`
		FamilyName            string                 `url:"family_name,omitempty" json:"family_name,omitempty"`
		GivenName             string                 `url:"given_name,omitempty" json:"given_name,omitempty"`
		Locale                string                 `url:"locale,omitempty" json:"locale,omitempty"`
		Metadata              map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
		PostalCode            string                 `url:"postal_code,omitempty" json:"postal_code,omitempty"`
		Region                string                 `url:"region,omitempty" json:"region,omitempty"`
		SwedishIdentityNumber string                 `url:"swedish_identity_number,omitempty" json:"swedish_identity_number,omitempty"`
	} `url:"customer,omitempty" json:"customer,omitempty"`
	Mandate struct {
		Metadata       map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
		PayerIpAddress string                 `url:"payer_ip_address,omitempty" json:"payer_ip_address,omitempty"`
		Reference      string                 `url:"reference,omitempty" json:"reference,omitempty"`
		Scheme         string                 `url:"scheme,omitempty" json:"scheme,omitempty"`
	} `url:"mandate,omitempty" json:"mandate,omitempty"`
}

PayerAuthorisationUpdateParams parameters

type Payment

type Payment struct {
	Amount         int    `url:"amount,omitempty" json:"amount,omitempty"`
	AmountRefunded int    `url:"amount_refunded,omitempty" json:"amount_refunded,omitempty"`
	ChargeDate     string `url:"charge_date,omitempty" json:"charge_date,omitempty"`
	CreatedAt      string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Currency       string `url:"currency,omitempty" json:"currency,omitempty"`
	Description    string `url:"description,omitempty" json:"description,omitempty"`
	Fx             struct {
		EstimatedExchangeRate string `url:"estimated_exchange_rate,omitempty" json:"estimated_exchange_rate,omitempty"`
		ExchangeRate          string `url:"exchange_rate,omitempty" json:"exchange_rate,omitempty"`
		FxAmount              int    `url:"fx_amount,omitempty" json:"fx_amount,omitempty"`
		FxCurrency            string `url:"fx_currency,omitempty" json:"fx_currency,omitempty"`
	} `url:"fx,omitempty" json:"fx,omitempty"`
	Id    string `url:"id,omitempty" json:"id,omitempty"`
	Links struct {
		Creditor           string `url:"creditor,omitempty" json:"creditor,omitempty"`
		InstalmentSchedule string `url:"instalment_schedule,omitempty" json:"instalment_schedule,omitempty"`
		Mandate            string `url:"mandate,omitempty" json:"mandate,omitempty"`
		Payout             string `url:"payout,omitempty" json:"payout,omitempty"`
		Subscription       string `url:"subscription,omitempty" json:"subscription,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata        map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	Reference       string                 `url:"reference,omitempty" json:"reference,omitempty"`
	RetryIfPossible bool                   `url:"retry_if_possible,omitempty" json:"retry_if_possible,omitempty"`
	Status          string                 `url:"status,omitempty" json:"status,omitempty"`
}

Payment model

type PaymentCancelParams

type PaymentCancelParams struct {
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

PaymentCancelParams parameters

type PaymentCreateParams

type PaymentCreateParams struct {
	Amount      int    `url:"amount,omitempty" json:"amount,omitempty"`
	AppFee      int    `url:"app_fee,omitempty" json:"app_fee,omitempty"`
	ChargeDate  string `url:"charge_date,omitempty" json:"charge_date,omitempty"`
	Currency    string `url:"currency,omitempty" json:"currency,omitempty"`
	Description string `url:"description,omitempty" json:"description,omitempty"`
	Links       struct {
		Mandate string `url:"mandate,omitempty" json:"mandate,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata        map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	Reference       string                 `url:"reference,omitempty" json:"reference,omitempty"`
	RetryIfPossible bool                   `url:"retry_if_possible,omitempty" json:"retry_if_possible,omitempty"`
}

PaymentCreateParams parameters

type PaymentListPagingIterator

type PaymentListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*PaymentListPagingIterator) Next

func (c *PaymentListPagingIterator) Next() bool

func (*PaymentListPagingIterator) Value

type PaymentListParams

type PaymentListParams struct {
	After      string `url:"after,omitempty" json:"after,omitempty"`
	Before     string `url:"before,omitempty" json:"before,omitempty"`
	ChargeDate struct {
		Gt  string `url:"gt,omitempty" json:"gt,omitempty"`
		Gte string `url:"gte,omitempty" json:"gte,omitempty"`
		Lt  string `url:"lt,omitempty" json:"lt,omitempty"`
		Lte string `url:"lte,omitempty" json:"lte,omitempty"`
	} `url:"charge_date,omitempty" json:"charge_date,omitempty"`
	CreatedAt struct {
		Gt  string `url:"gt,omitempty" json:"gt,omitempty"`
		Gte string `url:"gte,omitempty" json:"gte,omitempty"`
		Lt  string `url:"lt,omitempty" json:"lt,omitempty"`
		Lte string `url:"lte,omitempty" json:"lte,omitempty"`
	} `url:"created_at,omitempty" json:"created_at,omitempty"`
	Creditor      string `url:"creditor,omitempty" json:"creditor,omitempty"`
	Currency      string `url:"currency,omitempty" json:"currency,omitempty"`
	Customer      string `url:"customer,omitempty" json:"customer,omitempty"`
	Limit         int    `url:"limit,omitempty" json:"limit,omitempty"`
	Mandate       string `url:"mandate,omitempty" json:"mandate,omitempty"`
	SortDirection string `url:"sort_direction,omitempty" json:"sort_direction,omitempty"`
	SortField     string `url:"sort_field,omitempty" json:"sort_field,omitempty"`
	Status        string `url:"status,omitempty" json:"status,omitempty"`
	Subscription  string `url:"subscription,omitempty" json:"subscription,omitempty"`
}

PaymentListParams parameters

type PaymentListResult

type PaymentListResult struct {
	Payments []Payment `json:"payments"`
	Meta     struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

PaymentListResult response including pagination metadata

type PaymentRetryParams

type PaymentRetryParams struct {
	ChargeDate string                 `url:"charge_date,omitempty" json:"charge_date,omitempty"`
	Metadata   map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

PaymentRetryParams parameters

type PaymentService

type PaymentService struct {
	// contains filtered or unexported fields
}

PaymentService manages payments

func (*PaymentService) All

func (*PaymentService) Cancel

func (s *PaymentService) Cancel(ctx context.Context, identity string, p PaymentCancelParams, opts ...RequestOption) (*Payment, error)

Cancel Cancels the payment if it has not already been submitted to the banks. Any metadata supplied to this endpoint will be stored on the payment cancellation event it causes.

This will fail with a `cancellation_failed` error unless the payment's status is `pending_submission`.

func (*PaymentService) Create

Create <a name="mandate_is_inactive"></a>Creates a new payment object.

This fails with a `mandate_is_inactive` error if the linked [mandate](#core-endpoints-mandates) is cancelled or has failed. Payments can be created against mandates with status of: `pending_customer_approval`, `pending_submission`, `submitted`, and `active`.

func (*PaymentService) Get

func (s *PaymentService) Get(ctx context.Context, identity string, opts ...RequestOption) (*Payment, error)

Get Retrieves the details of a single existing payment.

func (*PaymentService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your payments.

func (*PaymentService) Retry

func (s *PaymentService) Retry(ctx context.Context, identity string, p PaymentRetryParams, opts ...RequestOption) (*Payment, error)

Retry <a name="retry_failed"></a>Retries a failed payment if the underlying mandate is active. You will receive a `resubmission_requested` webhook, but after that retrying the payment follows the same process as its initial creation, so you will receive a `submitted` webhook, followed by a `confirmed` or `failed` event. Any metadata supplied to this endpoint will be stored against the payment submission event it causes.

This will return a `retry_failed` error if the payment has not failed.

Payments can be retried up to 3 times.

func (*PaymentService) Update

func (s *PaymentService) Update(ctx context.Context, identity string, p PaymentUpdateParams, opts ...RequestOption) (*Payment, error)

Update Updates a payment object. This accepts only the metadata parameter.

type PaymentUpdateParams

type PaymentUpdateParams struct {
	Metadata        map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	RetryIfPossible bool                   `url:"retry_if_possible,omitempty" json:"retry_if_possible,omitempty"`
}

PaymentUpdateParams parameters

type Payout

type Payout struct {
	Amount       int    `url:"amount,omitempty" json:"amount,omitempty"`
	ArrivalDate  string `url:"arrival_date,omitempty" json:"arrival_date,omitempty"`
	CreatedAt    string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Currency     string `url:"currency,omitempty" json:"currency,omitempty"`
	DeductedFees int    `url:"deducted_fees,omitempty" json:"deducted_fees,omitempty"`
	Fx           struct {
		EstimatedExchangeRate string `url:"estimated_exchange_rate,omitempty" json:"estimated_exchange_rate,omitempty"`
		ExchangeRate          string `url:"exchange_rate,omitempty" json:"exchange_rate,omitempty"`
		FxAmount              int    `url:"fx_amount,omitempty" json:"fx_amount,omitempty"`
		FxCurrency            string `url:"fx_currency,omitempty" json:"fx_currency,omitempty"`
	} `url:"fx,omitempty" json:"fx,omitempty"`
	Id    string `url:"id,omitempty" json:"id,omitempty"`
	Links struct {
		Creditor            string `url:"creditor,omitempty" json:"creditor,omitempty"`
		CreditorBankAccount string `url:"creditor_bank_account,omitempty" json:"creditor_bank_account,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata    map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	PayoutType  string                 `url:"payout_type,omitempty" json:"payout_type,omitempty"`
	Reference   string                 `url:"reference,omitempty" json:"reference,omitempty"`
	Status      string                 `url:"status,omitempty" json:"status,omitempty"`
	TaxCurrency string                 `url:"tax_currency,omitempty" json:"tax_currency,omitempty"`
}

Payout model

type PayoutItem

type PayoutItem struct {
	Amount string `url:"amount,omitempty" json:"amount,omitempty"`
	Links  struct {
		Mandate string `url:"mandate,omitempty" json:"mandate,omitempty"`
		Payment string `url:"payment,omitempty" json:"payment,omitempty"`
		Refund  string `url:"refund,omitempty" json:"refund,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Taxes []struct {
		Amount              string `url:"amount,omitempty" json:"amount,omitempty"`
		Currency            string `url:"currency,omitempty" json:"currency,omitempty"`
		DestinationAmount   string `url:"destination_amount,omitempty" json:"destination_amount,omitempty"`
		DestinationCurrency string `url:"destination_currency,omitempty" json:"destination_currency,omitempty"`
		ExchangeRate        string `url:"exchange_rate,omitempty" json:"exchange_rate,omitempty"`
		TaxRateId           string `url:"tax_rate_id,omitempty" json:"tax_rate_id,omitempty"`
	} `url:"taxes,omitempty" json:"taxes,omitempty"`
	Type string `url:"type,omitempty" json:"type,omitempty"`
}

PayoutItem model

type PayoutItemListPagingIterator

type PayoutItemListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*PayoutItemListPagingIterator) Next

func (*PayoutItemListPagingIterator) Value

type PayoutItemListParams

type PayoutItemListParams struct {
	After                 string `url:"after,omitempty" json:"after,omitempty"`
	Before                string `url:"before,omitempty" json:"before,omitempty"`
	Include2020TaxCutover string `url:"include_2020_tax_cutover,omitempty" json:"include_2020_tax_cutover,omitempty"`
	Limit                 int    `url:"limit,omitempty" json:"limit,omitempty"`
	Payout                string `url:"payout,omitempty" json:"payout,omitempty"`
}

PayoutItemListParams parameters

type PayoutItemListResult

type PayoutItemListResult struct {
	PayoutItems []PayoutItem `json:"payout_items"`
	Meta        struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

PayoutItemListResult response including pagination metadata

type PayoutItemService

type PayoutItemService struct {
	// contains filtered or unexported fields
}

PayoutItemService manages payout_items

func (*PayoutItemService) All

func (*PayoutItemService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of items in the payout.

type PayoutListPagingIterator

type PayoutListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*PayoutListPagingIterator) Next

func (c *PayoutListPagingIterator) Next() bool

func (*PayoutListPagingIterator) Value

type PayoutListParams

type PayoutListParams struct {
	After     string `url:"after,omitempty" json:"after,omitempty"`
	Before    string `url:"before,omitempty" json:"before,omitempty"`
	CreatedAt struct {
		Gt  string `url:"gt,omitempty" json:"gt,omitempty"`
		Gte string `url:"gte,omitempty" json:"gte,omitempty"`
		Lt  string `url:"lt,omitempty" json:"lt,omitempty"`
		Lte string `url:"lte,omitempty" json:"lte,omitempty"`
	} `url:"created_at,omitempty" json:"created_at,omitempty"`
	Creditor            string                 `url:"creditor,omitempty" json:"creditor,omitempty"`
	CreditorBankAccount string                 `url:"creditor_bank_account,omitempty" json:"creditor_bank_account,omitempty"`
	Currency            string                 `url:"currency,omitempty" json:"currency,omitempty"`
	Limit               int                    `url:"limit,omitempty" json:"limit,omitempty"`
	Metadata            map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	PayoutType          string                 `url:"payout_type,omitempty" json:"payout_type,omitempty"`
	Reference           string                 `url:"reference,omitempty" json:"reference,omitempty"`
	Status              string                 `url:"status,omitempty" json:"status,omitempty"`
}

PayoutListParams parameters

type PayoutListResult

type PayoutListResult struct {
	Payouts []Payout `json:"payouts"`
	Meta    struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

PayoutListResult response including pagination metadata

type PayoutService

type PayoutService struct {
	// contains filtered or unexported fields
}

PayoutService manages payouts

func (*PayoutService) All

func (*PayoutService) Get

func (s *PayoutService) Get(ctx context.Context, identity string, opts ...RequestOption) (*Payout, error)

Get Retrieves the details of a single payout. For an example of how to reconcile the transactions in a payout, see [this guide](#events-reconciling-payouts-with-events).

func (*PayoutService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your payouts.

func (*PayoutService) Update

func (s *PayoutService) Update(ctx context.Context, identity string, p PayoutUpdateParams, opts ...RequestOption) (*Payout, error)

Update Updates a payout object. This accepts only the metadata parameter.

type PayoutUpdateParams

type PayoutUpdateParams struct {
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

PayoutUpdateParams parameters

type RedirectFlow

type RedirectFlow struct {
	ConfirmationUrl string `url:"confirmation_url,omitempty" json:"confirmation_url,omitempty"`
	CreatedAt       string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Description     string `url:"description,omitempty" json:"description,omitempty"`
	Id              string `url:"id,omitempty" json:"id,omitempty"`
	Links           struct {
		Creditor            string `url:"creditor,omitempty" json:"creditor,omitempty"`
		Customer            string `url:"customer,omitempty" json:"customer,omitempty"`
		CustomerBankAccount string `url:"customer_bank_account,omitempty" json:"customer_bank_account,omitempty"`
		Mandate             string `url:"mandate,omitempty" json:"mandate,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	MandateReference   string                 `url:"mandate_reference,omitempty" json:"mandate_reference,omitempty"`
	Metadata           map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	RedirectUrl        string                 `url:"redirect_url,omitempty" json:"redirect_url,omitempty"`
	Scheme             string                 `url:"scheme,omitempty" json:"scheme,omitempty"`
	SessionToken       string                 `url:"session_token,omitempty" json:"session_token,omitempty"`
	SuccessRedirectUrl string                 `url:"success_redirect_url,omitempty" json:"success_redirect_url,omitempty"`
}

RedirectFlow model

type RedirectFlowCompleteParams

type RedirectFlowCompleteParams struct {
	SessionToken string `url:"session_token,omitempty" json:"session_token,omitempty"`
}

RedirectFlowCompleteParams parameters

type RedirectFlowCreateParams

type RedirectFlowCreateParams struct {
	Description string `url:"description,omitempty" json:"description,omitempty"`
	Links       struct {
		Creditor string `url:"creditor,omitempty" json:"creditor,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata             map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	PrefilledBankAccount struct {
		AccountType string `url:"account_type,omitempty" json:"account_type,omitempty"`
	} `url:"prefilled_bank_account,omitempty" json:"prefilled_bank_account,omitempty"`
	PrefilledCustomer struct {
		AddressLine1          string `url:"address_line1,omitempty" json:"address_line1,omitempty"`
		AddressLine2          string `url:"address_line2,omitempty" json:"address_line2,omitempty"`
		AddressLine3          string `url:"address_line3,omitempty" json:"address_line3,omitempty"`
		City                  string `url:"city,omitempty" json:"city,omitempty"`
		CompanyName           string `url:"company_name,omitempty" json:"company_name,omitempty"`
		CountryCode           string `url:"country_code,omitempty" json:"country_code,omitempty"`
		DanishIdentityNumber  string `url:"danish_identity_number,omitempty" json:"danish_identity_number,omitempty"`
		Email                 string `url:"email,omitempty" json:"email,omitempty"`
		FamilyName            string `url:"family_name,omitempty" json:"family_name,omitempty"`
		GivenName             string `url:"given_name,omitempty" json:"given_name,omitempty"`
		Language              string `url:"language,omitempty" json:"language,omitempty"`
		PhoneNumber           string `url:"phone_number,omitempty" json:"phone_number,omitempty"`
		PostalCode            string `url:"postal_code,omitempty" json:"postal_code,omitempty"`
		Region                string `url:"region,omitempty" json:"region,omitempty"`
		SwedishIdentityNumber string `url:"swedish_identity_number,omitempty" json:"swedish_identity_number,omitempty"`
	} `url:"prefilled_customer,omitempty" json:"prefilled_customer,omitempty"`
	Scheme             string `url:"scheme,omitempty" json:"scheme,omitempty"`
	SessionToken       string `url:"session_token,omitempty" json:"session_token,omitempty"`
	SuccessRedirectUrl string `url:"success_redirect_url,omitempty" json:"success_redirect_url,omitempty"`
}

RedirectFlowCreateParams parameters

type RedirectFlowService

type RedirectFlowService struct {
	// contains filtered or unexported fields
}

RedirectFlowService manages redirect_flows

func (*RedirectFlowService) Complete

Complete This creates a [customer](#core-endpoints-customers), [customer bank account](#core-endpoints-customer-bank-accounts), and [mandate](#core-endpoints-mandates) using the details supplied by your customer and returns the ID of the created mandate.

This will return a `redirect_flow_incomplete` error if your customer has not yet been redirected back to your site, and a `redirect_flow_already_completed` error if your integration has already completed this flow. It will return a `bad_request` error if the `session_token` differs to the one supplied when the redirect flow was created.

func (*RedirectFlowService) Create

Create Creates a redirect flow object which can then be used to redirect your customer to the GoCardless hosted payment pages.

func (*RedirectFlowService) Get

func (s *RedirectFlowService) Get(ctx context.Context, identity string, opts ...RequestOption) (*RedirectFlow, error)

Get Returns all details about a single redirect flow

type Refund

type Refund struct {
	Amount    int    `url:"amount,omitempty" json:"amount,omitempty"`
	CreatedAt string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Currency  string `url:"currency,omitempty" json:"currency,omitempty"`
	Fx        struct {
		EstimatedExchangeRate string `url:"estimated_exchange_rate,omitempty" json:"estimated_exchange_rate,omitempty"`
		ExchangeRate          string `url:"exchange_rate,omitempty" json:"exchange_rate,omitempty"`
		FxAmount              int    `url:"fx_amount,omitempty" json:"fx_amount,omitempty"`
		FxCurrency            string `url:"fx_currency,omitempty" json:"fx_currency,omitempty"`
	} `url:"fx,omitempty" json:"fx,omitempty"`
	Id    string `url:"id,omitempty" json:"id,omitempty"`
	Links struct {
		Mandate string `url:"mandate,omitempty" json:"mandate,omitempty"`
		Payment string `url:"payment,omitempty" json:"payment,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata  map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	Reference string                 `url:"reference,omitempty" json:"reference,omitempty"`
	Status    string                 `url:"status,omitempty" json:"status,omitempty"`
}

Refund model

type RefundCreateParams

type RefundCreateParams struct {
	Amount int `url:"amount,omitempty" json:"amount,omitempty"`
	Links  struct {
		Mandate string `url:"mandate,omitempty" json:"mandate,omitempty"`
		Payment string `url:"payment,omitempty" json:"payment,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata                map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	Reference               string                 `url:"reference,omitempty" json:"reference,omitempty"`
	TotalAmountConfirmation int                    `url:"total_amount_confirmation,omitempty" json:"total_amount_confirmation,omitempty"`
}

RefundCreateParams parameters

type RefundListPagingIterator

type RefundListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*RefundListPagingIterator) Next

func (c *RefundListPagingIterator) Next() bool

func (*RefundListPagingIterator) Value

type RefundListParams

type RefundListParams struct {
	After     string `url:"after,omitempty" json:"after,omitempty"`
	Before    string `url:"before,omitempty" json:"before,omitempty"`
	CreatedAt struct {
		Gt  string `url:"gt,omitempty" json:"gt,omitempty"`
		Gte string `url:"gte,omitempty" json:"gte,omitempty"`
		Lt  string `url:"lt,omitempty" json:"lt,omitempty"`
		Lte string `url:"lte,omitempty" json:"lte,omitempty"`
	} `url:"created_at,omitempty" json:"created_at,omitempty"`
	Limit      int    `url:"limit,omitempty" json:"limit,omitempty"`
	Mandate    string `url:"mandate,omitempty" json:"mandate,omitempty"`
	Payment    string `url:"payment,omitempty" json:"payment,omitempty"`
	RefundType string `url:"refund_type,omitempty" json:"refund_type,omitempty"`
}

RefundListParams parameters

type RefundListResult

type RefundListResult struct {
	Refunds []Refund `json:"refunds"`
	Meta    struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

RefundListResult response including pagination metadata

type RefundService

type RefundService struct {
	// contains filtered or unexported fields
}

RefundService manages refunds

func (*RefundService) All

func (*RefundService) Create

func (s *RefundService) Create(ctx context.Context, p RefundCreateParams, opts ...RequestOption) (*Refund, error)

Create Creates a new refund object.

This fails with:<a name="total_amount_confirmation_invalid"></a><a name="number_of_refunds_exceeded"></a><a name="available_refund_amount_insufficient"></a>

- `total_amount_confirmation_invalid` if the confirmation amount doesn't match the total amount refunded for the payment. This safeguard is there to prevent two processes from creating refunds without awareness of each other.

- `number_of_refunds_exceeded` if five or more refunds have already been created against the payment.

- `available_refund_amount_insufficient` if the creditor does not have sufficient balance for refunds available to cover the cost of the requested refund.

func (*RefundService) Get

func (s *RefundService) Get(ctx context.Context, identity string, opts ...RequestOption) (*Refund, error)

Get Retrieves all details for a single refund

func (*RefundService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your refunds.

func (*RefundService) Update

func (s *RefundService) Update(ctx context.Context, identity string, p RefundUpdateParams, opts ...RequestOption) (*Refund, error)

Update Updates a refund object.

type RefundUpdateParams

type RefundUpdateParams struct {
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

RefundUpdateParams parameters

type RequestOption

type RequestOption func(*requestOptions) error

RequestOption is used to configure a given request

func WithHeaders

func WithHeaders(headers map[string]string) RequestOption

WithHeaders sets headers to be sent for this request

func WithIdempotencyKey

func WithIdempotencyKey(key string) RequestOption

WithIdempotencyKey sets an idempotency key so multiple calls to a non-idempotent endpoint with the same key are actually idempotent

func WithRetries

func WithRetries(n int) RequestOption

WithRetries sets the amount of total retries to make for the request

func WithoutRetries

func WithoutRetries() RequestOption

WithoutRetries disables retries for this request

type ScenarioSimulator

type ScenarioSimulator struct {
	Id string `url:"id,omitempty" json:"id,omitempty"`
}

ScenarioSimulator model

type ScenarioSimulatorRunParams

type ScenarioSimulatorRunParams struct {
	Links struct {
		Resource string `url:"resource,omitempty" json:"resource,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
}

ScenarioSimulatorRunParams parameters

type ScenarioSimulatorService

type ScenarioSimulatorService struct {
	// contains filtered or unexported fields
}

ScenarioSimulatorService manages scenario_simulators

func (*ScenarioSimulatorService) Run

Run Runs the specific scenario simulator against the specific resource

type Service

type Service struct {
	BankAuthorisations      *BankAuthorisationService
	BankDetailsLookups      *BankDetailsLookupService
	BillingRequests         *BillingRequestService
	BillingRequestFlows     *BillingRequestFlowService
	BillingRequestTemplates *BillingRequestTemplateService
	Blocks                  *BlockService
	Creditors               *CreditorService
	CreditorBankAccounts    *CreditorBankAccountService
	CurrencyExchangeRates   *CurrencyExchangeRateService
	Customers               *CustomerService
	CustomerBankAccounts    *CustomerBankAccountService
	CustomerNotifications   *CustomerNotificationService
	Events                  *EventService
	InstalmentSchedules     *InstalmentScheduleService
	Institutions            *InstitutionService
	Mandates                *MandateService
	MandateImports          *MandateImportService
	MandateImportEntries    *MandateImportEntryService
	MandatePdfs             *MandatePdfService
	PayerAuthorisations     *PayerAuthorisationService
	Payments                *PaymentService
	Payouts                 *PayoutService
	PayoutItems             *PayoutItemService
	RedirectFlows           *RedirectFlowService
	Refunds                 *RefundService
	ScenarioSimulators      *ScenarioSimulatorService
	Subscriptions           *SubscriptionService
	TaxRates                *TaxRateService
	Webhooks                *WebhookService
}

func New

func New(token string, opts ...Option) (*Service, error)

type Subscription

type Subscription struct {
	Amount                        int    `url:"amount,omitempty" json:"amount,omitempty"`
	AppFee                        int    `url:"app_fee,omitempty" json:"app_fee,omitempty"`
	Count                         int    `url:"count,omitempty" json:"count,omitempty"`
	CreatedAt                     string `url:"created_at,omitempty" json:"created_at,omitempty"`
	Currency                      string `url:"currency,omitempty" json:"currency,omitempty"`
	DayOfMonth                    int    `url:"day_of_month,omitempty" json:"day_of_month,omitempty"`
	EarliestChargeDateAfterResume string `url:"earliest_charge_date_after_resume,omitempty" json:"earliest_charge_date_after_resume,omitempty"`
	EndDate                       string `url:"end_date,omitempty" json:"end_date,omitempty"`
	Id                            string `url:"id,omitempty" json:"id,omitempty"`
	Interval                      int    `url:"interval,omitempty" json:"interval,omitempty"`
	IntervalUnit                  string `url:"interval_unit,omitempty" json:"interval_unit,omitempty"`
	Links                         struct {
		Mandate string `url:"mandate,omitempty" json:"mandate,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata         map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	Month            string                 `url:"month,omitempty" json:"month,omitempty"`
	Name             string                 `url:"name,omitempty" json:"name,omitempty"`
	PaymentReference string                 `url:"payment_reference,omitempty" json:"payment_reference,omitempty"`
	RetryIfPossible  bool                   `url:"retry_if_possible,omitempty" json:"retry_if_possible,omitempty"`
	StartDate        string                 `url:"start_date,omitempty" json:"start_date,omitempty"`
	Status           string                 `url:"status,omitempty" json:"status,omitempty"`
	UpcomingPayments []struct {
		Amount     int    `url:"amount,omitempty" json:"amount,omitempty"`
		ChargeDate string `url:"charge_date,omitempty" json:"charge_date,omitempty"`
	} `url:"upcoming_payments,omitempty" json:"upcoming_payments,omitempty"`
}

Subscription model

type SubscriptionCancelParams

type SubscriptionCancelParams struct {
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

SubscriptionCancelParams parameters

type SubscriptionCreateParams

type SubscriptionCreateParams struct {
	Amount       int    `url:"amount,omitempty" json:"amount,omitempty"`
	AppFee       int    `url:"app_fee,omitempty" json:"app_fee,omitempty"`
	Count        int    `url:"count,omitempty" json:"count,omitempty"`
	Currency     string `url:"currency,omitempty" json:"currency,omitempty"`
	DayOfMonth   int    `url:"day_of_month,omitempty" json:"day_of_month,omitempty"`
	EndDate      string `url:"end_date,omitempty" json:"end_date,omitempty"`
	Interval     int    `url:"interval,omitempty" json:"interval,omitempty"`
	IntervalUnit string `url:"interval_unit,omitempty" json:"interval_unit,omitempty"`
	Links        struct {
		Mandate string `url:"mandate,omitempty" json:"mandate,omitempty"`
	} `url:"links,omitempty" json:"links,omitempty"`
	Metadata         map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	Month            string                 `url:"month,omitempty" json:"month,omitempty"`
	Name             string                 `url:"name,omitempty" json:"name,omitempty"`
	PaymentReference string                 `url:"payment_reference,omitempty" json:"payment_reference,omitempty"`
	RetryIfPossible  bool                   `url:"retry_if_possible,omitempty" json:"retry_if_possible,omitempty"`
	StartDate        string                 `url:"start_date,omitempty" json:"start_date,omitempty"`
}

SubscriptionCreateParams parameters

type SubscriptionListPagingIterator

type SubscriptionListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*SubscriptionListPagingIterator) Next

func (*SubscriptionListPagingIterator) Value

type SubscriptionListParams

type SubscriptionListParams struct {
	After     string `url:"after,omitempty" json:"after,omitempty"`
	Before    string `url:"before,omitempty" json:"before,omitempty"`
	CreatedAt struct {
		Gt  string `url:"gt,omitempty" json:"gt,omitempty"`
		Gte string `url:"gte,omitempty" json:"gte,omitempty"`
		Lt  string `url:"lt,omitempty" json:"lt,omitempty"`
		Lte string `url:"lte,omitempty" json:"lte,omitempty"`
	} `url:"created_at,omitempty" json:"created_at,omitempty"`
	Customer string   `url:"customer,omitempty" json:"customer,omitempty"`
	Limit    int      `url:"limit,omitempty" json:"limit,omitempty"`
	Mandate  string   `url:"mandate,omitempty" json:"mandate,omitempty"`
	Status   []string `url:"status,omitempty" json:"status,omitempty"`
}

SubscriptionListParams parameters

type SubscriptionListResult

type SubscriptionListResult struct {
	Subscriptions []Subscription `json:"subscriptions"`
	Meta          struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

SubscriptionListResult response including pagination metadata

type SubscriptionPauseParams

type SubscriptionPauseParams struct {
	Metadata    map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	PauseCycles int                    `url:"pause_cycles,omitempty" json:"pause_cycles,omitempty"`
}

SubscriptionPauseParams parameters

type SubscriptionResumeParams

type SubscriptionResumeParams struct {
	Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
}

SubscriptionResumeParams parameters

type SubscriptionService

type SubscriptionService struct {
	// contains filtered or unexported fields
}

SubscriptionService manages subscriptions

func (*SubscriptionService) All

func (*SubscriptionService) Cancel

Cancel Immediately cancels a subscription; no more payments will be created under it. Any metadata supplied to this endpoint will be stored on the payment cancellation event it causes.

This will fail with a cancellation_failed error if the subscription is already cancelled or finished.

func (*SubscriptionService) Create

Create Creates a new subscription object

func (*SubscriptionService) Get

func (s *SubscriptionService) Get(ctx context.Context, identity string, opts ...RequestOption) (*Subscription, error)

Get Retrieves the details of a single subscription.

func (*SubscriptionService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your subscriptions.

func (*SubscriptionService) Pause

Pause Pause a subscription object. No payments will be created until it is resumed.

This can only be used when a subscription is collecting a fixed number of payments (created using `count`), when they continue forever (created without `count` or `end_date`) or the subscription is already paused for a number of cycles.

When `pause_cycles` is omitted the subscription is paused until the [resume endpoint](#subscriptions-resume-a-subscription) is called. If the subscription is collecting a fixed number of payments, `end_date` will be set to `null`. When paused indefinitely, `upcoming_payments` will be empty.

When `pause_cycles` is provided the subscription will be paused for the number of cycles requested. If the subscription is collecting a fixed number of payments, `end_date` will be set to a new value. When paused for a number of cycles, `upcoming_payments` will still contain the upcoming charge dates.

This fails with:

- `forbidden` if the subscription was created by an app and you are not authenticated as that app, or if the subscription was not created by an app and you are authenticated as an app

- `validation_failed` if invalid data is provided when attempting to pause a subscription.

- `subscription_paused_cannot_update_cycles` if the subscription is already paused for a number of cycles and the request provides a value for `pause_cycle`.

- `subscription_cannot_be_paused` if the subscription cannot be paused.

- `subscription_already_ended` if the subscription has taken all payments.

- `pause_cycles_must_be_greater_than_or_equal_to` if the provided value for `pause_cycles` cannot be satisfied.

func (*SubscriptionService) Resume

Resume Resume a subscription object. Payments will start to be created again based on the subscriptions recurrence rules. The `charge_date` on the next payment will be the same as the subscriptions `earliest_charge_date_after_resume`

This fails with:

- `forbidden` if the subscription was created by an app and you are not authenticated as that app, or if the subscription was not created by an app and you are authenticated as an app

- `validation_failed` if invalid data is provided when attempting to resume a subscription.

- `subscription_not_paused` if the subscription is not paused.

func (*SubscriptionService) Update

Update Updates a subscription object.

This fails with:

- `validation_failed` if invalid data is provided when attempting to update a subscription.

- `subscription_not_active` if the subscription is no longer active.

- `subscription_already_ended` if the subscription has taken all payments.

- `mandate_payments_require_approval` if the amount is being changed and the mandate requires approval.

- `number_of_subscription_amendments_exceeded` error if the subscription amount has already been changed 10 times.

- `forbidden` if the amount is being changed, and the subscription was created by an app and you are not authenticated as that app, or if the subscription was not created by an app and you are authenticated as an app

- `resource_created_by_another_app` if the app fee is being changed, and the subscription was created by an app other than the app you are authenticated as

type SubscriptionUpdateParams

type SubscriptionUpdateParams struct {
	Amount           int                    `url:"amount,omitempty" json:"amount,omitempty"`
	AppFee           int                    `url:"app_fee,omitempty" json:"app_fee,omitempty"`
	Metadata         map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
	Name             string                 `url:"name,omitempty" json:"name,omitempty"`
	PaymentReference string                 `url:"payment_reference,omitempty" json:"payment_reference,omitempty"`
	RetryIfPossible  bool                   `url:"retry_if_possible,omitempty" json:"retry_if_possible,omitempty"`
}

SubscriptionUpdateParams parameters

type TaxRate

type TaxRate struct {
	EndDate      string `url:"end_date,omitempty" json:"end_date,omitempty"`
	Id           string `url:"id,omitempty" json:"id,omitempty"`
	Jurisdiction string `url:"jurisdiction,omitempty" json:"jurisdiction,omitempty"`
	Percentage   string `url:"percentage,omitempty" json:"percentage,omitempty"`
	StartDate    string `url:"start_date,omitempty" json:"start_date,omitempty"`
	Type         string `url:"type,omitempty" json:"type,omitempty"`
}

TaxRate model

type TaxRateListPagingIterator

type TaxRateListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*TaxRateListPagingIterator) Next

func (c *TaxRateListPagingIterator) Next() bool

func (*TaxRateListPagingIterator) Value

type TaxRateListParams

type TaxRateListParams struct {
	After        string `url:"after,omitempty" json:"after,omitempty"`
	Before       string `url:"before,omitempty" json:"before,omitempty"`
	Jurisdiction string `url:"jurisdiction,omitempty" json:"jurisdiction,omitempty"`
}

TaxRateListParams parameters

type TaxRateListResult

type TaxRateListResult struct {
	TaxRates []TaxRate `json:"tax_rates"`
	Meta     struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

TaxRateListResult response including pagination metadata

type TaxRateService

type TaxRateService struct {
	// contains filtered or unexported fields
}

TaxRateService manages tax_rates

func (*TaxRateService) All

func (*TaxRateService) Get

func (s *TaxRateService) Get(ctx context.Context, identity string, opts ...RequestOption) (*TaxRate, error)

Get Retrieves the details of a tax rate.

func (*TaxRateService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of all tax rates.

type ValidationError

type ValidationError struct {
	Message        string `json:"message"`
	Field          string `json:"field"`
	RequestPointer string `json:"request_pointer"`
}

type Webhook

type Webhook struct {
	CreatedAt                       string                 `url:"created_at,omitempty" json:"created_at,omitempty"`
	Id                              string                 `url:"id,omitempty" json:"id,omitempty"`
	IsTest                          bool                   `url:"is_test,omitempty" json:"is_test,omitempty"`
	RequestBody                     string                 `url:"request_body,omitempty" json:"request_body,omitempty"`
	RequestHeaders                  map[string]interface{} `url:"request_headers,omitempty" json:"request_headers,omitempty"`
	ResponseBody                    string                 `url:"response_body,omitempty" json:"response_body,omitempty"`
	ResponseBodyTruncated           bool                   `url:"response_body_truncated,omitempty" json:"response_body_truncated,omitempty"`
	ResponseCode                    int                    `url:"response_code,omitempty" json:"response_code,omitempty"`
	ResponseHeaders                 map[string]interface{} `url:"response_headers,omitempty" json:"response_headers,omitempty"`
	ResponseHeadersContentTruncated bool                   `url:"response_headers_content_truncated,omitempty" json:"response_headers_content_truncated,omitempty"`
	ResponseHeadersCountTruncated   bool                   `url:"response_headers_count_truncated,omitempty" json:"response_headers_count_truncated,omitempty"`
	Successful                      bool                   `url:"successful,omitempty" json:"successful,omitempty"`
	Url                             string                 `url:"url,omitempty" json:"url,omitempty"`
}

Webhook model

type WebhookHandler

type WebhookHandler struct {
	EventHandler
	// contains filtered or unexported fields
}

WebhookHandler allows you to process incoming events from webhooks.

func NewWebhookHandler

func NewWebhookHandler(secret string, h EventHandler) (*WebhookHandler, error)

NewWebhookHandler instantiates a WebhookHandler which can be mounted as a net/http Handler.

func (*WebhookHandler) ServeHTTP

func (h *WebhookHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP processes incoming webhooks and dispatches events to the corresponsing handlers.

type WebhookListPagingIterator

type WebhookListPagingIterator struct {
	// contains filtered or unexported fields
}

func (*WebhookListPagingIterator) Next

func (c *WebhookListPagingIterator) Next() bool

func (*WebhookListPagingIterator) Value

type WebhookListParams

type WebhookListParams struct {
	After     string `url:"after,omitempty" json:"after,omitempty"`
	Before    string `url:"before,omitempty" json:"before,omitempty"`
	CreatedAt struct {
		Gt  string `url:"gt,omitempty" json:"gt,omitempty"`
		Gte string `url:"gte,omitempty" json:"gte,omitempty"`
		Lt  string `url:"lt,omitempty" json:"lt,omitempty"`
		Lte string `url:"lte,omitempty" json:"lte,omitempty"`
	} `url:"created_at,omitempty" json:"created_at,omitempty"`
	IsTest     bool `url:"is_test,omitempty" json:"is_test,omitempty"`
	Limit      int  `url:"limit,omitempty" json:"limit,omitempty"`
	Successful bool `url:"successful,omitempty" json:"successful,omitempty"`
}

WebhookListParams parameters

type WebhookListResult

type WebhookListResult struct {
	Webhooks []Webhook `json:"webhooks"`
	Meta     struct {
		Cursors struct {
			After  string `url:"after,omitempty" json:"after,omitempty"`
			Before string `url:"before,omitempty" json:"before,omitempty"`
		} `url:"cursors,omitempty" json:"cursors,omitempty"`
		Limit int `url:"limit,omitempty" json:"limit,omitempty"`
	} `json:"meta"`
}

WebhookListResult response including pagination metadata

type WebhookService

type WebhookService struct {
	// contains filtered or unexported fields
}

WebhookService manages webhooks

func (*WebhookService) All

func (*WebhookService) Get

func (s *WebhookService) Get(ctx context.Context, identity string, opts ...RequestOption) (*Webhook, error)

Get Retrieves the details of an existing webhook.

func (*WebhookService) List

List Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your webhooks.

func (*WebhookService) Retry

func (s *WebhookService) Retry(ctx context.Context, identity string, opts ...RequestOption) (*Webhook, error)

Retry Requests for a previous webhook to be sent again

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL