Documentation
¶
Index ¶
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type AggregatedBalance
- type AggregatedBalanceCurrency
- type BridgePaymentRail
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, ...) error
- func (r *Client) Get(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params any, res any, ...) error
- type CreateInvoiceCurrency
- type CreateInvoiceDelivery
- type CreateInvoiceItemParam
- type CreateInvoiceParam
- type CreateInvoiceStatus
- type CustomerStatus
- type CustomerType
- type Error
- type ExchangeRateResponse
- type LiquidationAddressResponse
- type PaymentResponse
- type StableCoinCurrency
- type V0BalanceGetAllStablecoinBalancesResponse
- type V0BalanceService
- func (r *V0BalanceService) GetAllStablecoinBalances(ctx context.Context, opts ...option.RequestOption) (res *V0BalanceGetAllStablecoinBalancesResponse, err error)
- func (r *V0BalanceService) GetEurc(ctx context.Context, opts ...option.RequestOption) (res *AggregatedBalance, err error)
- func (r *V0BalanceService) GetUsdc(ctx context.Context, opts ...option.RequestOption) (res *AggregatedBalance, err error)
- type V0CustomerLiquidationAddressGetParams
- type V0CustomerLiquidationAddressNewParams
- type V0CustomerLiquidationAddressNewParamsChain
- type V0CustomerLiquidationAddressNewParamsCurrency
- type V0CustomerLiquidationAddressNewParamsDestinationCurrency
- type V0CustomerLiquidationAddressService
- func (r *V0CustomerLiquidationAddressService) Get(ctx context.Context, liquidationAddressID string, ...) (res *LiquidationAddressResponse, err error)
- func (r *V0CustomerLiquidationAddressService) List(ctx context.Context, customerID string, opts ...option.RequestOption) (res *[]LiquidationAddressResponse, err error)
- func (r *V0CustomerLiquidationAddressService) New(ctx context.Context, customerID string, ...) (res *LiquidationAddressResponse, err error)
- type V0CustomerListParams
- type V0CustomerNewParams
- type V0CustomerService
- func (r *V0CustomerService) Get(ctx context.Context, id string, opts ...option.RequestOption) (err error)
- func (r *V0CustomerService) List(ctx context.Context, query V0CustomerListParams, opts ...option.RequestOption) (err error)
- func (r *V0CustomerService) New(ctx context.Context, body V0CustomerNewParams, opts ...option.RequestOption) (err error)
- func (r *V0CustomerService) Update(ctx context.Context, id string, body V0CustomerUpdateParams, ...) (err error)
- type V0CustomerUpdateParams
- type V0ExchangeRateGetExchangeRateParams
- type V0ExchangeRateService
- func (r *V0ExchangeRateService) GetEurToUsd(ctx context.Context, opts ...option.RequestOption) (res *ExchangeRateResponse, err error)
- func (r *V0ExchangeRateService) GetExchangeRate(ctx context.Context, query V0ExchangeRateGetExchangeRateParams, ...) (res *ExchangeRateResponse, err error)
- func (r *V0ExchangeRateService) GetUsdToEur(ctx context.Context, opts ...option.RequestOption) (res *ExchangeRateResponse, err error)
- type V0HealthCheckPublicResponse
- type V0HealthCheckPublicResponseStatus
- type V0HealthCheckResponse
- type V0HealthCheckResponseDatabase
- type V0HealthCheckResponseStatus
- type V0HealthService
- type V0InvoiceListParams
- type V0InvoiceNewParams
- type V0InvoiceService
- func (r *V0InvoiceService) Get(ctx context.Context, id string, opts ...option.RequestOption) (err error)
- func (r *V0InvoiceService) List(ctx context.Context, query V0InvoiceListParams, opts ...option.RequestOption) (err error)
- func (r *V0InvoiceService) New(ctx context.Context, body V0InvoiceNewParams, opts ...option.RequestOption) (err error)
- func (r *V0InvoiceService) Update(ctx context.Context, id string, body V0InvoiceUpdateParams, ...) (err error)
- type V0InvoiceUpdateParams
- type V0PaymentIntentNewBankParams
- type V0PaymentIntentNewBankParamsSourceCurrency
- type V0PaymentIntentNewStableParams
- type V0PaymentIntentService
- type V0PaymentLinkListParams
- type V0PaymentLinkNewParams
- type V0PaymentLinkNewParamsCurrency
- type V0PaymentLinkNewParamsLinkType
- type V0PaymentLinkNewParamsPaymentLinkProduct
- type V0PaymentLinkService
- func (r *V0PaymentLinkService) Get(ctx context.Context, id string, opts ...option.RequestOption) (err error)
- func (r *V0PaymentLinkService) List(ctx context.Context, query V0PaymentLinkListParams, ...) (err error)
- func (r *V0PaymentLinkService) New(ctx context.Context, body V0PaymentLinkNewParams, opts ...option.RequestOption) (err error)
- func (r *V0PaymentLinkService) Update(ctx context.Context, id string, body V0PaymentLinkUpdateParams, ...) (err error)
- type V0PaymentLinkUpdateParams
- type V0ProductListParams
- type V0ProductNewParams
- type V0ProductNewParamsCurrency
- type V0ProductService
- func (r *V0ProductService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
- func (r *V0ProductService) Get(ctx context.Context, id string, opts ...option.RequestOption) (err error)
- func (r *V0ProductService) List(ctx context.Context, query V0ProductListParams, opts ...option.RequestOption) (err error)
- func (r *V0ProductService) New(ctx context.Context, body V0ProductNewParams, opts ...option.RequestOption) (err error)
- func (r *V0ProductService) Update(ctx context.Context, id string, body V0ProductUpdateParams, ...) (err error)
- func (r *V0ProductService) UploadImages(ctx context.Context, id string, opts ...option.RequestOption) (err error)
- type V0ProductUpdateParams
- type V0ProductUpdateParamsCurrency
- type V0Service
- type V0TaxListParams
- type V0TaxNewParams
- type V0TaxNewResponse
- type V0TaxService
- func (r *V0TaxService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
- func (r *V0TaxService) DeleteAll(ctx context.Context, opts ...option.RequestOption) (err error)
- func (r *V0TaxService) Get(ctx context.Context, id string, opts ...option.RequestOption) (err error)
- func (r *V0TaxService) List(ctx context.Context, query V0TaxListParams, opts ...option.RequestOption) (err error)
- func (r *V0TaxService) New(ctx context.Context, body V0TaxNewParams, opts ...option.RequestOption) (res *V0TaxNewResponse, err error)
- func (r *V0TaxService) Update(ctx context.Context, id string, body V0TaxUpdateParams, ...) (err error)
- func (r *V0TaxService) UpdateAll(ctx context.Context, opts ...option.RequestOption) (err error)
- type V0TaxUpdateParams
- type V0TestPaymentProcessParams
- type V0TestPaymentRefundResponse
- type V0TestPaymentService
- func (r *V0TestPaymentService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *PaymentResponse, err error)
- func (r *V0TestPaymentService) Process(ctx context.Context, body V0TestPaymentProcessParams, ...) (res *PaymentResponse, err error)
- func (r *V0TestPaymentService) Refund(ctx context.Context, id string, opts ...option.RequestOption) (res *V0TestPaymentRefundResponse, err error)
- type V0TransferNewDirectBankParams
- type V0TransferNewDirectWalletParams
- type V0TransferNewExternalBankTransferParams
- type V0TransferNewExternalBankTransferParamsDestinationPaymentRail
- type V0TransferNewExternalStablecoinTransferParams
- type V0TransferNewStablecoinConversionParams
- type V0TransferService
- func (r *V0TransferService) NewDirectBank(ctx context.Context, body V0TransferNewDirectBankParams, ...) (err error)
- func (r *V0TransferService) NewDirectWallet(ctx context.Context, body V0TransferNewDirectWalletParams, ...) (err error)
- func (r *V0TransferService) NewExternalBankTransfer(ctx context.Context, body V0TransferNewExternalBankTransferParams, ...) (err error)
- func (r *V0TransferService) NewExternalStablecoinTransfer(ctx context.Context, body V0TransferNewExternalStablecoinTransferParams, ...) (err error)
- func (r *V0TransferService) NewStablecoinConversion(ctx context.Context, body V0TransferNewStablecoinConversionParams, ...) (err error)
- type V0WebhookListParams
- type V0WebhookNewParams
- type V0WebhookService
- func (r *V0WebhookService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *WebhookResponse, err error)
- func (r *V0WebhookService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *WebhookResponse, err error)
- func (r *V0WebhookService) List(ctx context.Context, query V0WebhookListParams, opts ...option.RequestOption) (res *[]WebhookResponse, err error)
- func (r *V0WebhookService) New(ctx context.Context, body V0WebhookNewParams, opts ...option.RequestOption) (res *WebhookResponse, err error)
- func (r *V0WebhookService) Update(ctx context.Context, id string, body V0WebhookUpdateParams, ...) (res *WebhookResponse, err error)
- type V0WebhookUpdateParams
- type WebhookResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (DEVDRAFT_API_KEY, DEVDRAFT_IDEMPOTENCY_KEY, DEVDRAFT_SECRET, DEVDRAFT_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type AggregatedBalance ¶
type AggregatedBalance struct {
// Detailed breakdown of balances by wallet and chain
Balances [][]any `json:"balances,required"`
// The stablecoin currency
//
// Any of "usdc", "eurc".
Currency AggregatedBalanceCurrency `json:"currency,required"`
// The total aggregated balance across all wallets and chains
TotalBalance string `json:"total_balance,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Balances respjson.Field
Currency respjson.Field
TotalBalance respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AggregatedBalance) RawJSON ¶
func (r AggregatedBalance) RawJSON() string
Returns the unmodified JSON received from the API
func (*AggregatedBalance) UnmarshalJSON ¶
func (r *AggregatedBalance) UnmarshalJSON(data []byte) error
type AggregatedBalanceCurrency ¶
type AggregatedBalanceCurrency string
The stablecoin currency
const ( AggregatedBalanceCurrencyUsdc AggregatedBalanceCurrency = "usdc" AggregatedBalanceCurrencyEurc AggregatedBalanceCurrency = "eurc" )
type BridgePaymentRail ¶
type BridgePaymentRail string
The blockchain network where the source currency resides. Determines gas fees and transaction speed.
const ( BridgePaymentRailEthereum BridgePaymentRail = "ethereum" BridgePaymentRailSolana BridgePaymentRail = "solana" BridgePaymentRailPolygon BridgePaymentRail = "polygon" BridgePaymentRailAvalancheCChain BridgePaymentRail = "avalanche_c_chain" BridgePaymentRailBase BridgePaymentRail = "base" BridgePaymentRailArbitrum BridgePaymentRail = "arbitrum" BridgePaymentRailOptimism BridgePaymentRail = "optimism" BridgePaymentRailStellar BridgePaymentRail = "stellar" BridgePaymentRailTron BridgePaymentRail = "tron" BridgePaymentRailBridgeWallet BridgePaymentRail = "bridge_wallet" BridgePaymentRailWire BridgePaymentRail = "wire" BridgePaymentRailACH BridgePaymentRail = "ach" BridgePaymentRailACHPush BridgePaymentRail = "ach_push" BridgePaymentRailACHSameDay BridgePaymentRail = "ach_same_day" BridgePaymentRailSepa BridgePaymentRail = "sepa" BridgePaymentRailSwift BridgePaymentRail = "swift" BridgePaymentRailSpei BridgePaymentRail = "spei" )
type Client ¶
type Client struct {
Options []option.RequestOption
V0 V0Service
}
Client creates a struct with services and top level methods that help with interacting with the devdraft API. You should not instantiate this client directly, and instead use the NewClient method instead.
func NewClient ¶
func NewClient(opts ...option.RequestOption) (r Client)
NewClient generates a new client with the default option read from the environment (DEVDRAFT_API_KEY, DEVDRAFT_IDEMPOTENCY_KEY, DEVDRAFT_SECRET, DEVDRAFT_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.
func (*Client) Delete ¶
func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Execute ¶
func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error
Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.
If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.
The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.
If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.
Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.
The response body will be deserialized into the res variable, depending on its type:
- A pointer to a *http.Response is populated by the raw response.
- A pointer to a byte array will be populated with the contents of the request body.
- A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
- A nil value will not read the response body.
For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.
func (*Client) Get ¶
func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Patch ¶
func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
type CreateInvoiceCurrency ¶
type CreateInvoiceCurrency string
Currency for the invoice
const ( CreateInvoiceCurrencyUsdc CreateInvoiceCurrency = "usdc" CreateInvoiceCurrencyEurc CreateInvoiceCurrency = "eurc" )
type CreateInvoiceDelivery ¶
type CreateInvoiceDelivery string
Delivery method
const ( CreateInvoiceDeliveryEmail CreateInvoiceDelivery = "EMAIL" CreateInvoiceDeliveryManually CreateInvoiceDelivery = "MANUALLY" )
type CreateInvoiceItemParam ¶
type CreateInvoiceItemParam struct {
// Product ID
ProductID string `json:"product_id,required"`
// Quantity of the product
Quantity float64 `json:"quantity,required"`
// contains filtered or unexported fields
}
The properties ProductID, Quantity are required.
func (CreateInvoiceItemParam) MarshalJSON ¶
func (r CreateInvoiceItemParam) MarshalJSON() (data []byte, err error)
func (*CreateInvoiceItemParam) UnmarshalJSON ¶
func (r *CreateInvoiceItemParam) UnmarshalJSON(data []byte) error
type CreateInvoiceParam ¶
type CreateInvoiceParam struct {
// Currency for the invoice
//
// Any of "usdc", "eurc".
Currency CreateInvoiceCurrency `json:"currency,omitzero,required"`
// Customer ID
CustomerID string `json:"customer_id,required"`
// Delivery method
//
// Any of "EMAIL", "MANUALLY".
Delivery CreateInvoiceDelivery `json:"delivery,omitzero,required"`
// Due date of the invoice
DueDate time.Time `json:"due_date,required" format:"date-time"`
// Email address
Email string `json:"email,required"`
// Array of products in the invoice
Items []CreateInvoiceItemParam `json:"items,omitzero,required"`
// Name of the invoice
Name string `json:"name,required"`
// Allow partial payments
PartialPayment bool `json:"partial_payment,required"`
// Whether to generate a payment link
PaymentLink bool `json:"payment_link,required"`
// Array of accepted payment methods
//
// Any of "ACH", "BANK_TRANSFER", "CREDIT_CARD", "CASH", "MOBILE_MONEY", "CRYPTO".
PaymentMethods []string `json:"payment_methods,omitzero,required"`
// Invoice status
//
// Any of "DRAFT", "OPEN", "PASTDUE", "PAID", "PARTIALLYPAID".
Status CreateInvoiceStatus `json:"status,omitzero,required"`
// Address
Address param.Opt[string] `json:"address,omitzero"`
// Logo URL
Logo param.Opt[string] `json:"logo,omitzero"`
// Phone number
PhoneNumber param.Opt[string] `json:"phone_number,omitzero"`
// Send date
SendDate param.Opt[time.Time] `json:"send_date,omitzero" format:"date-time"`
// Tax ID
TaxID param.Opt[string] `json:"taxId,omitzero"`
// contains filtered or unexported fields
}
The properties Currency, CustomerID, Delivery, DueDate, Email, Items, Name, PartialPayment, PaymentLink, PaymentMethods, Status are required.
func (CreateInvoiceParam) MarshalJSON ¶
func (r CreateInvoiceParam) MarshalJSON() (data []byte, err error)
func (*CreateInvoiceParam) UnmarshalJSON ¶
func (r *CreateInvoiceParam) UnmarshalJSON(data []byte) error
type CreateInvoiceStatus ¶
type CreateInvoiceStatus string
Invoice status
const ( CreateInvoiceStatusDraft CreateInvoiceStatus = "DRAFT" CreateInvoiceStatusOpen CreateInvoiceStatus = "OPEN" CreateInvoiceStatusPastdue CreateInvoiceStatus = "PASTDUE" CreateInvoiceStatusPaid CreateInvoiceStatus = "PAID" CreateInvoiceStatusPartiallypaid CreateInvoiceStatus = "PARTIALLYPAID" )
type CustomerStatus ¶
type CustomerStatus string
Current status of the customer account. Controls access to services and features.
const ( CustomerStatusActive CustomerStatus = "ACTIVE" CustomerStatusBlacklisted CustomerStatus = "BLACKLISTED" CustomerStatusDeactivated CustomerStatus = "DEACTIVATED" CustomerStatusDeleted CustomerStatus = "DELETED" )
type CustomerType ¶
type CustomerType string
Type of customer account. Determines available features and compliance requirements.
const ( CustomerTypeIndividual CustomerType = "Individual" CustomerTypeStartup CustomerType = "Startup" CustomerTypeSmallBusiness CustomerType = "Small Business" CustomerTypeMediumBusiness CustomerType = "Medium Business" CustomerTypeEnterprise CustomerType = "Enterprise" CustomerTypeNonProfit CustomerType = "Non-Profit" CustomerTypeGovernment CustomerType = "Government" )
type ExchangeRateResponse ¶
type ExchangeRateResponse struct {
// Rate for buying target currency (what you get when converting from source to
// target)
BuyRate string `json:"buy_rate,required"`
// Source currency code (USD for USDC)
From string `json:"from,required"`
// Mid-market exchange rate from source to target currency
MidmarketRate string `json:"midmarket_rate,required"`
// Rate for selling target currency (what you pay when converting from target to
// source)
SellRate string `json:"sell_rate,required"`
// Target currency code (EUR for EURC)
To string `json:"to,required"`
// Timestamp when the exchange rate was last updated
Timestamp string `json:"timestamp"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
BuyRate respjson.Field
From respjson.Field
MidmarketRate respjson.Field
SellRate respjson.Field
To respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ExchangeRateResponse) RawJSON ¶
func (r ExchangeRateResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ExchangeRateResponse) UnmarshalJSON ¶
func (r *ExchangeRateResponse) UnmarshalJSON(data []byte) error
type LiquidationAddressResponse ¶
type LiquidationAddressResponse struct {
// Unique identifier for the liquidation address
ID string `json:"id,required"`
// Liquidation address
Address string `json:"address,required"`
// Blockchain chain
Chain string `json:"chain,required"`
// Creation timestamp
CreatedAt string `json:"created_at,required"`
// Currency
Currency string `json:"currency,required"`
// Customer ID this liquidation address belongs to
CustomerID string `json:"customer_id,required"`
// Current state of the liquidation address
State string `json:"state,required"`
// Last update timestamp
UpdatedAt string `json:"updated_at,required"`
// Bridge wallet ID
BridgeWalletID string `json:"bridge_wallet_id"`
// Custom developer fee percent
CustomDeveloperFeePercent string `json:"custom_developer_fee_percent"`
// Destination currency
DestinationCurrency string `json:"destination_currency"`
// Destination payment rail
DestinationPaymentRail string `json:"destination_payment_rail"`
// External account ID
ExternalAccountID string `json:"external_account_id"`
// Prefunded account ID
PrefundedAccountID string `json:"prefunded_account_id"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Address respjson.Field
Chain respjson.Field
CreatedAt respjson.Field
Currency respjson.Field
CustomerID respjson.Field
State respjson.Field
UpdatedAt respjson.Field
BridgeWalletID respjson.Field
CustomDeveloperFeePercent respjson.Field
DestinationCurrency respjson.Field
DestinationPaymentRail respjson.Field
ExternalAccountID respjson.Field
PrefundedAccountID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (LiquidationAddressResponse) RawJSON ¶
func (r LiquidationAddressResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*LiquidationAddressResponse) UnmarshalJSON ¶
func (r *LiquidationAddressResponse) UnmarshalJSON(data []byte) error
type PaymentResponse ¶
type PaymentResponse struct {
// Payment ID
ID string `json:"id,required"`
// The amount charged
Amount float64 `json:"amount,required"`
// The currency code
Currency string `json:"currency,required"`
// Payment status
Status string `json:"status,required"`
// Timestamp of the payment
Timestamp string `json:"timestamp,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Amount respjson.Field
Currency respjson.Field
Status respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PaymentResponse) RawJSON ¶
func (r PaymentResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*PaymentResponse) UnmarshalJSON ¶
func (r *PaymentResponse) UnmarshalJSON(data []byte) error
type StableCoinCurrency ¶
type StableCoinCurrency string
The stablecoin currency to convert FROM. This is the currency the customer will pay with.
const ( StableCoinCurrencyUsdc StableCoinCurrency = "usdc" StableCoinCurrencyEurc StableCoinCurrency = "eurc" )
type V0BalanceGetAllStablecoinBalancesResponse ¶
type V0BalanceGetAllStablecoinBalancesResponse struct {
// EURC balance aggregation
Eurc AggregatedBalance `json:"eurc,required"`
// Total value in USD equivalent
TotalUsdValue string `json:"total_usd_value,required"`
// USDC balance aggregation
Usdc AggregatedBalance `json:"usdc,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Eurc respjson.Field
TotalUsdValue respjson.Field
Usdc respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (V0BalanceGetAllStablecoinBalancesResponse) RawJSON ¶
func (r V0BalanceGetAllStablecoinBalancesResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*V0BalanceGetAllStablecoinBalancesResponse) UnmarshalJSON ¶
func (r *V0BalanceGetAllStablecoinBalancesResponse) UnmarshalJSON(data []byte) error
type V0BalanceService ¶
type V0BalanceService struct {
Options []option.RequestOption
}
V0BalanceService contains methods and other services that help with interacting with the devdraft API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV0BalanceService method instead.
func NewV0BalanceService ¶
func NewV0BalanceService(opts ...option.RequestOption) (r V0BalanceService)
NewV0BalanceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*V0BalanceService) GetAllStablecoinBalances ¶
func (r *V0BalanceService) GetAllStablecoinBalances(ctx context.Context, opts ...option.RequestOption) (res *V0BalanceGetAllStablecoinBalancesResponse, err error)
Retrieves both USDC and EURC balances across all wallets for the specified app.
This comprehensive endpoint provides:
- Complete USDC balance aggregation with detailed breakdown - Complete EURC balance aggregation with detailed breakdown - Total USD equivalent value across both currencies - Individual wallet and chain-specific balance details
## Use Cases
- Complete financial dashboard overview - Multi-currency balance reporting - Comprehensive wallet management - Cross-currency analytics and reporting
## Response Format
The response includes separate aggregations for each currency plus a combined USD value estimate, providing complete visibility into stablecoin holdings.
func (*V0BalanceService) GetEurc ¶
func (r *V0BalanceService) GetEurc(ctx context.Context, opts ...option.RequestOption) (res *AggregatedBalance, err error)
Retrieves the total EURC balance across all wallets for the specified app.
This endpoint aggregates EURC balances from all associated wallets and provides:
- Total EURC balance across all chains and wallets - Detailed breakdown by individual wallet and blockchain network - Contract addresses and wallet identifiers for each balance
## Use Cases
- Dashboard balance display - European market operations - Euro-denominated financial reporting - Cross-currency balance tracking
## Response Format
The response includes both the aggregated total and detailed breakdown, enabling comprehensive euro stablecoin balance management.
func (*V0BalanceService) GetUsdc ¶
func (r *V0BalanceService) GetUsdc(ctx context.Context, opts ...option.RequestOption) (res *AggregatedBalance, err error)
Retrieves the total USDC balance across all wallets for the specified app.
This endpoint aggregates USDC balances from all associated wallets and provides:
- Total USDC balance across all chains and wallets - Detailed breakdown by individual wallet and blockchain network - Contract addresses and wallet identifiers for each balance
## Use Cases
- Dashboard balance display - Financial reporting and reconciliation - Real-time balance monitoring - Multi-chain balance aggregation
## Response Format
The response includes both the aggregated total and detailed breakdown, allowing for comprehensive balance tracking and wallet-specific analysis.
type V0CustomerLiquidationAddressGetParams ¶
type V0CustomerLiquidationAddressGetParams struct {
CustomerID string `path:"customerId,required" json:"-"`
// contains filtered or unexported fields
}
type V0CustomerLiquidationAddressNewParams ¶
type V0CustomerLiquidationAddressNewParams struct {
// The liquidation address on the blockchain
Address string `json:"address,required"`
// The blockchain chain for the liquidation address
//
// Any of "ethereum", "solana", "polygon", "avalanche_c_chain", "base", "arbitrum",
// "optimism", "stellar", "tron".
Chain V0CustomerLiquidationAddressNewParamsChain `json:"chain,omitzero,required"`
// The currency for the liquidation address
//
// Any of "usdc", "eurc", "dai", "pyusd", "usdt".
Currency V0CustomerLiquidationAddressNewParamsCurrency `json:"currency,omitzero,required"`
// Bridge Wallet to send funds to
BridgeWalletID param.Opt[string] `json:"bridge_wallet_id,omitzero"`
// Custom developer fee percentage (Base 100 percentage: 10.2% = "10.2")
CustomDeveloperFeePercent param.Opt[string] `json:"custom_developer_fee_percent,omitzero"`
// Reference for ACH transactions
DestinationACHReference param.Opt[string] `json:"destination_ach_reference,omitzero"`
// Crypto wallet address for crypto transfers
DestinationAddress param.Opt[string] `json:"destination_address,omitzero"`
// Memo for blockchain transactions
DestinationBlockchainMemo param.Opt[string] `json:"destination_blockchain_memo,omitzero"`
// Reference for SEPA transactions
DestinationSepaReference param.Opt[string] `json:"destination_sepa_reference,omitzero"`
// Message for wire transfers
DestinationWireMessage param.Opt[string] `json:"destination_wire_message,omitzero"`
// External bank account to send funds to
ExternalAccountID param.Opt[string] `json:"external_account_id,omitzero"`
// Developer's prefunded account id
PrefundedAccountID param.Opt[string] `json:"prefunded_account_id,omitzero"`
// Address to return funds on failed transactions (Not supported on Stellar)
ReturnAddress param.Opt[string] `json:"return_address,omitzero"`
// Currency for sending funds
//
// Any of "usd", "eur", "mxn", "usdc", "eurc", "dai", "pyusd", "usdt".
DestinationCurrency V0CustomerLiquidationAddressNewParamsDestinationCurrency `json:"destination_currency,omitzero"`
// The blockchain network where the source currency resides. Determines gas fees
// and transaction speed.
//
// Any of "ethereum", "solana", "polygon", "avalanche_c_chain", "base", "arbitrum",
// "optimism", "stellar", "tron", "bridge_wallet", "wire", "ach", "ach_push",
// "ach_same_day", "sepa", "swift", "spei".
DestinationPaymentRail BridgePaymentRail `json:"destination_payment_rail,omitzero"`
// contains filtered or unexported fields
}
func (V0CustomerLiquidationAddressNewParams) MarshalJSON ¶
func (r V0CustomerLiquidationAddressNewParams) MarshalJSON() (data []byte, err error)
func (*V0CustomerLiquidationAddressNewParams) UnmarshalJSON ¶
func (r *V0CustomerLiquidationAddressNewParams) UnmarshalJSON(data []byte) error
type V0CustomerLiquidationAddressNewParamsChain ¶
type V0CustomerLiquidationAddressNewParamsChain string
The blockchain chain for the liquidation address
const ( V0CustomerLiquidationAddressNewParamsChainEthereum V0CustomerLiquidationAddressNewParamsChain = "ethereum" V0CustomerLiquidationAddressNewParamsChainSolana V0CustomerLiquidationAddressNewParamsChain = "solana" V0CustomerLiquidationAddressNewParamsChainPolygon V0CustomerLiquidationAddressNewParamsChain = "polygon" V0CustomerLiquidationAddressNewParamsChainAvalancheCChain V0CustomerLiquidationAddressNewParamsChain = "avalanche_c_chain" V0CustomerLiquidationAddressNewParamsChainBase V0CustomerLiquidationAddressNewParamsChain = "base" V0CustomerLiquidationAddressNewParamsChainArbitrum V0CustomerLiquidationAddressNewParamsChain = "arbitrum" V0CustomerLiquidationAddressNewParamsChainOptimism V0CustomerLiquidationAddressNewParamsChain = "optimism" V0CustomerLiquidationAddressNewParamsChainStellar V0CustomerLiquidationAddressNewParamsChain = "stellar" V0CustomerLiquidationAddressNewParamsChainTron V0CustomerLiquidationAddressNewParamsChain = "tron" )
type V0CustomerLiquidationAddressNewParamsCurrency ¶
type V0CustomerLiquidationAddressNewParamsCurrency string
The currency for the liquidation address
const ( V0CustomerLiquidationAddressNewParamsCurrencyUsdc V0CustomerLiquidationAddressNewParamsCurrency = "usdc" V0CustomerLiquidationAddressNewParamsCurrencyEurc V0CustomerLiquidationAddressNewParamsCurrency = "eurc" V0CustomerLiquidationAddressNewParamsCurrencyDai V0CustomerLiquidationAddressNewParamsCurrency = "dai" V0CustomerLiquidationAddressNewParamsCurrencyPyusd V0CustomerLiquidationAddressNewParamsCurrency = "pyusd" V0CustomerLiquidationAddressNewParamsCurrencyUsdt V0CustomerLiquidationAddressNewParamsCurrency = "usdt" )
type V0CustomerLiquidationAddressNewParamsDestinationCurrency ¶
type V0CustomerLiquidationAddressNewParamsDestinationCurrency string
Currency for sending funds
const ( V0CustomerLiquidationAddressNewParamsDestinationCurrencyUsd V0CustomerLiquidationAddressNewParamsDestinationCurrency = "usd" V0CustomerLiquidationAddressNewParamsDestinationCurrencyEur V0CustomerLiquidationAddressNewParamsDestinationCurrency = "eur" V0CustomerLiquidationAddressNewParamsDestinationCurrencyMxn V0CustomerLiquidationAddressNewParamsDestinationCurrency = "mxn" V0CustomerLiquidationAddressNewParamsDestinationCurrencyUsdc V0CustomerLiquidationAddressNewParamsDestinationCurrency = "usdc" V0CustomerLiquidationAddressNewParamsDestinationCurrencyEurc V0CustomerLiquidationAddressNewParamsDestinationCurrency = "eurc" V0CustomerLiquidationAddressNewParamsDestinationCurrencyDai V0CustomerLiquidationAddressNewParamsDestinationCurrency = "dai" V0CustomerLiquidationAddressNewParamsDestinationCurrencyPyusd V0CustomerLiquidationAddressNewParamsDestinationCurrency = "pyusd" V0CustomerLiquidationAddressNewParamsDestinationCurrencyUsdt V0CustomerLiquidationAddressNewParamsDestinationCurrency = "usdt" )
type V0CustomerLiquidationAddressService ¶
type V0CustomerLiquidationAddressService struct {
Options []option.RequestOption
}
V0CustomerLiquidationAddressService contains methods and other services that help with interacting with the devdraft API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV0CustomerLiquidationAddressService method instead.
func NewV0CustomerLiquidationAddressService ¶
func NewV0CustomerLiquidationAddressService(opts ...option.RequestOption) (r V0CustomerLiquidationAddressService)
NewV0CustomerLiquidationAddressService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*V0CustomerLiquidationAddressService) Get ¶
func (r *V0CustomerLiquidationAddressService) Get(ctx context.Context, liquidationAddressID string, query V0CustomerLiquidationAddressGetParams, opts ...option.RequestOption) (res *LiquidationAddressResponse, err error)
Retrieve a specific liquidation address by its ID for a given customer.
func (*V0CustomerLiquidationAddressService) List ¶
func (r *V0CustomerLiquidationAddressService) List(ctx context.Context, customerID string, opts ...option.RequestOption) (res *[]LiquidationAddressResponse, err error)
Retrieve all liquidation addresses associated with a specific customer.
func (*V0CustomerLiquidationAddressService) New ¶
func (r *V0CustomerLiquidationAddressService) New(ctx context.Context, customerID string, body V0CustomerLiquidationAddressNewParams, opts ...option.RequestOption) (res *LiquidationAddressResponse, err error)
Create a new liquidation address for a customer. Liquidation addresses allow
customers to automatically liquidate cryptocurrency holdings to fiat or other stablecoins based on configured parameters. **Required fields:** - chain: Blockchain network (ethereum, polygon, arbitrum, base) - currency: Stablecoin currency (usdc, eurc, dai, pyusd, usdt) - address: Valid blockchain address **At least one destination must be specified:** - external_account_id: External bank account - prefunded_account_id: Developer's prefunded account - bridge_wallet_id: Bridge wallet - destination_address: Crypto wallet address **Payment Rails:** Different payment rails have different requirements: - ACH: Requires external_account_id, supports destination_ach_reference - SEPA: Requires external_account_id, supports destination_sepa_reference - Wire: Requires external_account_id, supports destination_wire_message - Crypto: Requires destination_address, supports destination_blockchain_memo
type V0CustomerListParams ¶
type V0CustomerListParams struct {
// Filter customers by email (exact match, case-insensitive)
Email param.Opt[string] `query:"email,omitzero" json:"-"`
// Filter customers by name (partial match, case-insensitive)
Name param.Opt[string] `query:"name,omitzero" json:"-"`
// Number of records to skip for pagination
Skip param.Opt[float64] `query:"skip,omitzero" json:"-"`
// Number of records to return (max 100)
Take param.Opt[float64] `query:"take,omitzero" json:"-"`
// Filter customers by status
//
// Any of "ACTIVE", "BLACKLISTED", "DEACTIVATED", "DELETED".
Status CustomerStatus `query:"status,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (V0CustomerListParams) URLQuery ¶
func (r V0CustomerListParams) URLQuery() (v url.Values, err error)
URLQuery serializes V0CustomerListParams's query parameters as `url.Values`.
type V0CustomerNewParams ¶
type V0CustomerNewParams struct {
// Customer's first name. Used for personalization and legal documentation.
FirstName string `json:"first_name,required"`
// Customer's last name. Used for personalization and legal documentation.
LastName string `json:"last_name,required"`
// Customer's phone number. Used for SMS notifications and verification. Include
// country code for international numbers.
PhoneNumber string `json:"phone_number,required"`
// Customer's email address. Used for notifications, receipts, and account
// management. Must be a valid email format.
Email param.Opt[string] `json:"email,omitzero" format:"email"`
// Type of customer account. Determines available features and compliance
// requirements.
//
// Any of "Individual", "Startup", "Small Business", "Medium Business",
// "Enterprise", "Non-Profit", "Government".
CustomerType CustomerType `json:"customer_type,omitzero"`
// Current status of the customer account. Controls access to services and
// features.
//
// Any of "ACTIVE", "BLACKLISTED", "DEACTIVATED", "DELETED".
Status CustomerStatus `json:"status,omitzero"`
// contains filtered or unexported fields
}
func (V0CustomerNewParams) MarshalJSON ¶
func (r V0CustomerNewParams) MarshalJSON() (data []byte, err error)
func (*V0CustomerNewParams) UnmarshalJSON ¶
func (r *V0CustomerNewParams) UnmarshalJSON(data []byte) error
type V0CustomerService ¶
type V0CustomerService struct {
Options []option.RequestOption
LiquidationAddresses V0CustomerLiquidationAddressService
}
V0CustomerService contains methods and other services that help with interacting with the devdraft API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV0CustomerService method instead.
func NewV0CustomerService ¶
func NewV0CustomerService(opts ...option.RequestOption) (r V0CustomerService)
NewV0CustomerService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*V0CustomerService) Get ¶
func (r *V0CustomerService) Get(ctx context.Context, id string, opts ...option.RequestOption) (err error)
Retrieves detailed information about a specific customer.
This endpoint allows you to fetch complete customer details including their contact information and status.
## Use Cases
- View customer details - Verify customer information - Check customer status before processing payments
## Path Parameters
- `id`: Customer UUID (required) - Must be a valid UUID format
## Example Request
`GET /api/v0/customers/123e4567-e89b-12d3-a456-426614174000`
## Example Response
```json
{
"id": "cust_123456",
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"phone_number": "+1-555-123-4567",
"customer_type": "Enterprise",
"status": "ACTIVE",
"last_spent": 1250.5,
"last_purchase_date": "2024-03-15T14:30:00Z",
"created_at": "2024-03-20T10:00:00Z",
"updated_at": "2024-03-20T10:00:00Z"
}
```
func (*V0CustomerService) List ¶
func (r *V0CustomerService) List(ctx context.Context, query V0CustomerListParams, opts ...option.RequestOption) (err error)
Retrieves a list of customers with optional filtering and pagination.
This endpoint allows you to search and filter customers based on various criteria.
## Use Cases
- List all customers with pagination - Search customers by name or email - Filter customers by status - Export customer data
## Query Parameters
- `skip`: Number of records to skip (default: 0, min: 0) - `take`: Number of records to take (default: 10, min: 1, max: 100) - `status`: Filter by customer status (ACTIVE, BLACKLISTED, DEACTIVATED) - `name`: Filter by customer name (partial match, case-insensitive) - `email`: Filter by customer email (exact match, case-insensitive)
## Example Request
`GET /api/v0/customers?skip=0&take=20&status=ACTIVE&name=John`
## Example Response
```json
{
"data": [
{
"id": "cust_123456",
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"phone_number": "+1-555-123-4567",
"customer_type": "Startup",
"status": "ACTIVE",
"created_at": "2024-03-20T10:00:00Z",
"updated_at": "2024-03-20T10:00:00Z"
}
],
"total": 100,
"skip": 0,
"take": 10
}
```
func (*V0CustomerService) New ¶
func (r *V0CustomerService) New(ctx context.Context, body V0CustomerNewParams, opts ...option.RequestOption) (err error)
Creates a new customer in the system with their personal and contact information.
This endpoint allows you to register new customers and store their details for future transactions.
## Use Cases
- Register new customers for payment processing - Store customer information for recurring payments - Maintain customer profiles for transaction history
## Example: Create New Customer
```json
{
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"phone_number": "+1-555-123-4567",
"customer_type": "Startup",
"status": "ACTIVE"
}
```
## Required Fields
- `first_name`: Customer's first name (1-100 characters) - `last_name`: Customer's last name (1-100 characters) - `phone_number`: Customer's phone number (max 20 characters)
## Optional Fields
- `email`: Valid email address (max 255 characters)
- `customer_type`: Type of customer account (Individual, Startup, Small Business, Medium Business, Enterprise, Non-Profit, Government)
- `status`: Customer status (ACTIVE, BLACKLISTED, DEACTIVATED)
func (*V0CustomerService) Update ¶
func (r *V0CustomerService) Update(ctx context.Context, id string, body V0CustomerUpdateParams, opts ...option.RequestOption) (err error)
Updates an existing customer's information.
This endpoint allows you to modify customer details while preserving their core information.
## Use Cases
- Update customer contact information - Change customer type - Modify customer status
## Path Parameters
- `id`: Customer UUID (required) - Must be a valid UUID format
## Example Request
`PATCH /api/v0/customers/123e4567-e89b-12d3-a456-426614174000`
## Example Request Body
```json
{
"first_name": "John",
"last_name": "Smith",
"phone_number": "+1-987-654-3210",
"customer_type": "Small Business"
}
```
## Notes
- Only include fields that need to be updated - All fields are optional in updates - Status changes may require additional verification
type V0CustomerUpdateParams ¶
type V0CustomerUpdateParams struct {
// Customer's email address. Used for notifications, receipts, and account
// management. Must be a valid email format.
Email param.Opt[string] `json:"email,omitzero" format:"email"`
// Customer's first name. Used for personalization and legal documentation.
FirstName param.Opt[string] `json:"first_name,omitzero"`
// Customer's last name. Used for personalization and legal documentation.
LastName param.Opt[string] `json:"last_name,omitzero"`
// Customer's phone number. Used for SMS notifications and verification. Include
// country code for international numbers.
PhoneNumber param.Opt[string] `json:"phone_number,omitzero"`
// Type of customer account. Determines available features and compliance
// requirements.
//
// Any of "Individual", "Startup", "Small Business", "Medium Business",
// "Enterprise", "Non-Profit", "Government".
CustomerType CustomerType `json:"customer_type,omitzero"`
// Current status of the customer account. Controls access to services and
// features.
//
// Any of "ACTIVE", "BLACKLISTED", "DEACTIVATED", "DELETED".
Status CustomerStatus `json:"status,omitzero"`
// contains filtered or unexported fields
}
func (V0CustomerUpdateParams) MarshalJSON ¶
func (r V0CustomerUpdateParams) MarshalJSON() (data []byte, err error)
func (*V0CustomerUpdateParams) UnmarshalJSON ¶
func (r *V0CustomerUpdateParams) UnmarshalJSON(data []byte) error
type V0ExchangeRateGetExchangeRateParams ¶
type V0ExchangeRateGetExchangeRateParams struct {
// Source currency code (e.g., usd)
From string `query:"from,required" json:"-"`
// Target currency code (e.g., eur)
To string `query:"to,required" json:"-"`
// contains filtered or unexported fields
}
func (V0ExchangeRateGetExchangeRateParams) URLQuery ¶
func (r V0ExchangeRateGetExchangeRateParams) URLQuery() (v url.Values, err error)
URLQuery serializes V0ExchangeRateGetExchangeRateParams's query parameters as `url.Values`.
type V0ExchangeRateService ¶
type V0ExchangeRateService struct {
Options []option.RequestOption
}
V0ExchangeRateService contains methods and other services that help with interacting with the devdraft API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV0ExchangeRateService method instead.
func NewV0ExchangeRateService ¶
func NewV0ExchangeRateService(opts ...option.RequestOption) (r V0ExchangeRateService)
NewV0ExchangeRateService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*V0ExchangeRateService) GetEurToUsd ¶
func (r *V0ExchangeRateService) GetEurToUsd(ctx context.Context, opts ...option.RequestOption) (res *ExchangeRateResponse, err error)
Retrieves the current exchange rate for converting EUR to USD (EURC to USDC).
This endpoint provides real-time exchange rate information for stablecoin conversions:
- Mid-market rate for reference pricing - Buy rate for actual conversion calculations - Sell rate for reverse conversion scenarios
## Use Cases
- Display current exchange rates in dashboards - Calculate conversion amounts for EURC to USDC transfers - Financial reporting and analytics - Real-time pricing for multi-currency operations
## Rate Information
- **Mid-market rate**: The theoretical middle rate between buy and sell - **Buy rate**: Rate used when converting FROM EUR TO USD (what you get) - **Sell rate**: Rate used when converting FROM USD TO EUR (what you pay)
The rates are updated in real-time and reflect current market conditions.
func (*V0ExchangeRateService) GetExchangeRate ¶
func (r *V0ExchangeRateService) GetExchangeRate(ctx context.Context, query V0ExchangeRateGetExchangeRateParams, opts ...option.RequestOption) (res *ExchangeRateResponse, err error)
Retrieves the current exchange rate between two specified currencies.
This flexible endpoint allows you to get exchange rates for any supported currency pair:
- Supports USD and EUR currency codes - Provides comprehensive rate information - Real-time market data
## Supported Currency Pairs
- USD to EUR (USDC to EURC) - EUR to USD (EURC to USDC)
## Query Parameters
- **from**: Source currency code (usd, eur) - **to**: Target currency code (usd, eur)
## Use Cases
- Flexible exchange rate queries - Multi-currency application support - Dynamic currency conversion calculations - Financial analytics and reporting
## Rate Information
All rates are provided with full market context including mid-market, buy, and sell rates.
func (*V0ExchangeRateService) GetUsdToEur ¶
func (r *V0ExchangeRateService) GetUsdToEur(ctx context.Context, opts ...option.RequestOption) (res *ExchangeRateResponse, err error)
Retrieves the current exchange rate for converting USD to EUR (USDC to EURC).
This endpoint provides real-time exchange rate information for stablecoin conversions:
- Mid-market rate for reference pricing - Buy rate for actual conversion calculations - Sell rate for reverse conversion scenarios
## Use Cases
- Display current exchange rates in dashboards - Calculate conversion amounts for USDC to EURC transfers - Financial reporting and analytics - Real-time pricing for multi-currency operations
## Rate Information
- **Mid-market rate**: The theoretical middle rate between buy and sell - **Buy rate**: Rate used when converting FROM USD TO EUR (what you get) - **Sell rate**: Rate used when converting FROM EUR TO USD (what you pay)
The rates are updated in real-time and reflect current market conditions.
type V0HealthCheckPublicResponse ¶
type V0HealthCheckPublicResponse struct {
// Basic health status of the service. Returns "ok" when the service is responding.
//
// Any of "ok", "error".
Status V0HealthCheckPublicResponseStatus `json:"status,required"`
// ISO 8601 timestamp when the health check was performed.
Timestamp time.Time `json:"timestamp,required" format:"date-time"`
// Current version of the API service.
Version string `json:"version,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Status respjson.Field
Timestamp respjson.Field
Version respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (V0HealthCheckPublicResponse) RawJSON ¶
func (r V0HealthCheckPublicResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*V0HealthCheckPublicResponse) UnmarshalJSON ¶
func (r *V0HealthCheckPublicResponse) UnmarshalJSON(data []byte) error
type V0HealthCheckPublicResponseStatus ¶
type V0HealthCheckPublicResponseStatus string
Basic health status of the service. Returns "ok" when the service is responding.
const ( V0HealthCheckPublicResponseStatusOk V0HealthCheckPublicResponseStatus = "ok" V0HealthCheckPublicResponseStatusError V0HealthCheckPublicResponseStatus = "error" )
type V0HealthCheckResponse ¶
type V0HealthCheckResponse struct {
// Indicates whether the request was properly authenticated. Always true for this
// endpoint since authentication is required.
Authenticated bool `json:"authenticated,required"`
// Database connectivity status. Shows "connected" when database is accessible,
// "error" when connection fails.
//
// Any of "connected", "error".
Database V0HealthCheckResponseDatabase `json:"database,required"`
// Human-readable message describing the current health status and any issues.
Message string `json:"message,required"`
// Overall health status of the service. Returns "ok" when healthy, "error" when
// issues detected.
//
// Any of "ok", "error".
Status V0HealthCheckResponseStatus `json:"status,required"`
// ISO 8601 timestamp when the health check was performed.
Timestamp time.Time `json:"timestamp,required" format:"date-time"`
// Current version of the API service. Useful for debugging and compatibility
// checks.
Version string `json:"version,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Authenticated respjson.Field
Database respjson.Field
Message respjson.Field
Status respjson.Field
Timestamp respjson.Field
Version respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (V0HealthCheckResponse) RawJSON ¶
func (r V0HealthCheckResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*V0HealthCheckResponse) UnmarshalJSON ¶
func (r *V0HealthCheckResponse) UnmarshalJSON(data []byte) error
type V0HealthCheckResponseDatabase ¶
type V0HealthCheckResponseDatabase string
Database connectivity status. Shows "connected" when database is accessible, "error" when connection fails.
const ( V0HealthCheckResponseDatabaseConnected V0HealthCheckResponseDatabase = "connected" V0HealthCheckResponseDatabaseError V0HealthCheckResponseDatabase = "error" )
type V0HealthCheckResponseStatus ¶
type V0HealthCheckResponseStatus string
Overall health status of the service. Returns "ok" when healthy, "error" when issues detected.
const ( V0HealthCheckResponseStatusOk V0HealthCheckResponseStatus = "ok" V0HealthCheckResponseStatusError V0HealthCheckResponseStatus = "error" )
type V0HealthService ¶
type V0HealthService struct {
Options []option.RequestOption
}
V0HealthService contains methods and other services that help with interacting with the devdraft API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV0HealthService method instead.
func NewV0HealthService ¶
func NewV0HealthService(opts ...option.RequestOption) (r V0HealthService)
NewV0HealthService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*V0HealthService) Check ¶
func (r *V0HealthService) Check(ctx context.Context, opts ...option.RequestOption) (res *V0HealthCheckResponse, err error)
Authenticated health check endpoint
func (*V0HealthService) CheckPublic ¶
func (r *V0HealthService) CheckPublic(ctx context.Context, opts ...option.RequestOption) (res *V0HealthCheckPublicResponse, err error)
Public health check endpoint
type V0InvoiceListParams ¶
type V0InvoiceListParams struct {
// Number of records to skip
Skip param.Opt[float64] `query:"skip,omitzero" json:"-"`
// Number of records to take
Take param.Opt[float64] `query:"take,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (V0InvoiceListParams) URLQuery ¶
func (r V0InvoiceListParams) URLQuery() (v url.Values, err error)
URLQuery serializes V0InvoiceListParams's query parameters as `url.Values`.
type V0InvoiceNewParams ¶
type V0InvoiceNewParams struct {
CreateInvoice CreateInvoiceParam
// contains filtered or unexported fields
}
func (V0InvoiceNewParams) MarshalJSON ¶
func (r V0InvoiceNewParams) MarshalJSON() (data []byte, err error)
func (*V0InvoiceNewParams) UnmarshalJSON ¶
func (r *V0InvoiceNewParams) UnmarshalJSON(data []byte) error
type V0InvoiceService ¶
type V0InvoiceService struct {
Options []option.RequestOption
}
V0InvoiceService contains methods and other services that help with interacting with the devdraft API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV0InvoiceService method instead.
func NewV0InvoiceService ¶
func NewV0InvoiceService(opts ...option.RequestOption) (r V0InvoiceService)
NewV0InvoiceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*V0InvoiceService) Get ¶
func (r *V0InvoiceService) Get(ctx context.Context, id string, opts ...option.RequestOption) (err error)
Get an invoice by ID
func (*V0InvoiceService) List ¶
func (r *V0InvoiceService) List(ctx context.Context, query V0InvoiceListParams, opts ...option.RequestOption) (err error)
Get all invoices
func (*V0InvoiceService) New ¶
func (r *V0InvoiceService) New(ctx context.Context, body V0InvoiceNewParams, opts ...option.RequestOption) (err error)
Create a new invoice
func (*V0InvoiceService) Update ¶
func (r *V0InvoiceService) Update(ctx context.Context, id string, body V0InvoiceUpdateParams, opts ...option.RequestOption) (err error)
Update an invoice
type V0InvoiceUpdateParams ¶
type V0InvoiceUpdateParams struct {
CreateInvoice CreateInvoiceParam
// contains filtered or unexported fields
}
func (V0InvoiceUpdateParams) MarshalJSON ¶
func (r V0InvoiceUpdateParams) MarshalJSON() (data []byte, err error)
func (*V0InvoiceUpdateParams) UnmarshalJSON ¶
func (r *V0InvoiceUpdateParams) UnmarshalJSON(data []byte) error
type V0PaymentIntentNewBankParams ¶
type V0PaymentIntentNewBankParams struct {
// The stablecoin currency to convert FROM. This is the currency the customer will
// pay with.
//
// Any of "usdc", "eurc".
DestinationCurrency StableCoinCurrency `json:"destinationCurrency,omitzero,required"`
// The blockchain network where the source currency resides. Determines gas fees
// and transaction speed.
//
// Any of "ethereum", "solana", "polygon", "avalanche_c_chain", "base", "arbitrum",
// "optimism", "stellar", "tron", "bridge_wallet", "wire", "ach", "ach_push",
// "ach_same_day", "sepa", "swift", "spei".
DestinationNetwork BridgePaymentRail `json:"destinationNetwork,omitzero,required"`
// The fiat currency to convert FROM. Must match the currency of the source payment
// rail.
//
// Any of "usd", "eur", "mxn".
SourceCurrency V0PaymentIntentNewBankParamsSourceCurrency `json:"sourceCurrency,omitzero,required"`
// The blockchain network where the source currency resides. Determines gas fees
// and transaction speed.
//
// Any of "ethereum", "solana", "polygon", "avalanche_c_chain", "base", "arbitrum",
// "optimism", "stellar", "tron", "bridge_wallet", "wire", "ach", "ach_push",
// "ach_same_day", "sepa", "swift", "spei".
SourcePaymentRail BridgePaymentRail `json:"sourcePaymentRail,omitzero,required"`
// ACH reference (for ACH transfers)
ACHReference param.Opt[string] `json:"ach_reference,omitzero"`
// Payment amount (optional for flexible amount)
Amount param.Opt[string] `json:"amount,omitzero"`
// Customer address
CustomerAddress param.Opt[string] `json:"customer_address,omitzero"`
// Customer country
CustomerCountry param.Opt[string] `json:"customer_country,omitzero"`
// Customer country ISO code
CustomerCountryISO param.Opt[string] `json:"customer_countryISO,omitzero"`
// Customer email address
CustomerEmail param.Opt[string] `json:"customer_email,omitzero"`
// Customer first name
CustomerFirstName param.Opt[string] `json:"customer_first_name,omitzero"`
// Customer last name
CustomerLastName param.Opt[string] `json:"customer_last_name,omitzero"`
// Customer province/state
CustomerProvince param.Opt[string] `json:"customer_province,omitzero"`
// Customer province/state ISO code
CustomerProvinceISO param.Opt[string] `json:"customer_provinceISO,omitzero"`
// Destination wallet address. Supports Ethereum (0x...) and Solana address
// formats.
DestinationAddress param.Opt[string] `json:"destinationAddress,omitzero"`
// Customer phone number
PhoneNumber param.Opt[string] `json:"phoneNumber,omitzero"`
// SEPA reference (for SEPA transfers)
SepaReference param.Opt[string] `json:"sepa_reference,omitzero"`
// Wire transfer message (for WIRE transfers)
WireMessage param.Opt[string] `json:"wire_message,omitzero"`
// contains filtered or unexported fields
}
func (V0PaymentIntentNewBankParams) MarshalJSON ¶
func (r V0PaymentIntentNewBankParams) MarshalJSON() (data []byte, err error)
func (*V0PaymentIntentNewBankParams) UnmarshalJSON ¶
func (r *V0PaymentIntentNewBankParams) UnmarshalJSON(data []byte) error
type V0PaymentIntentNewBankParamsSourceCurrency ¶
type V0PaymentIntentNewBankParamsSourceCurrency string
The fiat currency to convert FROM. Must match the currency of the source payment rail.
const ( V0PaymentIntentNewBankParamsSourceCurrencyUsd V0PaymentIntentNewBankParamsSourceCurrency = "usd" V0PaymentIntentNewBankParamsSourceCurrencyEur V0PaymentIntentNewBankParamsSourceCurrency = "eur" V0PaymentIntentNewBankParamsSourceCurrencyMxn V0PaymentIntentNewBankParamsSourceCurrency = "mxn" )
type V0PaymentIntentNewStableParams ¶
type V0PaymentIntentNewStableParams struct {
// The blockchain network where the source currency resides. Determines gas fees
// and transaction speed.
//
// Any of "ethereum", "solana", "polygon", "avalanche_c_chain", "base", "arbitrum",
// "optimism", "stellar", "tron", "bridge_wallet", "wire", "ach", "ach_push",
// "ach_same_day", "sepa", "swift", "spei".
DestinationNetwork BridgePaymentRail `json:"destinationNetwork,omitzero,required"`
// The stablecoin currency to convert FROM. This is the currency the customer will
// pay with.
//
// Any of "usdc", "eurc".
SourceCurrency StableCoinCurrency `json:"sourceCurrency,omitzero,required"`
// The blockchain network where the source currency resides. Determines gas fees
// and transaction speed.
//
// Any of "ethereum", "solana", "polygon", "avalanche_c_chain", "base", "arbitrum",
// "optimism", "stellar", "tron", "bridge_wallet", "wire", "ach", "ach_push",
// "ach_same_day", "sepa", "swift", "spei".
SourceNetwork BridgePaymentRail `json:"sourceNetwork,omitzero,required"`
// Payment amount in the source currency. Omit for flexible amount payments where
// users specify the amount during checkout.
Amount param.Opt[string] `json:"amount,omitzero"`
// Customer's full address. Required for compliance in certain jurisdictions and
// high-value transactions.
CustomerAddress param.Opt[string] `json:"customer_address,omitzero"`
// Customer's country of residence. Used for compliance and tax reporting.
CustomerCountry param.Opt[string] `json:"customer_country,omitzero"`
// Customer's country ISO 3166-1 alpha-2 code. Used for automated compliance
// checks.
CustomerCountryISO param.Opt[string] `json:"customer_countryISO,omitzero"`
// Customer's email address. Used for transaction notifications and receipts.
// Highly recommended for all transactions.
CustomerEmail param.Opt[string] `json:"customer_email,omitzero" format:"email"`
// Customer's first name. Used for transaction records and compliance. Required for
// amounts over $1000.
CustomerFirstName param.Opt[string] `json:"customer_first_name,omitzero"`
// Customer's last name. Used for transaction records and compliance. Required for
// amounts over $1000.
CustomerLastName param.Opt[string] `json:"customer_last_name,omitzero"`
// Customer's state or province. Required for US and Canadian customers.
CustomerProvince param.Opt[string] `json:"customer_province,omitzero"`
// Customer's state or province ISO code. Used for automated tax calculations.
CustomerProvinceISO param.Opt[string] `json:"customer_provinceISO,omitzero"`
// The wallet address where converted funds will be sent. Supports Ethereum (0x...)
// and Solana address formats.
DestinationAddress param.Opt[string] `json:"destinationAddress,omitzero"`
// Customer's phone number with country code. Used for SMS notifications and
// verification.
PhoneNumber param.Opt[string] `json:"phoneNumber,omitzero"`
// The stablecoin currency to convert FROM. This is the currency the customer will
// pay with.
//
// Any of "usdc", "eurc".
DestinationCurrency StableCoinCurrency `json:"destinationCurrency,omitzero"`
// contains filtered or unexported fields
}
func (V0PaymentIntentNewStableParams) MarshalJSON ¶
func (r V0PaymentIntentNewStableParams) MarshalJSON() (data []byte, err error)
func (*V0PaymentIntentNewStableParams) UnmarshalJSON ¶
func (r *V0PaymentIntentNewStableParams) UnmarshalJSON(data []byte) error
type V0PaymentIntentService ¶
type V0PaymentIntentService struct {
Options []option.RequestOption
}
V0PaymentIntentService contains methods and other services that help with interacting with the devdraft API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV0PaymentIntentService method instead.
func NewV0PaymentIntentService ¶
func NewV0PaymentIntentService(opts ...option.RequestOption) (r V0PaymentIntentService)
NewV0PaymentIntentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*V0PaymentIntentService) NewBank ¶
func (r *V0PaymentIntentService) NewBank(ctx context.Context, body V0PaymentIntentNewBankParams, opts ...option.RequestOption) (err error)
Creates a new bank payment intent for fiat-to-stablecoin transfers.
This endpoint allows you to create payment intents for bank transfers (ACH, Wire, SEPA) that convert to stablecoins. Perfect for onboarding users from traditional banking to crypto.
## Supported Payment Rails
- **ACH_PUSH**: US bank transfers (same-day or standard) - **WIRE**: International wire transfers - **SEPA**: European bank transfers
## Use Cases
- USD bank account to USDC conversion - EUR bank account to EURC conversion - MXN bank account to stablecoin conversion - Flexible amount payment intents for variable pricing
## Supported Source Currencies
- **USD**: US Dollar - **EUR**: Euro - **MXN**: Mexican Peso
## Example: USD Bank to USDC
```json
{
"sourcePaymentRail": "ach_push",
"sourceCurrency": "usd",
"destinationCurrency": "usdc",
"destinationNetwork": "ethereum",
"destinationAddress": "0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1",
"amount": "1000.00",
"customer_first_name": "John",
"customer_last_name": "Doe",
"customer_email": "[email protected]",
"ach_reference": "INV12345"
}
```
## Reference Fields
Use appropriate reference fields based on the payment rail:
- `ach_reference`: For ACH transfers (max 10 chars, alphanumeric + spaces) - `wire_message`: For wire transfers (max 256 chars) - `sepa_reference`: For SEPA transfers (6-140 chars, specific character set)
## Idempotency
Include an `idempotency-key` header with a unique UUID v4 to prevent duplicate payments. Subsequent requests with the same key will return the original response.
func (*V0PaymentIntentService) NewStable ¶
func (r *V0PaymentIntentService) NewStable(ctx context.Context, body V0PaymentIntentNewStableParams, opts ...option.RequestOption) (err error)
Creates a new stable payment intent for stablecoin-to-stablecoin transfers.
This endpoint allows you to create payment intents for transfers between different stablecoins and networks. Perfect for cross-chain stablecoin swaps and conversions.
## Use Cases
- USDC to EURC conversions - Cross-chain stablecoin transfers (e.g., Ethereum USDC to Polygon USDC) - Flexible amount payment intents for dynamic pricing
## Example: USDC to EURC Conversion
```json
{
"sourceCurrency": "usdc",
"sourceNetwork": "ethereum",
"destinationCurrency": "eurc",
"destinationNetwork": "polygon",
"destinationAddress": "0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1",
"amount": "100.00",
"customer_first_name": "John",
"customer_last_name": "Doe",
"customer_email": "[email protected]"
}
```
## Flexible Amount Payments
Omit the `amount` field to create a flexible payment intent where users can specify the amount during payment.
## Idempotency
Include an `idempotency-key` header with a unique UUID v4 to prevent duplicate payments. Subsequent requests with the same key will return the original response.
type V0PaymentLinkListParams ¶
type V0PaymentLinkListParams struct {
// Number of records to skip (must be non-negative)
Skip param.Opt[string] `query:"skip,omitzero" json:"-"`
// Number of records to take (must be positive)
Take param.Opt[string] `query:"take,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (V0PaymentLinkListParams) URLQuery ¶
func (r V0PaymentLinkListParams) URLQuery() (v url.Values, err error)
URLQuery serializes V0PaymentLinkListParams's query parameters as `url.Values`.
type V0PaymentLinkNewParams ¶
type V0PaymentLinkNewParams struct {
// Whether to allow mobile payment
AllowMobilePayment bool `json:"allowMobilePayment,required"`
// Whether to allow quantity adjustment
AllowQuantityAdjustment bool `json:"allowQuantityAdjustment,required"`
// Whether to collect address
CollectAddress bool `json:"collectAddress,required"`
// Whether to collect tax
CollectTax bool `json:"collectTax,required"`
// Currency
//
// Any of "usdc", "eurc".
Currency V0PaymentLinkNewParamsCurrency `json:"currency,omitzero,required"`
// Type of the payment link
//
// Any of "INVOICE", "PRODUCT", "COLLECTION", "DONATION".
LinkType V0PaymentLinkNewParamsLinkType `json:"linkType,omitzero,required"`
// Display title for the payment link. This appears on the checkout page and in
// customer communications.
Title string `json:"title,required"`
// Unique URL slug for the payment link. Can be a full URL or just the path
// segment. Must be unique within your account.
URL string `json:"url,required"`
// Amount for the payment link
Amount param.Opt[float64] `json:"amount,omitzero"`
// Cover image URL
CoverImage param.Opt[string] `json:"coverImage,omitzero"`
// Customer ID
CustomerID param.Opt[string] `json:"customerId,omitzero"`
// Detailed description of what the customer is purchasing. Supports markdown
// formatting.
Description param.Opt[string] `json:"description,omitzero"`
// Expiration date
ExpirationDate param.Opt[time.Time] `json:"expiration_date,omitzero" format:"date-time"`
// Whether the payment link is for all products
IsForAllProduct param.Opt[bool] `json:"isForAllProduct,omitzero"`
// Whether to limit payments
LimitPayments param.Opt[bool] `json:"limitPayments,omitzero"`
// Maximum number of payments
MaxPayments param.Opt[float64] `json:"maxPayments,omitzero"`
// Payment for ID
PaymentForID param.Opt[string] `json:"paymentForId,omitzero"`
// Tax ID
TaxID param.Opt[string] `json:"taxId,omitzero"`
// Custom fields
CustomFields any `json:"customFields,omitzero"`
// Array of products in the payment link
PaymentLinkProducts []V0PaymentLinkNewParamsPaymentLinkProduct `json:"paymentLinkProducts,omitzero"`
// contains filtered or unexported fields
}
func (V0PaymentLinkNewParams) MarshalJSON ¶
func (r V0PaymentLinkNewParams) MarshalJSON() (data []byte, err error)
func (*V0PaymentLinkNewParams) UnmarshalJSON ¶
func (r *V0PaymentLinkNewParams) UnmarshalJSON(data []byte) error
type V0PaymentLinkNewParamsCurrency ¶
type V0PaymentLinkNewParamsCurrency string
Currency
const ( V0PaymentLinkNewParamsCurrencyUsdc V0PaymentLinkNewParamsCurrency = "usdc" V0PaymentLinkNewParamsCurrencyEurc V0PaymentLinkNewParamsCurrency = "eurc" )
type V0PaymentLinkNewParamsLinkType ¶
type V0PaymentLinkNewParamsLinkType string
Type of the payment link
const ( V0PaymentLinkNewParamsLinkTypeInvoice V0PaymentLinkNewParamsLinkType = "INVOICE" V0PaymentLinkNewParamsLinkTypeProduct V0PaymentLinkNewParamsLinkType = "PRODUCT" V0PaymentLinkNewParamsLinkTypeCollection V0PaymentLinkNewParamsLinkType = "COLLECTION" V0PaymentLinkNewParamsLinkTypeDonation V0PaymentLinkNewParamsLinkType = "DONATION" )
type V0PaymentLinkNewParamsPaymentLinkProduct ¶
type V0PaymentLinkNewParamsPaymentLinkProduct struct {
// UUID of the product to include in this payment link. Must be a valid product
// from your catalog.
ProductID string `json:"productId,required" format:"uuid"`
// Quantity of this product to include. Must be at least 1.
Quantity int64 `json:"quantity,required"`
// contains filtered or unexported fields
}
The properties ProductID, Quantity are required.
func (V0PaymentLinkNewParamsPaymentLinkProduct) MarshalJSON ¶
func (r V0PaymentLinkNewParamsPaymentLinkProduct) MarshalJSON() (data []byte, err error)
func (*V0PaymentLinkNewParamsPaymentLinkProduct) UnmarshalJSON ¶
func (r *V0PaymentLinkNewParamsPaymentLinkProduct) UnmarshalJSON(data []byte) error
type V0PaymentLinkService ¶
type V0PaymentLinkService struct {
Options []option.RequestOption
}
V0PaymentLinkService contains methods and other services that help with interacting with the devdraft API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV0PaymentLinkService method instead.
func NewV0PaymentLinkService ¶
func NewV0PaymentLinkService(opts ...option.RequestOption) (r V0PaymentLinkService)
NewV0PaymentLinkService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*V0PaymentLinkService) Get ¶
func (r *V0PaymentLinkService) Get(ctx context.Context, id string, opts ...option.RequestOption) (err error)
Get a payment link by ID
func (*V0PaymentLinkService) List ¶
func (r *V0PaymentLinkService) List(ctx context.Context, query V0PaymentLinkListParams, opts ...option.RequestOption) (err error)
Get all payment links
func (*V0PaymentLinkService) New ¶
func (r *V0PaymentLinkService) New(ctx context.Context, body V0PaymentLinkNewParams, opts ...option.RequestOption) (err error)
Creates a new payment link with the provided details. Supports both simple one-time payments and complex product bundles.
func (*V0PaymentLinkService) Update ¶
func (r *V0PaymentLinkService) Update(ctx context.Context, id string, body V0PaymentLinkUpdateParams, opts ...option.RequestOption) (err error)
Update a payment link
type V0PaymentLinkUpdateParams ¶
type V0PaymentLinkUpdateParams struct {
// contains filtered or unexported fields
}
func (V0PaymentLinkUpdateParams) MarshalJSON ¶
func (r V0PaymentLinkUpdateParams) MarshalJSON() (data []byte, err error)
func (*V0PaymentLinkUpdateParams) UnmarshalJSON ¶
func (r *V0PaymentLinkUpdateParams) UnmarshalJSON(data []byte) error
type V0ProductListParams ¶
type V0ProductListParams struct {
// Number of records to skip
Skip param.Opt[float64] `query:"skip,omitzero" json:"-"`
// Number of records to take
Take param.Opt[float64] `query:"take,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (V0ProductListParams) URLQuery ¶
func (r V0ProductListParams) URLQuery() (v url.Values, err error)
URLQuery serializes V0ProductListParams's query parameters as `url.Values`.
type V0ProductNewParams ¶
type V0ProductNewParams struct {
// Detailed description of the product. Supports markdown formatting for rich text
// display.
Description string `json:"description,required"`
// Product name as it will appear to customers. Should be clear and descriptive.
Name string `json:"name,required"`
// Product price in the specified currency. Must be greater than 0.
Price float64 `json:"price,required"`
// Product type
ProductType param.Opt[string] `json:"productType,omitzero"`
// Quantity available
Quantity param.Opt[float64] `json:"quantity,omitzero"`
// Product status
Status param.Opt[string] `json:"status,omitzero"`
// Stock count
StockCount param.Opt[float64] `json:"stockCount,omitzero"`
// Product type
Type param.Opt[string] `json:"type,omitzero"`
// Unit of measurement
Unit param.Opt[string] `json:"unit,omitzero"`
// Weight of the product
Weight param.Opt[float64] `json:"weight,omitzero"`
// Currency code for the price. Defaults to USD if not specified.
//
// Any of "USD", "EUR", "GBP", "CAD", "AUD", "JPY".
Currency V0ProductNewParamsCurrency `json:"currency,omitzero"`
// Array of image URLs
Images []string `json:"images,omitzero"`
// contains filtered or unexported fields
}
func (V0ProductNewParams) MarshalMultipart ¶
func (r V0ProductNewParams) MarshalMultipart() (data []byte, contentType string, err error)
type V0ProductNewParamsCurrency ¶
type V0ProductNewParamsCurrency string
Currency code for the price. Defaults to USD if not specified.
const ( V0ProductNewParamsCurrencyUsd V0ProductNewParamsCurrency = "USD" V0ProductNewParamsCurrencyEur V0ProductNewParamsCurrency = "EUR" V0ProductNewParamsCurrencyGbp V0ProductNewParamsCurrency = "GBP" V0ProductNewParamsCurrencyCad V0ProductNewParamsCurrency = "CAD" V0ProductNewParamsCurrencyAud V0ProductNewParamsCurrency = "AUD" V0ProductNewParamsCurrencyJpy V0ProductNewParamsCurrency = "JPY" )
type V0ProductService ¶
type V0ProductService struct {
Options []option.RequestOption
}
V0ProductService contains methods and other services that help with interacting with the devdraft API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV0ProductService method instead.
func NewV0ProductService ¶
func NewV0ProductService(opts ...option.RequestOption) (r V0ProductService)
NewV0ProductService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*V0ProductService) Delete ¶
func (r *V0ProductService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
Deletes a product and its associated images.
This endpoint allows you to remove a product and all its associated data.
## Use Cases
- Remove discontinued products - Clean up product catalog - Delete test products
## Notes
- This action cannot be undone - All product images will be deleted - Associated data will be removed
func (*V0ProductService) Get ¶
func (r *V0ProductService) Get(ctx context.Context, id string, opts ...option.RequestOption) (err error)
Retrieves detailed information about a specific product.
This endpoint allows you to fetch complete product details including all images.
## Use Cases
- View product details - Display product information - Check product availability
## Example Response
```json
{
"id": "prod_123456",
"name": "Premium Widget",
"description": "High-quality widget for all your needs",
"price": "99.99",
"images": [
"https://storage.example.com/images/file1.jpg",
"https://storage.example.com/images/file2.jpg"
],
"createdAt": "2024-03-20T10:00:00Z",
"updatedAt": "2024-03-20T10:00:00Z"
}
```
func (*V0ProductService) List ¶
func (r *V0ProductService) List(ctx context.Context, query V0ProductListParams, opts ...option.RequestOption) (err error)
Retrieves a list of products with pagination.
This endpoint allows you to fetch products with optional pagination.
## Use Cases
- List all products - Browse product catalog - Implement product search
## Query Parameters
- `skip`: Number of records to skip (default: 0) - `take`: Number of records to take (default: 10)
## Example Response
```json
{
"data": [
{
"id": "prod_123456",
"name": "Premium Widget",
"description": "High-quality widget for all your needs",
"price": "99.99",
"images": [
"https://storage.example.com/images/file1.jpg",
"https://storage.example.com/images/file2.jpg"
],
"createdAt": "2024-03-20T10:00:00Z"
}
],
"total": 100,
"skip": 0,
"take": 10
}
```
func (*V0ProductService) New ¶
func (r *V0ProductService) New(ctx context.Context, body V0ProductNewParams, opts ...option.RequestOption) (err error)
Creates a new product with optional image uploads.
This endpoint allows you to create products with detailed information and multiple images.
## Use Cases
- Add new products to your catalog - Create products with multiple images - Set up product pricing and descriptions
## Supported Image Formats
- JPEG/JPG - PNG - WebP - Maximum 10 images per product - Maximum file size: 5MB per image
## Example Request (multipart/form-data)
``` name: "Premium Widget" description: "High-quality widget for all your needs" price: "99.99" images: [file1.jpg, file2.jpg] // Optional, up to 10 images ```
## Required Fields
- `name`: Product name - `price`: Product price (decimal number)
## Optional Fields
- `description`: Detailed product description - `images`: Product images (up to 10 files)
func (*V0ProductService) Update ¶
func (r *V0ProductService) Update(ctx context.Context, id string, body V0ProductUpdateParams, opts ...option.RequestOption) (err error)
Updates an existing product's information and optionally adds new images.
This endpoint allows you to modify product details and manage product images.
## Use Cases
- Update product information - Change product pricing - Modify product images - Update product description
## Example Request (multipart/form-data)
``` name: "Updated Premium Widget" description: "Updated description" price: "129.99" images: [file1.jpg, file2.jpg] // Optional, up to 10 images ```
## Notes
- Only include fields that need to be updated - New images will replace existing images - Maximum 10 images per product - Images are automatically optimized
func (*V0ProductService) UploadImages ¶
func (r *V0ProductService) UploadImages(ctx context.Context, id string, opts ...option.RequestOption) (err error)
Adds new images to an existing product.
This endpoint allows you to upload additional images for a product that already exists.
## Use Cases
- Add more product images - Update product gallery - Enhance product presentation
## Supported Image Formats
- JPEG/JPG - PNG - WebP - Maximum 10 images per upload - Maximum file size: 5MB per image
## Example Request (multipart/form-data)
``` images: [file1.jpg, file2.jpg] // Up to 10 images ```
## Notes
- Images are appended to existing product images - Total images per product cannot exceed 10 - Images are automatically optimized and resized
type V0ProductUpdateParams ¶
type V0ProductUpdateParams struct {
// Detailed description of the product. Supports markdown formatting for rich text
// display.
Description param.Opt[string] `json:"description,omitzero"`
// Product name as it will appear to customers. Should be clear and descriptive.
Name param.Opt[string] `json:"name,omitzero"`
// Product price in the specified currency. Must be greater than 0.
Price param.Opt[float64] `json:"price,omitzero"`
// Product type
ProductType param.Opt[string] `json:"productType,omitzero"`
// Quantity available
Quantity param.Opt[float64] `json:"quantity,omitzero"`
// Product status
Status param.Opt[string] `json:"status,omitzero"`
// Stock count
StockCount param.Opt[float64] `json:"stockCount,omitzero"`
// Product type
Type param.Opt[string] `json:"type,omitzero"`
// Unit of measurement
Unit param.Opt[string] `json:"unit,omitzero"`
// Weight of the product
Weight param.Opt[float64] `json:"weight,omitzero"`
// Currency code for the price. Defaults to USD if not specified.
//
// Any of "USD", "EUR", "GBP", "CAD", "AUD", "JPY".
Currency V0ProductUpdateParamsCurrency `json:"currency,omitzero"`
// Array of image URLs
Images []string `json:"images,omitzero"`
// contains filtered or unexported fields
}
func (V0ProductUpdateParams) MarshalMultipart ¶
func (r V0ProductUpdateParams) MarshalMultipart() (data []byte, contentType string, err error)
type V0ProductUpdateParamsCurrency ¶
type V0ProductUpdateParamsCurrency string
Currency code for the price. Defaults to USD if not specified.
const ( V0ProductUpdateParamsCurrencyUsd V0ProductUpdateParamsCurrency = "USD" V0ProductUpdateParamsCurrencyEur V0ProductUpdateParamsCurrency = "EUR" V0ProductUpdateParamsCurrencyGbp V0ProductUpdateParamsCurrency = "GBP" V0ProductUpdateParamsCurrencyCad V0ProductUpdateParamsCurrency = "CAD" V0ProductUpdateParamsCurrencyAud V0ProductUpdateParamsCurrency = "AUD" V0ProductUpdateParamsCurrencyJpy V0ProductUpdateParamsCurrency = "JPY" )
type V0Service ¶
type V0Service struct {
Options []option.RequestOption
Health V0HealthService
TestPayment V0TestPaymentService
Customers V0CustomerService
PaymentLinks V0PaymentLinkService
PaymentIntents V0PaymentIntentService
Webhooks V0WebhookService
Transfers V0TransferService
Balance V0BalanceService
ExchangeRate V0ExchangeRateService
Products V0ProductService
Invoices V0InvoiceService
Taxes V0TaxService
}
V0Service contains methods and other services that help with interacting with the devdraft API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV0Service method instead.
func NewV0Service ¶
func NewV0Service(opts ...option.RequestOption) (r V0Service)
NewV0Service generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*V0Service) GetWallets ¶
Get wallets for an app
type V0TaxListParams ¶
type V0TaxListParams struct {
// Filter by active status
Active param.Opt[bool] `query:"active,omitzero" json:"-"`
// Filter taxes by name (partial match, case-insensitive)
Name param.Opt[string] `query:"name,omitzero" json:"-"`
// Number of records to skip for pagination
Skip param.Opt[float64] `query:"skip,omitzero" json:"-"`
// Number of records to return (max 100)
Take param.Opt[float64] `query:"take,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (V0TaxListParams) URLQuery ¶
func (r V0TaxListParams) URLQuery() (v url.Values, err error)
URLQuery serializes V0TaxListParams's query parameters as `url.Values`.
type V0TaxNewParams ¶
type V0TaxNewParams struct {
// Tax name. Used to identify and reference this tax rate.
Name string `json:"name,required"`
// Tax percentage rate. Must be between 0 and 100.
Percentage float64 `json:"percentage,required"`
// Whether this tax is currently active and can be applied.
Active param.Opt[bool] `json:"active,omitzero"`
// Optional description explaining what this tax covers.
Description param.Opt[string] `json:"description,omitzero"`
// Array of app IDs where this tax should be available. If not provided, tax will
// be available for the current app.
AppIDs []string `json:"appIds,omitzero" format:"uuid"`
// contains filtered or unexported fields
}
func (V0TaxNewParams) MarshalJSON ¶
func (r V0TaxNewParams) MarshalJSON() (data []byte, err error)
func (*V0TaxNewParams) UnmarshalJSON ¶
func (r *V0TaxNewParams) UnmarshalJSON(data []byte) error
type V0TaxNewResponse ¶
type V0TaxNewResponse struct {
ID string `json:"id"`
Active bool `json:"active"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
Description string `json:"description"`
Name string `json:"name"`
Percentage float64 `json:"percentage"`
UpdatedAt time.Time `json:"updated_at" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Active respjson.Field
CreatedAt respjson.Field
Description respjson.Field
Name respjson.Field
Percentage respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (V0TaxNewResponse) RawJSON ¶
func (r V0TaxNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*V0TaxNewResponse) UnmarshalJSON ¶
func (r *V0TaxNewResponse) UnmarshalJSON(data []byte) error
type V0TaxService ¶
type V0TaxService struct {
Options []option.RequestOption
}
V0TaxService contains methods and other services that help with interacting with the devdraft API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV0TaxService method instead.
func NewV0TaxService ¶
func NewV0TaxService(opts ...option.RequestOption) (r V0TaxService)
NewV0TaxService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*V0TaxService) Delete ¶
func (r *V0TaxService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
Deletes an existing tax.
## Use Cases
- Remove obsolete tax rates - Clean up unused taxes - Comply with regulatory changes
## Path Parameters
- `id`: Tax UUID (required) - Must be a valid UUID format
## Example Request
`DELETE /api/v0/taxes/123e4567-e89b-12d3-a456-426614174000`
## Warning
This action cannot be undone. Consider deactivating the tax instead of deleting it if it has been used in transactions.
func (*V0TaxService) DeleteAll ¶
func (r *V0TaxService) DeleteAll(ctx context.Context, opts ...option.RequestOption) (err error)
This endpoint requires a tax ID in the URL path. Use DELETE /api/v0/taxes/{id} instead.
func (*V0TaxService) Get ¶
func (r *V0TaxService) Get(ctx context.Context, id string, opts ...option.RequestOption) (err error)
Retrieves detailed information about a specific tax.
## Use Cases
- View tax details - Verify tax configuration - Check tax status before applying to products
## Path Parameters
- `id`: Tax UUID (required) - Must be a valid UUID format
## Example Request
`GET /api/v0/taxes/123e4567-e89b-12d3-a456-426614174000`
## Example Response
```json
{
"id": "tax_123456",
"name": "Sales Tax",
"description": "Standard sales tax for retail transactions",
"percentage": 8.5,
"active": true,
"created_at": "2024-03-20T10:00:00Z",
"updated_at": "2024-03-20T10:00:00Z"
}
```
func (*V0TaxService) List ¶
func (r *V0TaxService) List(ctx context.Context, query V0TaxListParams, opts ...option.RequestOption) (err error)
Retrieves a list of taxes with optional filtering and pagination.
## Use Cases
- List all available tax rates - Search taxes by name - Filter active/inactive taxes - Export tax configuration
## Query Parameters
- `skip`: Number of records to skip (default: 0, min: 0) - `take`: Number of records to return (default: 10, min: 1, max: 100) - `name`: Filter taxes by name (partial match, case-insensitive) - `active`: Filter by active status (true/false)
## Example Request
`GET /api/v0/taxes?skip=0&take=20&active=true&name=Sales`
## Example Response
```json [
{
"id": "tax_123456",
"name": "Sales Tax",
"description": "Standard sales tax for retail transactions",
"percentage": 8.5,
"active": true,
"created_at": "2024-03-20T10:00:00Z",
"updated_at": "2024-03-20T10:00:00Z"
}
] ```
func (*V0TaxService) New ¶
func (r *V0TaxService) New(ctx context.Context, body V0TaxNewParams, opts ...option.RequestOption) (res *V0TaxNewResponse, err error)
Creates a new tax rate that can be applied to products, invoices, and payment links.
## Use Cases
- Set up sales tax for different regions - Create VAT rates for international customers - Configure state and local tax rates - Manage tax compliance requirements
## Example: Create Basic Sales Tax
```json
{
"name": "Sales Tax",
"description": "Standard sales tax for retail transactions",
"percentage": 8.5,
"active": true
}
```
## Required Fields
- `name`: Tax name for identification (1-100 characters) - `percentage`: Tax rate percentage (0-100)
## Optional Fields
- `description`: Explanation of what this tax covers (max 255 characters) - `active`: Whether this tax is currently active (default: true) - `appIds`: Array of app IDs where this tax should be available
func (*V0TaxService) Update ¶
func (r *V0TaxService) Update(ctx context.Context, id string, body V0TaxUpdateParams, opts ...option.RequestOption) (err error)
Updates an existing tax's information.
## Use Cases
- Modify tax percentage rates - Update tax descriptions - Activate/deactivate taxes - Change tax names
## Path Parameters
- `id`: Tax UUID (required) - Must be a valid UUID format
## Example Request
`PUT /api/v0/taxes/123e4567-e89b-12d3-a456-426614174000`
## Example Request Body
```json
{
"name": "Updated Sales Tax",
"description": "Updated sales tax rate",
"percentage": 9.0,
"active": true
}
```
## Notes
- Only include fields that need to be updated - All fields are optional in updates - Percentage changes affect future calculations only
func (*V0TaxService) UpdateAll ¶
func (r *V0TaxService) UpdateAll(ctx context.Context, opts ...option.RequestOption) (err error)
This endpoint requires a tax ID in the URL path. Use PUT /api/v0/taxes/{id} instead.
type V0TaxUpdateParams ¶
type V0TaxUpdateParams struct {
// Whether this tax is currently active and can be applied
Active param.Opt[bool] `json:"active,omitzero"`
// Detailed description of what this tax covers
Description param.Opt[string] `json:"description,omitzero"`
// Tax name for identification and display purposes
Name param.Opt[string] `json:"name,omitzero"`
// Tax rate as a percentage (0-100)
Percentage param.Opt[float64] `json:"percentage,omitzero"`
// Array of app IDs where this tax should be available
AppIDs []string `json:"appIds,omitzero" format:"uuid"`
// contains filtered or unexported fields
}
func (V0TaxUpdateParams) MarshalJSON ¶
func (r V0TaxUpdateParams) MarshalJSON() (data []byte, err error)
func (*V0TaxUpdateParams) UnmarshalJSON ¶
func (r *V0TaxUpdateParams) UnmarshalJSON(data []byte) error
type V0TestPaymentProcessParams ¶
type V0TestPaymentProcessParams struct {
// The amount to charge
Amount float64 `json:"amount,required"`
// The currency code
Currency string `json:"currency,required"`
// Description of the payment
Description string `json:"description,required"`
// Customer reference ID
CustomerID param.Opt[string] `json:"customerId,omitzero"`
// contains filtered or unexported fields
}
func (V0TestPaymentProcessParams) MarshalJSON ¶
func (r V0TestPaymentProcessParams) MarshalJSON() (data []byte, err error)
func (*V0TestPaymentProcessParams) UnmarshalJSON ¶
func (r *V0TestPaymentProcessParams) UnmarshalJSON(data []byte) error
type V0TestPaymentRefundResponse ¶
type V0TestPaymentRefundResponse struct {
// Refund ID
ID string `json:"id,required"`
// The amount refunded
Amount float64 `json:"amount,required"`
// Original payment ID
PaymentID string `json:"paymentId,required"`
// Refund status
Status string `json:"status,required"`
// Timestamp of the refund
Timestamp string `json:"timestamp,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Amount respjson.Field
PaymentID respjson.Field
Status respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (V0TestPaymentRefundResponse) RawJSON ¶
func (r V0TestPaymentRefundResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*V0TestPaymentRefundResponse) UnmarshalJSON ¶
func (r *V0TestPaymentRefundResponse) UnmarshalJSON(data []byte) error
type V0TestPaymentService ¶
type V0TestPaymentService struct {
Options []option.RequestOption
}
V0TestPaymentService contains methods and other services that help with interacting with the devdraft API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV0TestPaymentService method instead.
func NewV0TestPaymentService ¶
func NewV0TestPaymentService(opts ...option.RequestOption) (r V0TestPaymentService)
NewV0TestPaymentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*V0TestPaymentService) Get ¶
func (r *V0TestPaymentService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *PaymentResponse, err error)
Get payment details by ID
func (*V0TestPaymentService) Process ¶
func (r *V0TestPaymentService) Process(ctx context.Context, body V0TestPaymentProcessParams, opts ...option.RequestOption) (res *PaymentResponse, err error)
Creates a new payment. Requires an idempotency key to prevent duplicate payments on retry.
## Idempotency Key Best Practices
- **Generate unique keys**: Use UUIDs or similar unique identifiers, prefixed with a descriptive operation name
- **Store keys client-side**: Save the key with the original request so you can retry with the same key
- **Key format**: Between 6-64 alphanumeric characters
- **Expiration**: Keys expire after 24 hours by default
- **Use case**: Perfect for ensuring payment operations are never processed twice, even during network failures
## Example Request (curl)
```bash
curl -X POST \
https://api.example.com/rest-api/v0/test-payment \
-H 'Content-Type: application/json' \
-H 'Client-Key: your-api-key' \
-H 'Client-Secret: your-api-secret' \
-H 'Idempotency-Key: payment_123456_unique_key' \
-d '{
"amount": 100.00,
"currency": "USD",
"description": "Test payment for order #12345",
"customerId": "cus_12345"
}'
```
## Example Response (First Request)
```json
{
"id": "pay_abc123xyz456",
"amount": 100.0,
"currency": "USD",
"status": "succeeded",
"timestamp": "2023-07-01T12:00:00.000Z"
}
```
## Example Response (Duplicate Request)
The exact same response will be returned for any duplicate request with the same idempotency key, without creating a new payment.
## Retry Scenario Example
Network failure during payment submission:
- Client creates payment request with idempotency key: "payment_123456_unique_key"
- Request begins processing, but network connection fails before response received
- Client retries the exact same request with the same idempotency key
- Server detects duplicate idempotency key and returns the result of the first request
- No duplicate payment is created
If you retry with same key but different parameters (e.g., different amount), you'll receive a 409 Conflict error.
func (*V0TestPaymentService) Refund ¶
func (r *V0TestPaymentService) Refund(ctx context.Context, id string, opts ...option.RequestOption) (res *V0TestPaymentRefundResponse, err error)
Refunds an existing payment. Requires an idempotency key to prevent duplicate refunds on retry.
## Idempotency Key Benefits for Refunds
Refunds are critical financial operations where duplicates can cause serious issues. Using idempotency keys ensures:
- **Prevent duplicate refunds**: Even if a request times out or fails, retrying with the same key won't issue multiple refunds
- **Safe retries**: Network failures or timeouts won't risk creating multiple refunds
- **Consistent response**: Always get the same response for the same operation
## Example Request (curl)
```bash
curl -X POST \ https://api.example.com/rest-api/v0/test-payment/pay_abc123xyz456/refund \ -H 'Content-Type: application/json' \ -H 'Client-Key: your-api-key' \ -H 'Client-Secret: your-api-secret' \ -H 'Idempotency-Key: refund_123456_unique_key'
```
## Example Response (First Request)
```json
{
"id": "ref_xyz789",
"paymentId": "pay_abc123xyz456",
"amount": 100.0,
"status": "succeeded",
"timestamp": "2023-07-01T14:30:00.000Z"
}
```
## Example Response (Duplicate Request)
The exact same response will be returned for any duplicate request with the same idempotency key, without creating a new refund.
## Idempotency Key Guidelines
- Use a unique key for each distinct refund operation - Store keys client-side to ensure you can retry with the same key if needed - Keys expire after 24 hours by default
type V0TransferNewDirectBankParams ¶
type V0TransferNewDirectBankParams struct {
// The amount to transfer
Amount float64 `json:"amount,required"`
// The destination currency
DestinationCurrency string `json:"destinationCurrency,required"`
// The payment rail to use
PaymentRail string `json:"paymentRail,required"`
// The source currency
SourceCurrency string `json:"sourceCurrency,required"`
// The ID of the bridge wallet to transfer from
WalletID string `json:"walletId,required"`
// ACH transfer reference
ACHReference param.Opt[string] `json:"ach_reference,omitzero"`
// SEPA transfer reference
SepaReference param.Opt[string] `json:"sepa_reference,omitzero"`
// Wire transfer message
WireMessage param.Opt[string] `json:"wire_message,omitzero"`
// contains filtered or unexported fields
}
func (V0TransferNewDirectBankParams) MarshalJSON ¶
func (r V0TransferNewDirectBankParams) MarshalJSON() (data []byte, err error)
func (*V0TransferNewDirectBankParams) UnmarshalJSON ¶
func (r *V0TransferNewDirectBankParams) UnmarshalJSON(data []byte) error
type V0TransferNewDirectWalletParams ¶
type V0TransferNewDirectWalletParams struct {
// The amount to transfer
Amount float64 `json:"amount,required"`
// The network to use for the transfer
Network string `json:"network,required"`
// The stablecoin currency to use
StableCoinCurrency string `json:"stableCoinCurrency,required"`
// The ID of the bridge wallet to transfer from
WalletID string `json:"walletId,required"`
// contains filtered or unexported fields
}
func (V0TransferNewDirectWalletParams) MarshalJSON ¶
func (r V0TransferNewDirectWalletParams) MarshalJSON() (data []byte, err error)
func (*V0TransferNewDirectWalletParams) UnmarshalJSON ¶
func (r *V0TransferNewDirectWalletParams) UnmarshalJSON(data []byte) error
type V0TransferNewExternalBankTransferParams ¶
type V0TransferNewExternalBankTransferParams struct {
// The destination currency
DestinationCurrency string `json:"destinationCurrency,required"`
// The destination payment rail (fiat payment method)
//
// Any of "ach", "ach_push", "ach_same_day", "wire", "sepa", "swift", "spei".
DestinationPaymentRail V0TransferNewExternalBankTransferParamsDestinationPaymentRail `json:"destinationPaymentRail,omitzero,required"`
// The external account ID for the bank transfer
ExternalAccountID string `json:"external_account_id,required"`
// The source currency
SourceCurrency string `json:"sourceCurrency,required"`
// The ID of the source bridge wallet
SourceWalletID string `json:"sourceWalletId,required"`
// ACH reference message (1-10 characters, only for ACH transfers)
ACHReference param.Opt[string] `json:"ach_reference,omitzero"`
// The amount to transfer
Amount param.Opt[float64] `json:"amount,omitzero"`
// SEPA reference message (6-140 characters, only for SEPA transfers)
SepaReference param.Opt[string] `json:"sepa_reference,omitzero"`
// SPEI reference message (1-40 characters, only for SPEI transfers)
SpeiReference param.Opt[string] `json:"spei_reference,omitzero"`
// SWIFT charges bearer (only for SWIFT transfers)
SwiftCharges param.Opt[string] `json:"swift_charges,omitzero"`
// SWIFT reference message (1-190 characters, only for SWIFT transfers)
SwiftReference param.Opt[string] `json:"swift_reference,omitzero"`
// Wire transfer message (1-256 characters, only for wire transfers)
WireMessage param.Opt[string] `json:"wire_message,omitzero"`
// contains filtered or unexported fields
}
func (V0TransferNewExternalBankTransferParams) MarshalJSON ¶
func (r V0TransferNewExternalBankTransferParams) MarshalJSON() (data []byte, err error)
func (*V0TransferNewExternalBankTransferParams) UnmarshalJSON ¶
func (r *V0TransferNewExternalBankTransferParams) UnmarshalJSON(data []byte) error
type V0TransferNewExternalBankTransferParamsDestinationPaymentRail ¶
type V0TransferNewExternalBankTransferParamsDestinationPaymentRail string
The destination payment rail (fiat payment method)
const ( V0TransferNewExternalBankTransferParamsDestinationPaymentRailACH V0TransferNewExternalBankTransferParamsDestinationPaymentRail = "ach" V0TransferNewExternalBankTransferParamsDestinationPaymentRailACHPush V0TransferNewExternalBankTransferParamsDestinationPaymentRail = "ach_push" V0TransferNewExternalBankTransferParamsDestinationPaymentRailACHSameDay V0TransferNewExternalBankTransferParamsDestinationPaymentRail = "ach_same_day" V0TransferNewExternalBankTransferParamsDestinationPaymentRailWire V0TransferNewExternalBankTransferParamsDestinationPaymentRail = "wire" V0TransferNewExternalBankTransferParamsDestinationPaymentRailSepa V0TransferNewExternalBankTransferParamsDestinationPaymentRail = "sepa" V0TransferNewExternalBankTransferParamsDestinationPaymentRailSwift V0TransferNewExternalBankTransferParamsDestinationPaymentRail = "swift" V0TransferNewExternalBankTransferParamsDestinationPaymentRailSpei V0TransferNewExternalBankTransferParamsDestinationPaymentRail = "spei" )
type V0TransferNewExternalStablecoinTransferParams ¶
type V0TransferNewExternalStablecoinTransferParams struct {
// Beneficiary ID for the stablecoin transfer
BeneficiaryID string `json:"beneficiaryId,required"`
// The destination currency
DestinationCurrency string `json:"destinationCurrency,required"`
// The source currency
SourceCurrency string `json:"sourceCurrency,required"`
// The ID of the source bridge wallet
SourceWalletID string `json:"sourceWalletId,required"`
// The amount to transfer
Amount param.Opt[float64] `json:"amount,omitzero"`
// Blockchain memo for the transfer
BlockchainMemo param.Opt[string] `json:"blockchain_memo,omitzero"`
// contains filtered or unexported fields
}
func (V0TransferNewExternalStablecoinTransferParams) MarshalJSON ¶
func (r V0TransferNewExternalStablecoinTransferParams) MarshalJSON() (data []byte, err error)
func (*V0TransferNewExternalStablecoinTransferParams) UnmarshalJSON ¶
func (r *V0TransferNewExternalStablecoinTransferParams) UnmarshalJSON(data []byte) error
type V0TransferNewStablecoinConversionParams ¶
type V0TransferNewStablecoinConversionParams struct {
// The amount to convert
Amount float64 `json:"amount,required"`
// The destination currency
DestinationCurrency string `json:"destinationCurrency,required"`
// The source currency
SourceCurrency string `json:"sourceCurrency,required"`
// The source network
SourceNetwork string `json:"sourceNetwork,required"`
// The ID of the bridge wallet to use
WalletID string `json:"walletId,required"`
// contains filtered or unexported fields
}
func (V0TransferNewStablecoinConversionParams) MarshalJSON ¶
func (r V0TransferNewStablecoinConversionParams) MarshalJSON() (data []byte, err error)
func (*V0TransferNewStablecoinConversionParams) UnmarshalJSON ¶
func (r *V0TransferNewStablecoinConversionParams) UnmarshalJSON(data []byte) error
type V0TransferService ¶
type V0TransferService struct {
Options []option.RequestOption
}
V0TransferService contains methods and other services that help with interacting with the devdraft API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV0TransferService method instead.
func NewV0TransferService ¶
func NewV0TransferService(opts ...option.RequestOption) (r V0TransferService)
NewV0TransferService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*V0TransferService) NewDirectBank ¶
func (r *V0TransferService) NewDirectBank(ctx context.Context, body V0TransferNewDirectBankParams, opts ...option.RequestOption) (err error)
Create a direct bank transfer
func (*V0TransferService) NewDirectWallet ¶
func (r *V0TransferService) NewDirectWallet(ctx context.Context, body V0TransferNewDirectWalletParams, opts ...option.RequestOption) (err error)
Create a direct wallet transfer
func (*V0TransferService) NewExternalBankTransfer ¶
func (r *V0TransferService) NewExternalBankTransfer(ctx context.Context, body V0TransferNewExternalBankTransferParams, opts ...option.RequestOption) (err error)
Create an external bank transfer
func (*V0TransferService) NewExternalStablecoinTransfer ¶
func (r *V0TransferService) NewExternalStablecoinTransfer(ctx context.Context, body V0TransferNewExternalStablecoinTransferParams, opts ...option.RequestOption) (err error)
Create an external stablecoin transfer
func (*V0TransferService) NewStablecoinConversion ¶
func (r *V0TransferService) NewStablecoinConversion(ctx context.Context, body V0TransferNewStablecoinConversionParams, opts ...option.RequestOption) (err error)
Create a stablecoin conversion
type V0WebhookListParams ¶
type V0WebhookListParams struct {
// Number of records to skip (default: 0)
Skip param.Opt[float64] `query:"skip,omitzero" json:"-"`
// Number of records to return (default: 10)
Take param.Opt[float64] `query:"take,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (V0WebhookListParams) URLQuery ¶
func (r V0WebhookListParams) URLQuery() (v url.Values, err error)
URLQuery serializes V0WebhookListParams's query parameters as `url.Values`.
type V0WebhookNewParams ¶
type V0WebhookNewParams struct {
// Whether webhook payloads should be encrypted
Encrypted bool `json:"encrypted,required"`
// Whether the webhook is active and will receive events
IsActive bool `json:"isActive,required"`
// Name of the webhook for identification purposes
Name string `json:"name,required"`
// URL where webhook events will be sent
URL string `json:"url,required" format:"uri"`
// Secret key used to sign webhook payloads for verification
SigningSecret param.Opt[string] `json:"signing_secret,omitzero"`
// contains filtered or unexported fields
}
func (V0WebhookNewParams) MarshalJSON ¶
func (r V0WebhookNewParams) MarshalJSON() (data []byte, err error)
func (*V0WebhookNewParams) UnmarshalJSON ¶
func (r *V0WebhookNewParams) UnmarshalJSON(data []byte) error
type V0WebhookService ¶
type V0WebhookService struct {
Options []option.RequestOption
}
V0WebhookService contains methods and other services that help with interacting with the devdraft API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV0WebhookService method instead.
func NewV0WebhookService ¶
func NewV0WebhookService(opts ...option.RequestOption) (r V0WebhookService)
NewV0WebhookService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*V0WebhookService) Delete ¶
func (r *V0WebhookService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *WebhookResponse, err error)
Deletes a webhook configuration. Requires webhook:delete scope.
func (*V0WebhookService) Get ¶
func (r *V0WebhookService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *WebhookResponse, err error)
Retrieves details for a specific webhook. Requires webhook:read scope.
func (*V0WebhookService) List ¶
func (r *V0WebhookService) List(ctx context.Context, query V0WebhookListParams, opts ...option.RequestOption) (res *[]WebhookResponse, err error)
Retrieves a list of all webhooks for your application. Requires webhook:read scope.
func (*V0WebhookService) New ¶
func (r *V0WebhookService) New(ctx context.Context, body V0WebhookNewParams, opts ...option.RequestOption) (res *WebhookResponse, err error)
Creates a new webhook endpoint for receiving event notifications. Requires webhook:create scope.
func (*V0WebhookService) Update ¶
func (r *V0WebhookService) Update(ctx context.Context, id string, body V0WebhookUpdateParams, opts ...option.RequestOption) (res *WebhookResponse, err error)
Updates an existing webhook configuration. Requires webhook:update scope.
type V0WebhookUpdateParams ¶
type V0WebhookUpdateParams struct {
// Whether webhook payloads should be encrypted
Encrypted param.Opt[bool] `json:"encrypted,omitzero"`
// Whether the webhook is active and will receive events
IsActive param.Opt[bool] `json:"isActive,omitzero"`
// Name of the webhook for identification purposes
Name param.Opt[string] `json:"name,omitzero"`
// Secret key used to sign webhook payloads for verification
SigningSecret param.Opt[string] `json:"signing_secret,omitzero"`
// URL where webhook events will be sent
URL param.Opt[string] `json:"url,omitzero" format:"uri"`
// contains filtered or unexported fields
}
func (V0WebhookUpdateParams) MarshalJSON ¶
func (r V0WebhookUpdateParams) MarshalJSON() (data []byte, err error)
func (*V0WebhookUpdateParams) UnmarshalJSON ¶
func (r *V0WebhookUpdateParams) UnmarshalJSON(data []byte) error
type WebhookResponse ¶
type WebhookResponse struct {
// Unique identifier for the webhook
ID string `json:"id,required"`
// Timestamp when the webhook was created
CreatedAt string `json:"created_at,required"`
// Webhook delivery statistics
DeliveryStats any `json:"delivery_stats,required"`
// Whether webhook payloads are encrypted
Encrypted bool `json:"encrypted,required"`
// Whether the webhook is currently active
IsActive bool `json:"isActive,required"`
// Name of the webhook
Name string `json:"name,required"`
// Timestamp when the webhook was last updated
UpdatedAt string `json:"updated_at,required"`
// URL where webhook events are sent
URL string `json:"url,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
DeliveryStats respjson.Field
Encrypted respjson.Field
IsActive respjson.Field
Name respjson.Field
UpdatedAt respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebhookResponse) RawJSON ¶
func (r WebhookResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookResponse) UnmarshalJSON ¶
func (r *WebhookResponse) UnmarshalJSON(data []byte) error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
|
Package json implements encoding and decoding of JSON as defined in RFC 7159. |
|
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
|
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package. |
|
packages
|
|
|
shared
|
|