furlpay

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 12 Imported by: 0

README

Furlpay Go SDK

Official Furlpay server-side SDK for Go — stablecoin payments, wallets, cards, fractional investing, and webhook verification.

Go Reference

Zero dependencies — standard library only.

Install

go get github.com/furlpay/furlpay-go

Quick start

package main

import (
	"fmt"
	"os"

	furlpay "github.com/furlpay/furlpay-go"
)

func main() {
	client := furlpay.New(os.Getenv("FURLPAY_API_KEY"))

	wallet, err := client.WalletsRetrieve()
	if err != nil {
		panic(err)
	}
	fmt.Println(wallet)

	// Gas-sponsored stablecoin transfer
	_, err = client.WalletsTransfer(furlpay.TransferParams{
		Destination: "0xRecipient...",
		Amount:      25.00,
		Token:       "USDC",
		Chain:       "solana",
		Signature:   "...",
	})
	if err != nil {
		panic(err)
	}
}

Verify webhooks

Always verify the furlpay-signature header before trusting a webhook payload. Signatures are HMAC-SHA256 with a 5-minute replay tolerance.

func handleWebhook(w http.ResponseWriter, r *http.Request) {
	body, _ := io.ReadAll(r.Body)

	event, err := furlpay.ConstructEvent(
		body,
		r.Header.Get("furlpay-signature"),
		os.Getenv("FURLPAY_ENDPOINT_SECRET"),
	)
	if err != nil {
		http.Error(w, "invalid signature", http.StatusBadRequest)
		return
	}

	switch event.Type {
	case "payment.settled":
		// fulfil the order
	}
	w.WriteHeader(http.StatusOK)
}

Other SDKs

Language Package
Node.js / TypeScript @furlpay/furlpay-node
Python furlpay (PyPI)
Rust furlpay (crates.io)

API reference

The full OpenAPI 3.1 specification lives at furlpay/furlpay-openapi.

Security

Please report vulnerabilities to hello@furlpay.com — do not open public issues. See SECURITY.md.

License

MIT

Documentation

Overview

Package furlpay is the official Furlpay server-side SDK for Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignPayload

func SignPayload(body, secret string, timestamp int64) string

SignPayload produces a furlpay-signature header value (HMAC-SHA256).

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
}

APIError describes a non-2xx response.

func (*APIError) Error

func (e *APIError) Error() string

type Client

type Client struct {
	APIKey     string
	BaseURL    string
	HTTPClient *http.Client
}

Client is a Furlpay API client.

func New

func New(apiKey string) *Client

New creates a Client with sane defaults.

client := furlpay.New("sk_sandbox_...")

func (*Client) InvestingCreateOrder

func (c *Client) InvestingCreateOrder(p OrderParams) (map[string]any, error)

InvestingCreateOrder places a fractional order.

func (*Client) SwapsQuote

func (c *Client) SwapsQuote(p map[string]any) (map[string]any, error)

SwapsQuote returns a cross-chain swap quote.

func (*Client) WalletsRetrieve

func (c *Client) WalletsRetrieve() (map[string]any, error)

WalletsRetrieve returns Safe balances and modules.

func (*Client) WalletsTransfer

func (c *Client) WalletsTransfer(p TransferParams) (map[string]any, error)

WalletsTransfer submits a gas-sponsored transfer.

type Event

type Event struct {
	ID      string          `json:"id"`
	Type    string          `json:"type"`
	Created int64           `json:"created"`
	Data    json.RawMessage `json:"data"`
}

Event is a Furlpay webhook event envelope.

func ConstructEvent

func ConstructEvent(body []byte, signatureHeader, secret string) (*Event, error)

ConstructEvent verifies the signature header and returns the parsed event.

event, err := furlpay.ConstructEvent(body, r.Header.Get("furlpay-signature"), secret)

type OrderParams

type OrderParams struct {
	Symbol   string  `json:"symbol"`
	Side     string  `json:"side"`
	Notional float64 `json:"notional"`
	Type     string  `json:"type,omitempty"`
}

OrderParams places a fractional stock/ETF order.

type TransferParams

type TransferParams struct {
	Destination string  `json:"destination"`
	Amount      float64 `json:"amount"`
	Token       string  `json:"token"`
	Chain       string  `json:"chain"`
	Signature   string  `json:"signature"`
}

TransferParams executes a gas-sponsored stablecoin transfer.

Jump to

Keyboard shortcuts

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