(Wallets.V1)
- ConfirmHold - Confirm a hold
- CreateBalance - Create a balance
- CreateWallet - Create a new wallet
- CreditWallet - Credit a wallet
- DebitWallet - Debit a wallet
- GetBalance - Get detailed balance
- GetHold - Get a hold
- GetHolds - Get all holds for a wallet
- GetTransactions
- GetWallet - Get a wallet
- GetWalletSummary - Get wallet summary
- ListBalances - List balances of a wallet
- ListWallets - List all wallets
- UpdateWallet - Update a wallet
- VoidHold - Cancel a hold
- WalletsgetServerInfo - Get server info
Confirm a hold
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"math/big"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.ConfirmHold(ctx, operations.ConfirmHoldRequest{
ConfirmHoldRequest: &shared.ConfirmHoldRequest{
Amount: big.NewInt(100),
Final: formancesdkgo.Bool(true),
},
HoldID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.ConfirmHoldRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.ConfirmHoldResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Create a balance
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.CreateBalance(ctx, operations.CreateBalanceRequest{
ID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res.CreateBalanceResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.CreateBalanceRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CreateBalanceResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Create a new wallet
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.CreateWallet(ctx, operations.CreateWalletRequest{})
if err != nil {
log.Fatal(err)
}
if res.CreateWalletResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.CreateWalletRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CreateWalletResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Credit a wallet
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"math/big"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.CreditWallet(ctx, operations.CreditWalletRequest{
CreditWalletRequest: &shared.CreditWalletRequest{
Amount: shared.Monetary{
Amount: big.NewInt(100),
Asset: "USD/2",
},
Metadata: map[string]string{
"key": "",
},
Sources: []shared.Subject{
},
},
ID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.CreditWalletRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CreditWalletResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Debit a wallet
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"math/big"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.DebitWallet(ctx, operations.DebitWalletRequest{
DebitWalletRequest: &shared.DebitWalletRequest{
Amount: shared.Monetary{
Amount: big.NewInt(100),
Asset: "USD/2",
},
Metadata: map[string]string{
"key": "",
},
Pending: formancesdkgo.Bool(true),
},
ID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res.DebitWalletResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.DebitWalletRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.DebitWalletResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Get detailed balance
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.GetBalance(ctx, operations.GetBalanceRequest{
BalanceName: "<value>",
ID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res.GetBalanceResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetBalanceRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetBalanceResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Get a hold
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.GetHold(ctx, operations.GetHoldRequest{
HoldID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res.GetHoldResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetHoldRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetHoldResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Get all holds for a wallet
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.GetHolds(ctx, operations.GetHoldsRequest{
Cursor: formancesdkgo.String("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ=="),
Metadata: map[string]string{
"admin": "true",
},
WalletID: formancesdkgo.String("wallet1"),
})
if err != nil {
log.Fatal(err)
}
if res.GetHoldsResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetHoldsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetHoldsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.GetTransactions(ctx, operations.GetTransactionsRequest{
Cursor: formancesdkgo.String("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ=="),
WalletID: formancesdkgo.String("wallet1"),
})
if err != nil {
log.Fatal(err)
}
if res.GetTransactionsResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetTransactionsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetTransactionsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Get a wallet
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.GetWallet(ctx, operations.GetWalletRequest{
ID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res.GetWalletResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetWalletRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetWalletResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Get wallet summary
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.GetWalletSummary(ctx, operations.GetWalletSummaryRequest{
ID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res.GetWalletSummaryResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetWalletSummaryRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetWalletSummaryResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
List balances of a wallet
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.ListBalances(ctx, operations.ListBalancesRequest{
ID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res.ListBalancesResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.ListBalancesRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.ListBalancesResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4XX, 5XX | */* |
List all wallets
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.ListWallets(ctx, operations.ListWalletsRequest{
Cursor: formancesdkgo.String("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ=="),
Expand: formancesdkgo.String("balances"),
Metadata: map[string]string{
"admin": "true",
},
Name: formancesdkgo.String("wallet1"),
})
if err != nil {
log.Fatal(err)
}
if res.ListWalletsResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.ListWalletsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.ListWalletsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Update a wallet
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.UpdateWallet(ctx, operations.UpdateWalletRequest{
ID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.UpdateWalletRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.UpdateWalletResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Cancel a hold
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.VoidHold(ctx, operations.VoidHoldRequest{
HoldID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.VoidHoldRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.VoidHoldResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Get server info
package main
import(
"context"
formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
"log"
)
func main() {
ctx := context.Background()
s := formancesdkgo.New(
formancesdkgo.WithSecurity(shared.Security{
ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
}),
)
res, err := s.Wallets.V1.WalletsgetServerInfo(ctx)
if err != nil {
log.Fatal(err)
}
if res.ServerInfo != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.WalletsgetServerInfoResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.WalletsErrorResponse | default | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |