btcpay

package module
v0.0.0-...-114f83f Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 6 Imported by: 0

README ΒΆ

Go-BTCPay

testing

-- Work in progress --

A Golang SDK for the BTCPay Server Greenfield API v1.

πŸ’‘ About

This package provies full access to the Greenfield API v1 from a BTCPayServer. Every API call returns, if available, a corresponding go struct, a HTTP status code and an error.

It's possible to control the individual calls by passing a context for each function and method.

πŸš€ Getting started

πŸ§‘β€πŸ’» Create a client

You can create a client either by using basic authentication or by using an API Key.

package main

import (
    "context"
    "fmt"
    "github.com/jon4hz/go-btcpay"
)

func main() {
    // create empty context interface
    ctx := context.Background()

    // Create a basicAuth client
    client := btcpay.NewBasicClient("https://mybtcpayserver.com", "myUsername", "myPassword")

    // Print informations about the server, etc
    fmt.Println(client.GetServerInfo(ctx))

    // Does the same but with an APIKey instead of basicAuth
    // Create a client with an APIKey
    client2 := btcpay.NewClient("https://mybtcpayserver.com", btcpay.APIKey("myAPIKey")

    // Print informations about the server, etc again but use the APIKey based client
    fmt.Println(client2.GetServerInfo(ctx))
}
πŸ“ Create an invoice

You can create an invoice by using the previously created client.

// assign a store to the client
client.Store.ID = btcpay.StoreID("YourStoreID")

// create the invoice
invoice, _, err := client.CreateInvoice(context.TODO(), &client.Store.ID, &btcpay.InvoiceRequest{
    Amount:   "10",
    Currency: "USD",
})
if err != nil {
   fmt.Println(err)
} else {
    fmt.Println(invoice) // invoice has type *btcpay.InvoiceResponse
}

Calling the method CreateInvoice() works for variable of type *btcpay.Store, too.

// by passing the store from the previously created client, the new store (*btcpay.Store) contains 
// a pointer  back to the initial client 
store = client.Store
// assign a storeID to the store
store.ID = btcpay.StoreID("YourStoreID")

// create the invoice
invoice, _, err := store.CreateInvoice(context.TODO(), &btcpay.InvoiceRequest{
    Amount:   "10",
    Currency: "USD",
})
if err != nil {
   fmt.Println(err)
} else {
    fmt.Println(invoice) // invoice has type *btcpay.InvoiceResponse
}

[more examples will follow soon]

initialented endpoints.

Endpoint Status
/api/v1/api-keys βœ… Fully implemented
/api-keys/authorize ⚑️ Testing required
/api/v1/health βœ… Fully implemented
/api/v1/server/info βœ… Fully implemented
/api/v1/users βœ… Fully implemented
/api/v1/users/me/notifications βœ… Fully implemented
/api/v1/stores ⚠️ Partially implemented
/api/v1/stores/{storeId}/invoices βœ… Fully implemented
/api/v1/stores/{storeId}/payment-requests βœ… Fully implemented
/api/v1/stores/{storeId}/pull-payments βœ… Fully implemented
/api/v1/stores/{storeId}/payment-methods/OnChain/{cryptoCode}/wallet ⏳ Work in progress
/misc/lang βœ… Fully implemented
/i βœ… Fully implemented
/api/v1/pull-payments βœ… Fully implemented

πŸ“œ Licensing

This SDK is released under the MIT-License found in the LICENSE file.

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

This section is empty.

Types ΒΆ

type APIKey ΒΆ

type APIKey string

type APIKeyRequest ΒΆ

type APIKeyRequest struct {
	Label       string             `json:"label,omitempty"`
	Permissions []BTCPayPermission `json:"permissions,omitempty"`
}

type APIKeyResponse ΒΆ

type APIKeyResponse struct {
	APIKey      APIKey             `json:"apiKey"`
	Label       string             `json:"label"`
	Permissions []BTCPayPermission `json:"permissions"`
}

type AuthorizationRequest ΒΆ

type AuthorizationRequest struct {
	Permissions           []BTCPayPermission `json:"permissions,omitempty"`
	ApplicationName       string             `json:"applicationName,omitempty"`
	Strict                bool               `json:"strict,omitempty"`
	SelectiveStores       bool               `json:"selectiveStores,omitempty"`
	Redirect              string             `json:"redirect,omitempty"`
	ApplicationIdentifier string             `json:"applicationIdentifier,omitempty"`
}

type BTCPayInvoiceAdditionalStatus ΒΆ

type BTCPayInvoiceAdditionalStatus string

Enums InvoiceAdditionalStatus

type BTCPayInvoiceStatus ΒΆ

type BTCPayInvoiceStatus string

Enums InvoiceStatus

type BTCPayInvoiceStatusMark ΒΆ

type BTCPayInvoiceStatusMark string

Enums InvoiceStatusMark

type BTCPayNetworkFeeMode ΒΆ

type BTCPayNetworkFeeMode string

Enums NetworkFeeMode

type BTCPayPaymentRequestStatus ΒΆ

type BTCPayPaymentRequestStatus string

Enums PaymentRequestStatus

type BTCPayPaymentStatus ΒΆ

type BTCPayPaymentStatus string

Enums PaymentStatus

type BTCPayPayoutStatus ΒΆ

type BTCPayPayoutStatus string

Enums NetworkFeeMode

type BTCPayPermission ΒΆ

type BTCPayPermission string

Enums BTCPayPermission

func CreateCustomPermission ΒΆ

func CreateCustomPermission(permission BTCPayPermission, storeID StoreID) BTCPayPermission

type BTCPaySpeedPolicy ΒΆ

type BTCPaySpeedPolicy string

Enums SpeedPolicy

type Client ΒΆ

type Client struct {
	URL            string
	APIKey         APIKey
	Username       string
	Password       string
	Http           *http.Client
	Store          *Store
	Invoice        *Invoice
	PaymentRequest *PaymentRequest
	Notification   *Notification
	PullPayment    *PullPayment
	Payout         *Payout
}

func NewBasicClient ΒΆ

func NewBasicClient(url, username, password string) *Client

func NewClient ΒΆ

func NewClient(url string, apiKey APIKey) *Client

func (*Client) ApprovePayout ΒΆ

func (c *Client) ApprovePayout(ctx context.Context, storeID *StoreID, payoutID *PayoutID, payoutApproveRequest *PayoutApproveRequest) (*PayoutResponse, int, error)

Approve a payout

func (*Client) ArchiveInvoice ΒΆ

func (c *Client) ArchiveInvoice(ctx context.Context, storeID *StoreID, invoiceID *InvoiceID) (int, error)

Archive a single invoice of a store

func (*Client) ArchivePaymentRequest ΒΆ

func (c *Client) ArchivePaymentRequest(ctx context.Context, storeID *StoreID, paymentRequestID *PaymentRequestID) (int, error)

Archives the specified payment request.

func (*Client) ArchivePullPayment ΒΆ

func (c *Client) ArchivePullPayment(ctx context.Context, storeID *StoreID, pullPaymentID *PullPaymentID) (int, error)

func (*Client) Authorize ΒΆ

func (c *Client) Authorize(ctx context.Context, authRequest *AuthorizationRequest) (int, error)

func (*Client) CancelPayout ΒΆ

func (c *Client) CancelPayout(ctx context.Context, storeID *StoreID, payoutID *PayoutID) (int, error)

Cancel the payout

func (*Client) CreateAPIKey ΒΆ

func (c *Client) CreateAPIKey(ctx context.Context, apiKeyRequest *APIKeyRequest) (*APIKeyResponse, int, error)

func (*Client) CreateInvoice ΒΆ

func (c *Client) CreateInvoice(ctx context.Context, storeID *StoreID, invoiceRequest *InvoiceRequest) (*InvoiceResponse, int, error)

Create an invoice for a certain store

func (*Client) CreatePaymentRequest ΒΆ

func (c *Client) CreatePaymentRequest(ctx context.Context, storeID *StoreID, paymentRequestRequest *PaymentRequestRequest) (*PaymentRequestResponse, int, error)

Create a new payment request

func (*Client) CreatePayout ΒΆ

func (c *Client) CreatePayout(ctx context.Context, pullPaymentID *PullPaymentID, payoutRequest *PayoutRequest) (*PayoutResponse, int, error)

create a new payout

func (*Client) CreatePullPayment ΒΆ

func (c *Client) CreatePullPayment(ctx context.Context, storeID *StoreID, pullPaymentRequest *PullPaymentRequest) (*PullPaymentResponse, int, error)

func (*Client) CreateStore ΒΆ

func (c *Client) CreateStore(ctx context.Context, storeRequest *StoreRequest) (*StoreResponse, int, error)

create a new store

func (*Client) CreateUser ΒΆ

func (c *Client) CreateUser(ctx context.Context, userRequest *UserRequest) (*UserResponse, int, error)

func (*Client) GetCurrentAPIKey ΒΆ

func (c *Client) GetCurrentAPIKey(ctx context.Context) (*APIKeyResponse, int, error)

func (*Client) GetHealth ΒΆ

func (c *Client) GetHealth(ctx context.Context) (*HealthResponse, int, error)

func (*Client) GetInvoice ΒΆ

func (c *Client) GetInvoice(ctx context.Context, storeID *StoreID, invoiceID *InvoiceID) (*InvoiceResponse, int, error)

Get a signle invoice from a single store.

func (*Client) GetInvoiceCheckoutPage ΒΆ

func (c *Client) GetInvoiceCheckoutPage(ctx context.Context, invoiceID *InvoiceID, lang ...string) (*InvoiceCheckoutPage, int, error)

View the checkout page of an invoice

func (*Client) GetInvoicePaymentMethod ΒΆ

func (c *Client) GetInvoicePaymentMethod(ctx context.Context, storeID *StoreID, invoiceID *InvoiceID) ([]*InvoicePaymentMethodResponse, int, error)

View information about the specified invoice's payment methods

func (*Client) GetInvoices ΒΆ

func (c *Client) GetInvoices(ctx context.Context, storeID *StoreID) ([]*InvoiceResponse, int, error)

Get an array of all Invoices from a single store.

func (*Client) GetLanguageCodes ΒΆ

func (c *Client) GetLanguageCodes(ctx context.Context) ([]*LanguageCodesRespose, int, error)

func (*Client) GetNotification ΒΆ

func (c *Client) GetNotification(ctx context.Context, notificationID *NotificationID) (*NotificationResponse, int, error)

View information about the specified notification

func (*Client) GetNotifications ΒΆ

func (c *Client) GetNotifications(ctx context.Context, seen ...bool) ([]*NotificationResponse, int, error)

func (*Client) GetPaymentRequest ΒΆ

func (c *Client) GetPaymentRequest(ctx context.Context, storeID *StoreID, paymentRequestID *PaymentRequestID) (*PaymentRequestResponse, int, error)

View information about the specified payment request

func (*Client) GetPaymentRequests ΒΆ

func (c *Client) GetPaymentRequests(ctx context.Context, storeID *StoreID) ([]*PaymentRequestResponse, int, error)

View information about the existing payment requests

func (*Client) GetPayouts ΒΆ

func (c *Client) GetPayouts(ctx context.Context, pullPaymentID *PullPaymentID, includeCancelled ...bool) ([]*PayoutResponse, int, error)

Get payouts

func (*Client) GetPullPayment ΒΆ

func (c *Client) GetPullPayment(ctx context.Context, pullPaymentID *PullPaymentID) (*PullPaymentResponse, int, error)

Get a pull payment

func (*Client) GetPullPayments ΒΆ

func (c *Client) GetPullPayments(ctx context.Context, storeID *StoreID, includeArchived ...bool) ([]*PullPaymentResponse, int, error)

Get the pull payments of a store

func (*Client) GetServerInfo ΒΆ

func (c *Client) GetServerInfo(ctx context.Context) (*ServerInfoResponse, int, error)

func (*Client) GetStore ΒΆ

func (c *Client) GetStore(ctx context.Context, storeID *StoreID) (*StoreResponse, int, error)

View information about the specified store

func (*Client) GetStores ΒΆ

func (c *Client) GetStores(ctx context.Context) ([]*StoreResponse, int, error)

View information about the available stores

func (*Client) GetUser ΒΆ

func (c *Client) GetUser(ctx context.Context) (*UserResponse, int, error)

View information about the current user

func (*Client) MarkInvoiceStatus ΒΆ

func (c *Client) MarkInvoiceStatus(ctx context.Context, storeID *StoreID, invoiceID *InvoiceID, markInvoiceStatusRequest *MarkInvoiceStatusRequest) (*InvoiceResponse, int, error)

Mark an invoice as invalid or settled.

func (*Client) RemoveNotification ΒΆ

func (c *Client) RemoveNotification(ctx context.Context, notificationID *NotificationID) (int, error)

Removes the specified notification.

func (*Client) RemoveStore ΒΆ

func (c *Client) RemoveStore(ctx context.Context, storeID *StoreID) (int, error)

Removes the specified store. If there is another user with access, only your access will be removed.

func (*Client) RevokeAPIKey ΒΆ

func (c *Client) RevokeAPIKey(ctx context.Context, apiKey *APIKey) (int, error)

func (*Client) RevokeCurrentAPIKey ΒΆ

func (c *Client) RevokeCurrentAPIKey(ctx context.Context) (*APIKeyResponse, int, error)

func (*Client) UnarchiveInvoice ΒΆ

func (c *Client) UnarchiveInvoice(ctx context.Context, storeID *StoreID, invoiceID *InvoiceID) (*InvoiceResponse, int, error)

unarchive an invoice

func (*Client) UpdateInvoice ΒΆ

func (c *Client) UpdateInvoice(ctx context.Context, storeID *StoreID, invoiceID *InvoiceID, invoiceUpdate *InvoiceUpdate) (*InvoiceResponse, int, error)

Update the metadata from an existing invoice

func (*Client) UpdateNotification ΒΆ

func (c *Client) UpdateNotification(ctx context.Context, notificationID *NotificationID, updateNotification ...*UpdateNotification) (*NotificationResponse, int, error)

Updates the notification

func (*Client) UpdatePaymentRequest ΒΆ

func (c *Client) UpdatePaymentRequest(ctx context.Context, storeID *StoreID, paymentRequestID *PaymentRequestID, paymentRequestUpdate *PaymentRequestRequest) (*PaymentRequestResponse, int, error)

Update a payment request

func (*Client) UpdateStore ΒΆ

func (c *Client) UpdateStore(ctx context.Context, storeID *StoreID, storeUpdate *StoreUpdate) (*StoreResponse, int, error)

type HealthResponse ΒΆ

type HealthResponse struct {
	Synchronized bool `json:"synchronized"`
}

type Invoice ΒΆ

type Invoice struct {
	Store  *Store
	Client *Client
	ID     InvoiceID
}

func (*Invoice) ArchiveInvoice ΒΆ

func (i *Invoice) ArchiveInvoice(ctx context.Context) (int, error)

func (*Invoice) GetInvoice ΒΆ

func (i *Invoice) GetInvoice(ctx context.Context) (*InvoiceResponse, int, error)

func (*Invoice) GetInvoiceCheckoutPage ΒΆ

func (i *Invoice) GetInvoiceCheckoutPage(ctx context.Context) (*InvoiceCheckoutPage, int, error)

func (*Invoice) GetInvoicePaymentMethod ΒΆ

func (i *Invoice) GetInvoicePaymentMethod(ctx context.Context) ([]*InvoicePaymentMethodResponse, int, error)

func (*Invoice) MarkInvoiceStatus ΒΆ

func (i *Invoice) MarkInvoiceStatus(ctx context.Context, markInvoiceStatusRequest *MarkInvoiceStatusRequest) (*InvoiceResponse, int, error)

func (*Invoice) UnarchiveInvoice ΒΆ

func (i *Invoice) UnarchiveInvoice(ctx context.Context) (*InvoiceResponse, int, error)

func (*Invoice) UpdateInvoice ΒΆ

func (i *Invoice) UpdateInvoice(ctx context.Context, invoiceUpdate *InvoiceUpdate) (*InvoiceResponse, int, error)

type InvoiceCheckout ΒΆ

type InvoiceCheckout struct {
	SpeedPolicy       BTCPaySpeedPolicy `json:"speedPolicy,omitempty"`
	PaymentMethods    []string          `json:"paymentMethods,omitempty"`
	ExpirationMinutes int               `json:"expirationMinutes,omitempty"`
	MonitoringMinutes int               `json:"monitoringMinutes,omitempty"`
	PaymentTolerance  float64           `json:"paymentTolerance,omitempty"`
	RedirectURL       string            `json:"redirectURL,omitempty"`
	DefaultLanguage   string            `json:"defaultLanguage,omitempty"`
}

type InvoiceCheckoutPage ΒΆ

type InvoiceCheckoutPage struct {
	Page []byte
}

type InvoiceID ΒΆ

type InvoiceID string

type InvoiceMetadata ΒΆ

type InvoiceMetadata map[string]interface{}

type InvoicePaymentMethodResponse ΒΆ

type InvoicePaymentMethodResponse struct {
	PaymentMethod     string    `json:"paymentMethod"`
	Destination       string    `json:"destination"`
	PaymentLink       string    `json:"paymentLink,omitempty"`
	Rate              string    `json:"rate"`
	PaymentMethodPaid string    `json:"paymentMethodPaid"`
	TotalPaid         string    `json:"totalPaid"`
	Due               string    `json:"due"`
	Amount            string    `json:"amount"`
	NetworkFee        string    `json:"networkFee"`
	Payments          []Payment `json:"payments"`
}

type InvoiceRequest ΒΆ

type InvoiceRequest struct {
	Amount          string          `json:"amount"`
	Currency        string          `json:"currency,omitempty"`
	Metadata        InvoiceMetadata `json:"metadata,omitempty"`
	InvoiceCheckout InvoiceCheckout `json:"checkout,omitempty"`
}

type InvoiceResponse ΒΆ

type InvoiceResponse struct {
	Amount           string                        `json:"amount,omitempty"`
	Currency         string                        `json:"currency,omitempty"`
	Metadata         InvoiceMetadata               `json:"metadata,omitempty"`
	Checkout         InvoiceCheckout               `json:"checkout,omitempty"`
	ID               InvoiceID                     `json:"id"`
	CheckoutLink     string                        `json:"checkoutLink"`
	CreatedTime      int64                         `json:"createdTime"`
	ExpirationTime   int64                         `json:"expirationTime"`
	MonitoringTime   int64                         `json:"monitoringTime"`
	Status           BTCPayInvoiceStatus           `json:"status"`
	AdditionalStatus BTCPayInvoiceAdditionalStatus `json:"additionalStatus"`
}

type InvoiceStatus ΒΆ

type InvoiceStatus struct {
	New        BTCPayInvoiceStatus
	Processing BTCPayInvoiceStatus
	Expired    BTCPayInvoiceStatus
	Invalid    BTCPayInvoiceStatus
	Settled    BTCPayInvoiceStatus
}

func GetInvoiceStatus ΒΆ

func GetInvoiceStatus() *InvoiceStatus

type InvoiceStatusMark ΒΆ

type InvoiceStatusMark struct {
	MarkInvalid  BTCPayInvoiceStatusMark
	MarkComplete BTCPayInvoiceStatusMark
}

func GetInvoiceStatusMark ΒΆ

func GetInvoiceStatusMark() *InvoiceStatusMark

type InvoiceUpdate ΒΆ

type InvoiceUpdate struct {
	Metadata InvoiceMetadata `json:"metadata,omitempty"`
}

type LanguageCodesRespose ΒΆ

type LanguageCodesRespose struct {
	Code            string `json:"code"`
	CurrentLanguage string `json:"currentLanguage"`
}

type MarkInvoiceStatusRequest ΒΆ

type MarkInvoiceStatusRequest struct {
	Status BTCPayInvoiceStatusMark `json:"status"`
}

type NetworkFeeMode ΒΆ

type NetworkFeeMode struct {
	MultiplePaymentsOnly BTCPayNetworkFeeMode
	Always               BTCPayNetworkFeeMode
	Never                BTCPayNetworkFeeMode
}

func GetNetworkFeeMode ΒΆ

func GetNetworkFeeMode() *NetworkFeeMode

type Notification ΒΆ

type Notification struct {
	ID     NotificationID
	Client *Client
}

func (*Notification) GetNotification ΒΆ

func (n *Notification) GetNotification(ctx context.Context) (*NotificationResponse, int, error)

func (*Notification) RemoveNotification ΒΆ

func (n *Notification) RemoveNotification(ctx context.Context) (int, error)

func (*Notification) UpdateNotification ΒΆ

func (n *Notification) UpdateNotification(ctx context.Context, updateNotification ...*UpdateNotification) (*NotificationResponse, int, error)

type NotificationID ΒΆ

type NotificationID string

type NotificationResponse ΒΆ

type NotificationResponse struct {
	ID          NotificationID `json:"id"`
	Body        string         `json:"body"`
	Link        string         `json:"link"`
	CreatedTime int64          `json:"createdTime"`
	Seen        bool           `json:"seen"`
}

type Payment ΒΆ

type Payment struct {
	ID           PaymentID           `json:"id"`
	ReceivedDate int64               `json:"receivedDate"`
	Value        string              `json:"value"`
	Fee          string              `json:"fee"`
	Status       BTCPayPaymentStatus `json:"status"`
	Destination  string              `json:"destination"`
}

type PaymentID ΒΆ

type PaymentID string

type PaymentRequest ΒΆ

type PaymentRequest struct {
	Store  *Store
	Client *Client
	ID     PaymentRequestID
}

func (*PaymentRequest) ArchivePaymentRequest ΒΆ

func (p *PaymentRequest) ArchivePaymentRequest(ctx context.Context) (int, error)

func (*PaymentRequest) GetPaymentRequest ΒΆ

func (p *PaymentRequest) GetPaymentRequest(ctx context.Context) (*PaymentRequestResponse, int, error)

func (*PaymentRequest) UpdatePaymentRequest ΒΆ

func (p *PaymentRequest) UpdatePaymentRequest(ctx context.Context, paymentRequestUpdate *PaymentRequestRequest) (*PaymentRequestResponse, int, error)

type PaymentRequestID ΒΆ

type PaymentRequestID string

type PaymentRequestRequest ΒΆ

type PaymentRequestRequest struct {
	Amount                    float64 `json:"amount"`
	Title                     string  `json:"title"`
	Currency                  string  `json:"currency"`
	Email                     string  `json:"email,omitempty"`
	Description               string  `json:"description,omitempty"`
	ExpiryDate                int64   `json:"expiryDate,omitempty"`
	EmbeddedCSS               string  `json:"embeddedCSS,omitempty"`
	CustomCSSLink             string  `json:"customCSSLink,omitempty"`
	AllowCustomPaymentAmounts bool    `json:"allowCustomPaymentAmounts,omitempty"`
}

type PaymentRequestResponse ΒΆ

type PaymentRequestResponse struct {
	ID       PaymentRequestID           `json:"id"`
	Status   BTCPayPaymentRequestStatus `json:"status"`
	Created  string                     `json:"created"`
	Archived bool                       `json:"archived"`
	PaymentRequestRequest
}

type PaymentRequestStatus ΒΆ

type PaymentRequestStatus struct {
	Pending   BTCPayInvoiceStatus
	Completed BTCPayInvoiceStatus
	Expired   BTCPayInvoiceStatus
}

func GetPaymentRequestStatus ΒΆ

func GetPaymentRequestStatus() *PaymentRequestStatus

type PaymentStatus ΒΆ

type PaymentStatus struct {
	New        BTCPayPaymentStatus
	Processing BTCPayPaymentStatus
	Expired    BTCPayPaymentStatus
	Invalid    BTCPayPaymentStatus
	Settled    BTCPayPaymentStatus
}

func GetPaymentStatus ΒΆ

func GetPaymentStatus() *PaymentStatus

type Payout ΒΆ

type Payout struct {
	Store  *Store
	Client *Client
	ID     PayoutID
}

func (*Payout) ApprovePayout ΒΆ

func (p *Payout) ApprovePayout(ctx context.Context, payoutApproveRequest *PayoutApproveRequest) (*PayoutResponse, int, error)

func (*Payout) CancelPayout ΒΆ

func (p *Payout) CancelPayout(ctx context.Context) (int, error)

type PayoutApproveRequest ΒΆ

type PayoutApproveRequest struct {
	Revision int64  `json:"revision"`
	RateRule string `json:"rateRule,omitempty"`
}

type PayoutID ΒΆ

type PayoutID string

type PayoutRequest ΒΆ

type PayoutRequest struct {
	Destination   string `json:"destination"`
	Amount        string `json:"amount"`
	PaymentMethod string `json:"paymentMethod"`
}

type PayoutResponse ΒΆ

type PayoutResponse struct {
	ID                  PayoutID           `json:"id"`
	Revision            int64              `json:"revision"`
	PullPaymentID       PullPaymentID      `json:"pullPaymentId"`
	Date                string             `json:"date"`
	Destination         string             `json:"destination"`
	Amount              string             `json:"amount"`
	PaymentMethod       string             `json:"paymentMethod"`
	PaymentMethodAmount string             `json:"paymentMethodAmount"`
	State               BTCPayPayoutStatus `json:"state"`
}

type PayoutStatus ΒΆ

type PayoutStatus struct {
	AwaitingApproval BTCPayPayoutStatus
	AwaitingPayment  BTCPayPayoutStatus
	InProgress       BTCPayPayoutStatus
	Completed        BTCPayPayoutStatus
	Cancelled        BTCPayPayoutStatus
}

func GetPayoutStatus ΒΆ

func GetPayoutStatus() *PayoutStatus

type Permission ΒΆ

type Permission struct {
	Unrestricted                      BTCPayPermission
	UserCanviewprofile                BTCPayPermission
	UserCanmodifyprofile              BTCPayPermission
	UserCanmanagenotificationsforuser BTCPayPermission
	UserCanviewnotificationsforuser   BTCPayPermission

	ServerCancreateuser                         BTCPayPermission
	ServerCanmodifyserversettings               BTCPayPermission
	ServerCanuseinternallightningnode           BTCPayPermission
	ServerCancreatelightninginvoiceinternalnode BTCPayPermission

	StoreCanmodifystoresettings    BTCPayPermission
	StoreWebhooksCanmodifywebhooks BTCPayPermission
	StoreCanviewstoresettings      BTCPayPermission
	StoreCancreateinvoice          BTCPayPermission
	StoreCanviewinvoices           BTCPayPermission
	StoreCanmodifypaymentrequests  BTCPayPermission
	StoreCanviewpaymentrequests    BTCPayPermission
	StoreCanuselightningnode       BTCPayPermission
	StoreCancreatelightninginvoice BTCPayPermission
	CustomPermission               BTCPayPermission
}

func GetPermission ΒΆ

func GetPermission() *Permission

type PullPayment ΒΆ

type PullPayment struct {
	Store  *Store
	Client *Client
	ID     PullPaymentID
}

func (*PullPayment) ArchivePullPayment ΒΆ

func (p *PullPayment) ArchivePullPayment(ctx context.Context) (int, error)

func (*PullPayment) CreatePayout ΒΆ

func (p *PullPayment) CreatePayout(ctx context.Context, payoutRequest *PayoutRequest) (*PayoutResponse, int, error)

func (*PullPayment) GetPayouts ΒΆ

func (p *PullPayment) GetPayouts(ctx context.Context, includeCancelled ...bool) ([]*PayoutResponse, int, error)

func (*PullPayment) GetPullPayment ΒΆ

func (p *PullPayment) GetPullPayment(ctx context.Context) (*PullPaymentResponse, int, error)

type PullPaymentID ΒΆ

type PullPaymentID string

type PullPaymentRequest ΒΆ

type PullPaymentRequest struct {
	Name           string   `json:"name,omitempty"`
	Amount         string   `json:"amount"`
	Currency       string   `json:"currency"`
	Period         int64    `json:"period,omitempty"`
	StartsAt       int64    `json:"startsAt,omitempty"`
	ExpiresAt      int64    `json:"expiresAt,omitempty"`
	PaymentMethods []string `json:"paymentMethods"`
}

type PullPaymentResponse ΒΆ

type PullPaymentResponse struct {
	ID       PullPaymentID `json:"id"`
	Name     string        `json:"name"`
	Currency string        `json:"currency"`
	Amount   string        `json:"amount"`
	Period   int64         `json:"period,omitempty"`
	Archived bool          `json:"archived"`
	ViewLink string        `json:"viewLink"`
}

type ServerInfoResponse ΒΆ

type ServerInfoResponse struct {
	Version                 string             `json:"version"`
	Onion                   string             `json:"onion"`
	SupportedPaymentMethods []string           `json:"supportedPaymentMethods"`
	FullySynched            bool               `json:"fullySynched"`
	SyncStatus              []ServerSyncStatus `json:"syncStatus"`
}

type ServerNodeInformation ΒΆ

type ServerNodeInformation struct {
	Headers              int64   `json:"headers"`
	Blocks               int64   `json:"blocks"`
	VerificationProgress float64 `json:"verificationProgress"`
}

type ServerSyncStatus ΒΆ

type ServerSyncStatus struct {
	CryptoCode      string                `json:"cryptoCode"`
	NodeInformation ServerNodeInformation `json:"nodeInformation,omitempty"`
	ChainHeight     int64                 `json:"chainHeight"`
	SyncHeight      int64                 `json:"syncHeight,omitempty"`
}

type SpeedPolicy ΒΆ

type SpeedPolicy struct {
	HighSpeed      BTCPaySpeedPolicy
	MediumSpeed    BTCPaySpeedPolicy
	LowMediumSpeed BTCPaySpeedPolicy
	LowSpeed       BTCPaySpeedPolicy
}

func GetSpeedPolicy ΒΆ

func GetSpeedPolicy() *SpeedPolicy

type Store ΒΆ

type Store struct {
	ID     StoreID
	Client *Client
}

func (*Store) ApprovePayout ΒΆ

func (s *Store) ApprovePayout(ctx context.Context, payoutID *PayoutID, payoutApproveRequest *PayoutApproveRequest) (*PayoutResponse, int, error)

func (*Store) ArchiveInvoice ΒΆ

func (s *Store) ArchiveInvoice(ctx context.Context, invoiceID *InvoiceID) (int, error)

func (*Store) ArchivePaymentRequest ΒΆ

func (s *Store) ArchivePaymentRequest(ctx context.Context, paymentRequestID *PaymentRequestID) (int, error)

func (*Store) ArchivePullPayment ΒΆ

func (s *Store) ArchivePullPayment(ctx context.Context, pullPaymentID *PullPaymentID) (int, error)

func (*Store) CancelPayout ΒΆ

func (s *Store) CancelPayout(ctx context.Context, payoutID *PayoutID) (int, error)

func (*Store) CreateInvoice ΒΆ

func (s *Store) CreateInvoice(ctx context.Context, invoiceRequest *InvoiceRequest) (*InvoiceResponse, int, error)

func (*Store) CreatePaymentRequest ΒΆ

func (s *Store) CreatePaymentRequest(ctx context.Context, paymentRequestRequest *PaymentRequestRequest) (*PaymentRequestResponse, int, error)

func (*Store) CreatePullPayment ΒΆ

func (s *Store) CreatePullPayment(ctx context.Context, pullPaymentRequest *PullPaymentRequest) (*PullPaymentResponse, int, error)

func (*Store) GetInvoice ΒΆ

func (s *Store) GetInvoice(ctx context.Context, invoiceID *InvoiceID) (*InvoiceResponse, int, error)

func (*Store) GetInvoicePaymentMethod ΒΆ

func (s *Store) GetInvoicePaymentMethod(ctx context.Context, invoiceID *InvoiceID) ([]*InvoicePaymentMethodResponse, int, error)

func (*Store) GetInvoices ΒΆ

func (s *Store) GetInvoices(ctx context.Context) ([]*InvoiceResponse, int, error)

func (*Store) GetPaymentRequest ΒΆ

func (s *Store) GetPaymentRequest(ctx context.Context, paymentRequestID *PaymentRequestID) (*PaymentRequestResponse, int, error)

func (*Store) GetPaymentRequests ΒΆ

func (s *Store) GetPaymentRequests(ctx context.Context) ([]*PaymentRequestResponse, int, error)

func (*Store) GetPullPayments ΒΆ

func (s *Store) GetPullPayments(ctx context.Context, includeArchived ...bool) ([]*PullPaymentResponse, int, error)

func (*Store) GetStore ΒΆ

func (s *Store) GetStore(ctx context.Context) (*StoreResponse, int, error)

func (*Store) MarkInvoiceStatus ΒΆ

func (s *Store) MarkInvoiceStatus(ctx context.Context, invoiceID *InvoiceID, markInvoiceStatusRequest *MarkInvoiceStatusRequest) (*InvoiceResponse, int, error)

func (*Store) RemoveStore ΒΆ

func (s *Store) RemoveStore(ctx context.Context) (int, error)

func (*Store) UnarchiveInvoice ΒΆ

func (s *Store) UnarchiveInvoice(ctx context.Context, invoiceID *InvoiceID) (*InvoiceResponse, int, error)

func (*Store) UpdateInvoice ΒΆ

func (s *Store) UpdateInvoice(ctx context.Context, invoiceID *InvoiceID, invoiceUpdate *InvoiceUpdate) (*InvoiceResponse, int, error)

func (*Store) UpdatePaymentRequest ΒΆ

func (s *Store) UpdatePaymentRequest(ctx context.Context, paymentRequestID *PaymentRequestID, paymentRequestUpdate *PaymentRequestRequest) (*PaymentRequestResponse, int, error)

func (*Store) UpdateStore ΒΆ

func (s *Store) UpdateStore(ctx context.Context, storeUpdate *StoreUpdate) (*StoreResponse, int, error)

type StoreID ΒΆ

type StoreID string

type StoreRequest ΒΆ

type StoreRequest struct {
	Name                         string               `json:"name"`
	Website                      string               `json:"website,omitempty"`
	InvoiceExpiration            int64                `json:"invoiceExpiration,omitempty"`
	MonitoringExpiration         int64                `json:"monitoringExpiration,omitempty"`
	SpeedPolicy                  BTCPaySpeedPolicy    `json:"speedPolicy,omitempty"`
	LightningDescriptionTemplate string               `json:"lightningDescriptionTemplate,omitempty"`
	PaymentTolerance             float64              `json:"paymentTolerance,omitempty"`
	AnyoneCanCreateInvoice       bool                 `json:"anyoneCanCreateInvoice,omitempty"`
	RequiresRefundEmail          bool                 `json:"requiresRefundEmail,omitempty"`
	LightningAmountInSatoshi     bool                 `json:"lightningAmountInSatoshi,omitempty"`
	LightningPrivateRouteHints   bool                 `json:"lightningPrivateRouteHints,omitempty"`
	OnChainWithLnInvoiceFallback bool                 `json:"onChainWithLnInvoiceFallback,omitempty"`
	RedirectAutomatically        bool                 `json:"redirectAutomatically,omitempty"`
	ShowRecommendedFee           bool                 `json:"showRecommendedFee,omitempty"`
	RecommendedFeeBlockTarget    int32                `json:"recommendedFeeBlockTarget,omitempty"`
	DefaultLang                  string               `json:"defaultLang,omitempty"`
	CustomCSS                    string               `json:"customCSS,omitempty"`
	HtmlTitle                    string               `json:"htmlTitle,omitempty"`
	NetworkFeeMode               BTCPayNetworkFeeMode `json:"networkFeeMode,omitempty"`
	PayJoinEnabled               bool                 `json:"payJoinEnabled,omitempty"`
	DefaultPaymentMethod         string               `json:"defaultPaymentMethod,omitempty"`
}

type StoreResponse ΒΆ

type StoreResponse struct {
	Name                         string               `json:"name"`
	Website                      string               `json:"website"`
	InvoiceExpiration            int64                `json:"invoiceExpiration"`
	MonitoringExpiration         int64                `json:"monitoringExpiration"`
	SpeedPolicy                  BTCPaySpeedPolicy    `json:"speedPolicy"`
	LightningDescriptionTemplate string               `json:"lightningDescriptionTemplate,omitempty"`
	PaymentTolerance             float64              `json:"paymentTolerance"`
	AnyoneCanCreateInvoice       bool                 `json:"anyoneCanCreateInvoice"`
	RequiresRefundEmail          bool                 `json:"requiresRefundEmail"`
	LightningAmountInSatoshi     bool                 `json:"lightningAmountInSatoshi"`
	LightningPrivateRouteHints   bool                 `json:"lightningPrivateRouteHints"`
	OnChainWithLnInvoiceFallback bool                 `json:"onChainWithLnInvoiceFallback"`
	RedirectAutomatically        bool                 `json:"redirectAutomatically"`
	ShowRecommendedFee           bool                 `json:"showRecommendedFee"`
	RecommendedFeeBlockTarget    int32                `json:"recommendedFeeBlockTarget"`
	DefaultLang                  string               `json:"defaultLang"`
	CustomCSS                    string               `json:"customCSS,omitempty"`
	HtmlTitle                    string               `json:"htmlTitle,omitempty"`
	NetworkFeeMode               BTCPayNetworkFeeMode `json:"networkFeeMode"`
	PayJoinEnabled               bool                 `json:"payJoinEnabled"`
	DefaultPaymentMethod         string               `json:"defaultPaymentMethod"`
	ID                           StoreID              `json:"id"`
}

type StoreUpdate ΒΆ

type StoreUpdate struct {
	Name                         string               `json:"name,omitempty"`
	Website                      string               `json:"website,omitempty"`
	InvoiceExpiration            int64                `json:"invoiceExpiration,omitempty"`
	MonitoringExpiration         int64                `json:"monitoringExpiration,omitempty"`
	SpeedPolicy                  BTCPaySpeedPolicy    `json:"speedPolicy,omitempty"`
	LightningDescriptionTemplate string               `json:"lightningDescriptionTemplate,omitempty"`
	PaymentTolerance             float64              `json:"paymentTolerance,omitempty"`
	AnyoneCanCreateInvoice       bool                 `json:"anyoneCanCreateInvoice,omitempty"`
	RequiresRefundEmail          bool                 `json:"requiresRefundEmail,omitempty"`
	LightningAmountInSatoshi     bool                 `json:"lightningAmountInSatoshi,omitempty"`
	LightningPrivateRouteHints   bool                 `json:"lightningPrivateRouteHints,omitempty"`
	OnChainWithLnInvoiceFallback bool                 `json:"onChainWithLnInvoiceFallback,omitempty"`
	RedirectAutomatically        bool                 `json:"redirectAutomatically,omitempty"`
	ShowRecommendedFee           bool                 `json:"showRecommendedFee,omitempty"`
	RecommendedFeeBlockTarget    int32                `json:"recommendedFeeBlockTarget,omitempty"`
	DefaultLang                  string               `json:"defaultLang,omitempty"`
	CustomCSS                    string               `json:"customCSS,omitempty"`
	HtmlTitle                    string               `json:"htmlTitle,omitempty"`
	NetworkFeeMode               BTCPayNetworkFeeMode `json:"networkFeeMode,omitempty"`
	PayJoinEnabled               bool                 `json:"payJoinEnabled,omitempty"`
	DefaultPaymentMethod         string               `json:"defaultPaymentMethod,omitempty"`
	ID                           StoreID              `json:"id,omitempty"`
}

type UpdateNotification ΒΆ

type UpdateNotification struct {
	Seen bool `json:"seen"`
}

type UserID ΒΆ

type UserID string

type UserRequest ΒΆ

type UserRequest struct {
	Email           string `json:"email"`
	Password        string `json:"password"`
	IsAdministrator bool   `json:"isAdministrator"`
}

type UserResponse ΒΆ

type UserResponse struct {
	ID                        UserID   `json:"id"`
	Email                     string   `json:"email"`
	EmailConfirmed            bool     `json:"emailConfirmed"`
	RequiresEmailConfirmation bool     `json:"requiresEmailConfirmation"`
	Created                   int64    `json:"created,omitempty"`
	Roles                     []string `json:"roles"`
}

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

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