services

package
v0.0.0-...-ceff573 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateResource

func CreateResource(params CreateResourceParams)

func VerifyPayment

func VerifyPayment(params PaymentParams) error

Types

type BuildPaymentParams

type BuildPaymentParams struct {
	Request     *http.Request
	Network     *aptos.NetworkConfig
	Description string
	Amount      string
	Asset       string
	Receiver    string
	Timeout     uint
}

type CreateResourceParams

type CreateResourceParams struct {
}

type PaymentParams

type PaymentParams struct {
	Facilitator string
	Payload     X402Payload      `json:"paymentPayload"`
	Requirement X402Requirements `json:"paymentRequirements"`
}

type PaymentResult

type PaymentResult struct {
	Success       bool    `json:"success"`
	InvalidReason *string `json:"invalidReason"`
	Error         *string `json:"error"`
	Payer         string  `json:"payer"`
	Transaction   string  `json:"transaction"`
	Network       string  `json:"network"`
}

func SettlePayment

func SettlePayment(params PaymentParams) (*PaymentResult, error)

type PaymentTransation

type PaymentTransation struct {
	ID       string `json:"id"`
	Sender   string `json:"sender"`
	Receiver string `json:"receiver"`
	Network  string `json:"network"`
}

type X402Extra

type X402Extra struct {
	Sponsored bool `json:"sponsored"`
}

type X402Payload

type X402Payload struct {
	X402Version int                `json:"x402Version"`
	Error       string             `json:"error"`
	Resource    X402Resource       `json:"resource"`
	Accepts     []X402Requirements `json:"accepts"`
}

func BuildPayment

func BuildPayment(params BuildPaymentParams) (*X402Payload, error)

type X402Requirements

type X402Requirements struct {
	Scheme            string    `json:"scheme"`
	Network           string    `json:"network"`
	Amount            string    `json:"amount"`
	Asset             string    `json:"asset"`
	PayTo             string    `json:"payTo"`
	MaxTimeoutSeconds uint      `json:"maxTimeoutSeconds"`
	Extra             X402Extra `json:"extra"`
}

type X402Resource

type X402Resource struct {
	URL         string `json:"url"`
	Description string `json:"description"`
	MimeType    string `json:"mimeType"`
}

Jump to

Keyboard shortcuts

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