Documentation
¶
Index ¶
- Variables
- func DefaultHTTPClient() *req.Client
- func FromJSONString[T any](v string) (T, error)
- func Sign(apiKey string, data interface{}) string
- func ToJSON[T any](v T) ([]byte, error)
- type Balance
- type BalanceResponse
- type BalanceResult
- type BlockStaticWalletData
- type BlockStaticWalletRequest
- type BlockStaticWalletResponse
- type BlockStaticWalletStatus
- type CancelRecurringPaymentRequest
- type CancelRecurringPaymentResponse
- type CreateInvoiceData
- type CreateInvoiceRequest
- type CreateInvoiceResponse
- type CreatePayoutRequest
- type CreatePayoutResponse
- type CreateRecurringPaymentRequest
- type CreateRecurringPaymentResponse
- type CreateStaticWalletData
- type CreateStaticWalletRequest
- type CreateStaticWalletResponse
- type Cryptomus
- func (sdk *Cryptomus) Balance() (*BalanceResponse, error)
- func (sdk *Cryptomus) BalanceWithContext(ctx context.Context) (*BalanceResponse, error)
- func (sdk *Cryptomus) BlockStaticWallet(payload *BlockStaticWalletRequest) (*BlockStaticWalletResponse, error)
- func (sdk *Cryptomus) BlockStaticWalletWithContext(ctx context.Context, payload *BlockStaticWalletRequest) (*BlockStaticWalletResponse, error)
- func (sdk *Cryptomus) CancelRecurringPayment(payload CancelRecurringPaymentRequest) (*CancelRecurringPaymentResponse, error)
- func (sdk *Cryptomus) CancelRecurringPaymentWithContext(ctx context.Context, payload CancelRecurringPaymentRequest) (*CancelRecurringPaymentResponse, error)
- func (sdk *Cryptomus) CreateInvoice(payload *CreateInvoiceRequest) (*CreateInvoiceResponse, error)
- func (sdk *Cryptomus) CreateInvoiceWithContext(ctx context.Context, payload *CreateInvoiceRequest) (*CreateInvoiceResponse, error)
- func (sdk *Cryptomus) CreatePayout(payload *CreatePayoutRequest) (*CreatePayoutResponse, error)
- func (sdk *Cryptomus) CreatePayoutWithContext(ctx context.Context, payload *CreatePayoutRequest) (*CreatePayoutResponse, error)
- func (sdk *Cryptomus) CreateRecurringPayment(request CreateRecurringPaymentRequest) (*CreateRecurringPaymentResponse, error)
- func (sdk *Cryptomus) CreateRecurringPaymentWithContext(ctx context.Context, payload CreateRecurringPaymentRequest) (*CreateRecurringPaymentResponse, error)
- func (sdk *Cryptomus) CreateStaticWallet(payload *CreateStaticWalletRequest) (*CreateStaticWalletResponse, error)
- func (sdk *Cryptomus) CreateStaticWalletWithContext(ctx context.Context, payload *CreateStaticWalletRequest) (*CreateStaticWalletResponse, error)
- func (sdk *Cryptomus) ExchangeRateList(currency string) (*ExchangeRateResponse, error)
- func (sdk *Cryptomus) ExchangeRateListWithContext(ctx context.Context, currency string) (*ExchangeRateResponse, error)
- func (sdk *Cryptomus) GenerateQRCodeInvoice(payload *GenerateQRCodeInvoiceRequest) (*GenerateQRCodeInvoiceResponse, error)
- func (sdk *Cryptomus) GenerateQRCodeInvoiceWithContext(ctx context.Context, payload *GenerateQRCodeInvoiceRequest) (*GenerateQRCodeInvoiceResponse, error)
- func (sdk *Cryptomus) GenerateQRStaticWallet(payload *GenerateQRCodeWalletRequest) (*GenerateQRCodeWalletResponse, error)
- func (sdk *Cryptomus) GenerateQRStaticWalletWithContext(ctx context.Context, payload *GenerateQRCodeWalletRequest) (*GenerateQRCodeWalletResponse, error)
- func (sdk *Cryptomus) ListOfDiscount() (*ListOfDiscountResponse, error)
- func (sdk *Cryptomus) ListOfDiscountWithContext(ctx context.Context) (*ListOfDiscountResponse, error)
- func (sdk *Cryptomus) ListRecurringPayments(request ListRecurringPaymentsRequest) (*ListRecurringPaymentsResponse, error)
- func (sdk *Cryptomus) ListRecurringPaymentsWithContext(ctx context.Context, payload ListRecurringPaymentsRequest) (*ListRecurringPaymentsResponse, error)
- func (sdk *Cryptomus) PaymentHistory(payload *PaymentHistoryRequest) (*PaymentHistoryResponse, error)
- func (sdk *Cryptomus) PaymentHistoryWithContext(ctx context.Context, payload *PaymentHistoryRequest) (*PaymentHistoryResponse, error)
- func (sdk *Cryptomus) PaymentInformation(payload *PaymentInformationRequest) (*PaymentInformationResponse, error)
- func (sdk *Cryptomus) PaymentInformationWithContext(ctx context.Context, payload *PaymentInformationRequest) (*PaymentInformationResponse, error)
- func (sdk *Cryptomus) PaymentListOfServices() (*PaymentListOfServicesResponse, error)
- func (sdk *Cryptomus) PaymentListOfServicesWithContext(ctx context.Context) (*PaymentListOfServicesResponse, error)
- func (sdk *Cryptomus) PayoutHistory(payload *PayoutHistoryRequest) (*PayoutHistoryResponse, error)
- func (sdk *Cryptomus) PayoutHistoryWithContext(ctx context.Context, payload *PayoutHistoryRequest) (*PayoutHistoryResponse, error)
- func (sdk *Cryptomus) PayoutInformation(payload *PayoutInformationRequest) (*PayoutInformationResponse, error)
- func (sdk *Cryptomus) PayoutInformationWithContext(ctx context.Context, payload *PayoutInformationRequest) (*PayoutInformationResponse, error)
- func (sdk *Cryptomus) PayoutListOfServices() (*PayoutListOfServicesResponse, error)
- func (sdk *Cryptomus) PayoutListOfServicesWithContext(ctx context.Context) (*PayoutListOfServicesResponse, error)
- func (sdk *Cryptomus) RecurringPaymentInformation(request RecurringPaymentInformationRequest) (*RecurringPaymentInformationResponse, error)
- func (sdk *Cryptomus) RecurringPaymentInformationWithContext(ctx context.Context, payload RecurringPaymentInformationRequest) (*RecurringPaymentInformationResponse, error)
- func (sdk *Cryptomus) Refund(payload *RefundRequest) (*RefundResponse, error)
- func (sdk *Cryptomus) RefundPaymentOnBlockedAddress(payload *RefundPaymentOnBlockedAddressRequest) (*RefundPaymentOnBlockedAddressResponse, error)
- func (sdk *Cryptomus) RefundPaymentOnBlockedAddressWithContext(ctx context.Context, payload *RefundPaymentOnBlockedAddressRequest) (*RefundPaymentOnBlockedAddressResponse, error)
- func (sdk *Cryptomus) RefundWithContext(ctx context.Context, payload *RefundRequest) (*RefundResponse, error)
- func (sdk *Cryptomus) ResendWebhook(payload *ResendWebhookRequest) (*ResendWebhookResponse, error)
- func (sdk *Cryptomus) ResendWebhookWithContext(ctx context.Context, payload *ResendWebhookRequest) (*ResendWebhookResponse, error)
- func (sdk *Cryptomus) SetDiscountToPaymentMethod(payload SetDiscountToPaymentMethodRequest) (*SetDiscountToPaymentMethodResponse, error)
- func (sdk *Cryptomus) SetDiscountToPaymentMethodWithContext(ctx context.Context, payload SetDiscountToPaymentMethodRequest) (*SetDiscountToPaymentMethodResponse, error)
- func (sdk *Cryptomus) TestingWebhookPayment(payload *TestingWebhookPaymentRequest) (*TestingWebhookPaymentResponse, error)
- func (sdk *Cryptomus) TestingWebhookPaymentWithContext(ctx context.Context, payload *TestingWebhookPaymentRequest) (*TestingWebhookPaymentResponse, error)
- func (sdk *Cryptomus) TestingWebhookPayout(payload *TestingWebhookPayoutRequest) (*TestingWebhookPayoutResponse, error)
- func (sdk *Cryptomus) TestingWebhookPayoutWithContext(ctx context.Context, payload *TestingWebhookPayoutRequest) (*TestingWebhookPayoutResponse, error)
- func (sdk *Cryptomus) TestingWebhookWallet(payload *TestingWebhookWalletRequest) (*TestingWebhookWalletResponse, error)
- func (sdk *Cryptomus) TestingWebhookWalletWithContext(ctx context.Context, payload *TestingWebhookWalletRequest) (*TestingWebhookWalletResponse, error)
- func (sdk *Cryptomus) TransferToBusinessWallet(payload *TransferToBusinessWalletRequest) (*TransferToBusinessWalletResponse, error)
- func (sdk *Cryptomus) TransferToBusinessWalletWithContext(ctx context.Context, payload *TransferToBusinessWalletRequest) (*TransferToBusinessWalletResponse, error)
- func (sdk *Cryptomus) TransferToPersonalWallet(payload *TransferToPersonalWalletRequest) (*TransferToPersonalWalletResponse, error)
- func (sdk *Cryptomus) TransferToPersonalWalletWithContext(ctx context.Context, payload *TransferToPersonalWalletRequest) (*TransferToPersonalWalletResponse, error)
- type Currencies
- type Currency
- type Discount
- type Endpoint
- type Errors
- type ExchangeRate
- type ExchangeRateList
- type ExchangeRateResponse
- type GenerateQRCodeInvoiceData
- type GenerateQRCodeInvoiceRequest
- type GenerateQRCodeInvoiceResponse
- type GenerateQRCodeWalletData
- type GenerateQRCodeWalletRequest
- type GenerateQRCodeWalletResponse
- type HTTPResponse
- type ListOfDiscount
- type ListOfDiscountResponse
- type ListRecurringPaymentsData
- type ListRecurringPaymentsRequest
- type ListRecurringPaymentsResponse
- type Merchant
- type Option
- type Pagination
- type PaymentHistoryData
- type PaymentHistoryRequest
- type PaymentHistoryResponse
- type PaymentInformationData
- type PaymentInformationRequest
- type PaymentInformationResponse
- type PaymentListOfServiceCommission
- type PaymentListOfServiceLimit
- type PaymentListOfServicesData
- type PaymentListOfServicesResponse
- type PaymentStatus
- type PayoutData
- type PayoutHistoryData
- type PayoutHistoryRequest
- type PayoutHistoryResponse
- type PayoutInformationRequest
- type PayoutInformationResponse
- type PayoutListOfServiceCommission
- type PayoutListOfServiceLimit
- type PayoutListOfServicesData
- type PayoutListOfServicesResponse
- type PayoutStatus
- type RecurringPaymentData
- type RecurringPaymentInformationRequest
- type RecurringPaymentInformationResponse
- type RecurringPaymentPeriod
- type RefundData
- type RefundPaymentOnBlockedAddressData
- type RefundPaymentOnBlockedAddressRequest
- type RefundPaymentOnBlockedAddressResponse
- type RefundRequest
- type RefundResponse
- type ResendWebhookData
- type ResendWebhookRequest
- type ResendWebhookResponse
- type SetDiscountToPaymentMethodRequest
- type SetDiscountToPaymentMethodResponse
- type TestingWebhookPaymentData
- type TestingWebhookPaymentRequest
- type TestingWebhookPaymentResponse
- type TestingWebhookPayoutData
- type TestingWebhookPayoutRequest
- type TestingWebhookPayoutResponse
- type TestingWebhookWalletData
- type TestingWebhookWalletRequest
- type TestingWebhookWalletResponse
- type TransferToBusinessWalletData
- type TransferToBusinessWalletRequest
- type TransferToBusinessWalletResponse
- type TransferToPersonalWalletData
- type TransferToPersonalWalletRequest
- type TransferToPersonalWalletResponse
- type User
Constants ¶
This section is empty.
Variables ¶
var (
Host = "https://api.cryptomus.com"
)
Functions ¶
func DefaultHTTPClient ¶
func FromJSONString ¶
FromJSONString converts a JSON string to a struct.
Example:
type ExchangeRate struct {
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
Course string `json:"course,omitempty"`
}
exchangeRate, err := FromJSONString[ExchangeRate](`{"from":"ETH","to":"BTC","course":"0.0001"}`)
if err != nil {
log.Fatal(err)
}
func ToJSON ¶
ToJSON converts a struct to a JSON byte array.
Example:
type ExchangeRate struct {
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
Course string `json:"course,omitempty"`
}
exchangeRate := ExchangeRate{
From: "ETH",
To: "BTC",
Course: "0.0001",
}
resByte, err := ToJSON[ExchangeRate](exchangeRate)
if err != nil {
log.Fatal(err)
}
Types ¶
type Balance ¶
Balance represents a list of balances.
The list of balances includes Business (merchant) and Personal (user) wallets.
type BalanceResponse ¶
type BalanceResponse struct {
*HTTPResponse
Result []BalanceResult `json:"result,omitempty"`
}
type BalanceResult ¶
type BalanceResult struct {
Balance Balance `json:"balance"`
}
type BlockStaticWalletData ¶
type BlockStaticWalletData struct {
UUID string `json:"uuid"`
Status BlockStaticWalletStatus `json:"status"`
}
type BlockStaticWalletResponse ¶
type BlockStaticWalletResponse struct {
*HTTPResponse
Result BlockStaticWalletData `json:"result"`
}
type BlockStaticWalletStatus ¶
type BlockStaticWalletStatus string
const ( BlockStaticWalletStatusBlocked BlockStaticWalletStatus = "blocked" BlockStaticWalletStatusActive BlockStaticWalletStatus = "active" BlockStaticWalletStatusInActive BlockStaticWalletStatus = "in_active" )
type CancelRecurringPaymentResponse ¶
type CancelRecurringPaymentResponse struct {
*HTTPResponse
Result RecurringPaymentData `json:"result,omitempty"`
}
type CreateInvoiceData ¶
type CreateInvoiceData struct {
UUID string `json:"uuid"`
OrderID string `json:"order_id"`
Amount string `json:"amount"`
PaymentAmount int `json:"payment_amount"`
PayerAmount int `json:"payer_amount"`
DiscountPercent int `json:"discount_percent"`
Discount string `json:"discount"`
PayerCurrency string `json:"payer_currency"`
Currency string `json:"currency"`
MerchantAmount int `json:"merchant_amount"`
Network string `json:"network"`
Address string `json:"address"`
From string `json:"from"`
Txid string `json:"txid"`
PaymentStatus string `json:"payment_status"`
URL string `json:"url"`
ExpiredAt int `json:"expired_at"`
Status string `json:"status"`
IsFinal bool `json:"is_final"`
AdditionalData string `json:"additional_data"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type CreateInvoiceRequest ¶
type CreateInvoiceRequest struct {
Amount string `json:"amount"`
Currency string `json:"currency"`
OrderID string `json:"order_id"`
Network string `json:"network"`
URLReturn string `json:"url_return"`
URLSuccess string `json:"url_success"`
URLCallback string `json:"url_callback"`
IsPaymentMultiple bool `json:"is_payment_multiple"`
Lifetime int `json:"lifetime"`
ToCurrency string `json:"to_currency"`
Subtract int `json:"subtract"`
AccuracyPaymentPercent int `json:"accuracy_payment_percent"`
AdditionalData string `json:"additional_data"`
Currencies Currencies `json:"currencies"`
ExceptCurrencies Currencies `json:"except_currencies"`
CourseSource string `json:"course_source"`
FromReferralCode string `json:"from_referral_code"`
DiscountPercent int `json:"discount_percent"`
IsRefresh bool `json:"is_refresh"`
}
type CreateInvoiceResponse ¶
type CreateInvoiceResponse struct {
*HTTPResponse
Result CreateInvoiceData `json:"result"`
}
type CreatePayoutRequest ¶
type CreatePayoutRequest struct {
Amount string `json:"amount"`
Currency string `json:"currency" validate:"required"`
OrderID string `json:"order_id"`
Address string `json:"address"`
IsSubtract bool `json:"is_subtract"`
Network string `json:"network"`
URLCallback string `json:"url_callback"`
ToCurrency string `json:"to_currency"`
CourseSource string `json:"course_source"`
FromCurrency string `json:"from_currency"`
Priority string `json:"priority"`
Memo string `json:"memo"`
}
type CreatePayoutResponse ¶
type CreatePayoutResponse struct {
*HTTPResponse
Result *PayoutData `json:"result"`
}
type CreateRecurringPaymentRequest ¶
type CreateRecurringPaymentRequest struct {
Amount string `json:"amount"`
Currency string `json:"currency"`
Name string `json:"name"`
Period RecurringPaymentPeriod `json:"period"`
ToCurrency string `json:"to_currency,omitempty"`
OrderID string `json:"order_id,omitempty"`
URLCallback string `json:"url_callback,omitempty"`
DiscountDays int `json:"discount_days,omitempty"`
DiscountAmount string `json:"discount_amount,omitempty"`
AdditionalData string `json:"additional_data,omitempty"`
}
type CreateRecurringPaymentResponse ¶
type CreateRecurringPaymentResponse struct {
*HTTPResponse
Result RecurringPaymentData `json:"result,omitempty"`
}
type CreateStaticWalletData ¶
type CreateStaticWalletResponse ¶
type CreateStaticWalletResponse struct {
*HTTPResponse
Result CreateStaticWalletData `json:"result"`
}
type Cryptomus ¶
type Cryptomus struct {
HttpClient *req.Client
Merchant string
PaymentToken string
PayoutToken string
}
func DefaultCryptomus ¶
func DefaultCryptomus() *Cryptomus
func New ¶
New creates a new Cryptomus SDK instance.
Make sure to set the Merchant and PaymentToken before using the SDK. follow the example at https://doc.cryptomus.com/business/general/getting-api-keys
Also check the request format at https://doc.cryptomus.com/business/general/request-format
You could set the PaymentToken and PayoutToken for the each instance of the SDK.
func (*Cryptomus) Balance ¶
func (sdk *Cryptomus) Balance() (*BalanceResponse, error)
Balance returns a list of balances.
Details: https://doc.cryptomus.com/business/balance
Example:
result, err := sdk.Balance()
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) BalanceWithContext ¶
func (sdk *Cryptomus) BalanceWithContext(ctx context.Context) (*BalanceResponse, error)
BalanceWithContext returns a list of balances.
Details: https://doc.cryptomus.com/business/balance
Example:
result, err := sdk.BalanceWithContext(ctx)
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) BlockStaticWallet ¶
func (sdk *Cryptomus) BlockStaticWallet(payload *BlockStaticWalletRequest) (*BlockStaticWalletResponse, error)
BlockStaticWallet blocks a static wallet.
Details: https://doc.cryptomus.com/business/payments/block-wallet
When you need to block your clients static wallet, all the further payments will not be credited to his balance. You can make a refund of this funds only once. The funds will be returned to the addresses from which they came.
You need to pass one of the required parameters, if you pass both, the account will be identified by order_id
Example:
result, err := sdk.BlockStaticWallet(&BlockStaticWalletRequest{
UUID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) BlockStaticWalletWithContext ¶
func (sdk *Cryptomus) BlockStaticWalletWithContext(ctx context.Context, payload *BlockStaticWalletRequest) (*BlockStaticWalletResponse, error)
BlockStaticWalletWithContext blocks a static wallet.
Details: https://doc.cryptomus.com/business/payments/block-wallet
When you need to block your clients static wallet, all the further payments will not be credited to his balance. You can make a refund of this funds only once. The funds will be returned to the addresses from which they came.
You need to pass one of the required parameters, if you pass both, the account will be identified by order_id
Example:
result, err := sdk.BlockStaticWalletWithContext(ctx, &BlockStaticWalletRequest{
UUID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) CancelRecurringPayment ¶
func (sdk *Cryptomus) CancelRecurringPayment(payload CancelRecurringPaymentRequest) (*CancelRecurringPaymentResponse, error)
CancelRecurringPayment cancels a recurring payment.
Details: https://doc.cryptomus.com/business/recurring/cancel
To cancel the recurring payment you need to pass one of the required parameters, if you pass both, the account will be identified by order_id
Example:
result, err := sdk.CancelRecurringPayment(CancelRecurringPaymentRequest{
UUID: "4b1b3b7b-7b1b-4b1b-7b1b-4b1b3b7b1b4b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) CancelRecurringPaymentWithContext ¶
func (sdk *Cryptomus) CancelRecurringPaymentWithContext(ctx context.Context, payload CancelRecurringPaymentRequest) (*CancelRecurringPaymentResponse, error)
CancelRecurringPaymentWithContext cancels a recurring payment.
Details: https://doc.cryptomus.com/business/recurring/cancel
To cancel the recurring payment you need to pass one of the required parameters, if you pass both, the account will be identified by order_id
Example:
result, err := sdk.CancelRecurringPaymentWithContext(ctx, CancelRecurringPaymentRequest{
UUID: "4b1b3b7b-7b1b-4b1b-7b1b-4b1b3b7b1b4b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) CreateInvoice ¶
func (sdk *Cryptomus) CreateInvoice(payload *CreateInvoiceRequest) (*CreateInvoiceResponse, error)
CreateInvoice creates an invoice.
Details: https://doc.cryptomus.com/business/payments/creating-invoice
The invoice will have a specific cryptocurrency and address at the time of creation only if currency or to_currency parameter is a cryptocurrency and the network parameter is passed (or a cryptocurrency has only one network, for example BTC).
Example:
result, err := sdk.CreateInvoice(&CreateInvoiceRequest{
Amount: "15",
Currency: "USD",
OrderID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) CreateInvoiceWithContext ¶
func (sdk *Cryptomus) CreateInvoiceWithContext(ctx context.Context, payload *CreateInvoiceRequest) (*CreateInvoiceResponse, error)
CreateInvoiceWithContext creates an invoice.
Details: https://doc.cryptomus.com/business/payments/creating-invoice
The invoice will have a specific cryptocurrency and address at the time of creation only if currency or to_currency parameter is a cryptocurrency and the network parameter is passed (or a cryptocurrency has only one network, for example BTC).
Example:
result, err := sdk.CreateInvoiceWithContext(ctx, &CreateInvoiceRequest{
Amount: "15",
Currency: "USD",
OrderID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) CreatePayout ¶
func (sdk *Cryptomus) CreatePayout(payload *CreatePayoutRequest) (*CreatePayoutResponse, error)
CreatePayout creates a payout.
Details: https://doc.cryptomus.com/business/payout/creating
The payouts through API are made only from your business wallets balances.
Payouts can be made in different ways:
- You can choose to receive the payout in a specific cryptocurrency and the payout will then be automatically processed in that specific cryptocurrency. To do so, ensure that you have sufficient balance in that particular currency to cover all associated fees.
- Alternatively, you have the option to specify the payout amount in a fiat currency. In this case, the amount will be automatically converted to a specific cryptocurrency from your available balance. For instance, if you request a payout of 20 USD in LTC, the equivalent value will be deducted from your LTC balance. It is important to have enough funds in the corresponding cryptocurrency to cover all applicable fees.
- Another possibility is to specify the payout amount in a fiat currency, which will be automatically converted to a specific cryptocurrency using your USDT balance. This option is particularly useful when you have autoconvert enabled, as funds from your invoices are automatically converted to USDT. For example, if you want to make a payout of 20 USD in LTC but only have a balance in USDT, make sure you have sufficient USDT funds to cover all fees.
- Additionally, you can choose to specify the payout amount in any cryptocurrency of your preference. The payout will then be automatically processed in that specific cryptocurrency, utilizing your available USDT balance. It is crucial to have enough USDT balance to cover all associated fees.
Example:
result, err := sdk.CreatePayout(&CreatePayoutRequest{
Amount: "5",
Currency: "USDT",
Network: "TRON",
Address: "TJ5Zrj8z6bJ7bk9Kf8fz1yQFbJ7b7bJ7b7b",
OrderID: "1",
URLCallback: "https://example.com/callback",
IsSubtract: true,
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) CreatePayoutWithContext ¶
func (sdk *Cryptomus) CreatePayoutWithContext(ctx context.Context, payload *CreatePayoutRequest) (*CreatePayoutResponse, error)
CreatePayoutWithContext creates a payout.
Details: https://doc.cryptomus.com/business/payout/creating
The payouts through API are made only from your business wallets balances.
Payouts can be made in different ways:
- You can choose to receive the payout in a specific cryptocurrency and the payout will then be automatically processed in that specific cryptocurrency. To do so, ensure that you have sufficient balance in that particular currency to cover all associated fees.
- Alternatively, you have the option to specify the payout amount in a fiat currency. In this case, the amount will be automatically converted to a specific cryptocurrency from your available balance. For instance, if you request a payout of 20 USD in LTC, the equivalent value will be deducted from your LTC balance. It is important to have enough funds in the corresponding cryptocurrency to cover all applicable fees.
- Another possibility is to specify the payout amount in a fiat currency, which will be automatically converted to a specific cryptocurrency using your USDT balance. This option is particularly useful when you have autoconvert enabled, as funds from your invoices are automatically converted to USDT. For example, if you want to make a payout of 20 USD in LTC but only have a balance in USDT, make sure you have sufficient USDT funds to cover all fees.
- Additionally, you can choose to specify the payout amount in any cryptocurrency of your preference. The payout will then be automatically processed in that specific cryptocurrency, utilizing your available USDT balance. It is crucial to have enough USDT balance to cover all associated fees.
Example:
result, err := sdk.CreatePayout(ctx, &CreatePayoutRequest{
Amount: "5",
Currency: "USDT",
Network: "TRON",
Address: "TJ5Zrj8z6bJ7bk9Kf8fz1yQFbJ7b7bJ7b7b",
OrderID: "1",
URLCallback: "https://example.com/callback",
IsSubtract: true,
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) CreateRecurringPayment ¶
func (sdk *Cryptomus) CreateRecurringPayment(request CreateRecurringPaymentRequest) (*CreateRecurringPaymentResponse, error)
CreateRecurringPayment creates a recurring payment.
Details: https://doc.cryptomus.com/business/recurring/creating
Example:
result, err := sdk.CreateRecurringPayment(CreateRecurringPaymentRequest{
Amount: "0.0001",
Currency: "BTC",
Name: "Test recurring payment",
Period: RecurringPaymentPeriodWeekly,
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) CreateRecurringPaymentWithContext ¶
func (sdk *Cryptomus) CreateRecurringPaymentWithContext(ctx context.Context, payload CreateRecurringPaymentRequest) (*CreateRecurringPaymentResponse, error)
CreateRecurringPaymentWithContext creates a recurring payment.
Details: https://doc.cryptomus.com/business/recurring/creating
Recurring payments in cryptocurrency are a way to automate regular transactions using digital assets. They can be useful for subscription-based services, donations, memberships, and other recurring payments.
To use recurring payments, you need to create a payment that specifies the amount, currency, and frequency of the payments, and then share it with your payers. The payer will be redirected to the cryptomus website, where he will need to log in to confirm the payment plan and make the first payment. After that, payments will be made automatically according to the plan.
Example:
result, err := sdk.CreateRecurringPaymentWithContext(ctx, CreateRecurringPaymentRequest{
Amount: "0.0001",
Currency: "BTC",
Name: "Test recurring payment",
Period: RecurringPaymentPeriodWeekly,
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) CreateStaticWallet ¶
func (sdk *Cryptomus) CreateStaticWallet(payload *CreateStaticWalletRequest) (*CreateStaticWalletResponse, error)
CreateStaticWallet creates a static wallet.
Details: https://doc.cryptomus.com/business/payments/creating-static
Example:
result, err := sdk.CreateStaticWallet(&CreateStaticWalletRequest{
Currency: "USDT",
Network: "tron",
OrderID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
URLCallback: "https://example.com/callback",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) CreateStaticWalletWithContext ¶
func (sdk *Cryptomus) CreateStaticWalletWithContext(ctx context.Context, payload *CreateStaticWalletRequest) (*CreateStaticWalletResponse, error)
CreateStaticWalletWithContext creates a static wallet.
Details: https://doc.cryptomus.com/business/payments/creating-static
Example:
result, err := sdk.CreateStaticWalletWithContext(ctx, &CreateStaticWalletRequest{
Currency: "USDT",
Network: "tron",
OrderID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
URLCallback: "https://example.com/callback",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) ExchangeRateList ¶
func (sdk *Cryptomus) ExchangeRateList(currency string) (*ExchangeRateResponse, error)
ExchangeRateList returns a list of exchange rates.
Details: https://doc.cryptomus.com/business/exchange-rates/list
Example:
result, err := sdk.ExchangeRateList("ETH")
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) ExchangeRateListWithContext ¶
func (sdk *Cryptomus) ExchangeRateListWithContext(ctx context.Context, currency string) (*ExchangeRateResponse, error)
ExchangeRateListWithContext returns a list of exchange rates.
Details: https://doc.cryptomus.com/business/exchange-rates/list
Example:
result, err := sdk.ExchangeRateListWithContext(ctx, "ETH")
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) GenerateQRCodeInvoice ¶
func (sdk *Cryptomus) GenerateQRCodeInvoice(payload *GenerateQRCodeInvoiceRequest) (*GenerateQRCodeInvoiceResponse, error)
GenerateQRCodeInvoice generates a QR code for an invoice.
Details: https://doc.cryptomus.com/business/payments/qr-code-pay-form
You can generate a QR-code for a static wallet address or for an invoice address. Scanning it, the user will receive the address for depositing funds.
Example:
result, err := sdk.GenerateQRCodeInvoice(&GenerateQRCodeInvoiceRequest{
MerchantPaymentUUID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) GenerateQRCodeInvoiceWithContext ¶
func (sdk *Cryptomus) GenerateQRCodeInvoiceWithContext(ctx context.Context, payload *GenerateQRCodeInvoiceRequest) (*GenerateQRCodeInvoiceResponse, error)
GenerateQRCodeInvoiceWithContext generates a QR code for an invoice.
Details: https://doc.cryptomus.com/business/payments/qr-code-pay-form
You can generate a QR-code for a static wallet address or for an invoice address. Scanning it, the user will receive the address for depositing funds.
Example:
result, err := sdk.GenerateQRCodeInvoiceWithContext(ctx, &GenerateQRCodeInvoiceRequest{
MerchantPaymentUUID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) GenerateQRStaticWallet ¶
func (sdk *Cryptomus) GenerateQRStaticWallet(payload *GenerateQRCodeWalletRequest) (*GenerateQRCodeWalletResponse, error)
GenerateQRStaticWallet generates a QR code for a static wallet.
Details: https://doc.cryptomus.com/business/payments/qr-code-pay-form
You can generate a QR-code for a static wallet address or for an invoice address. Scanning it, the user will receive the address for depositing funds.
Example:
result, err := sdk.GenerateQRStaticWallet(&GenerateQRCodeWalletRequest{
WalletAddressUUID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) GenerateQRStaticWalletWithContext ¶
func (sdk *Cryptomus) GenerateQRStaticWalletWithContext(ctx context.Context, payload *GenerateQRCodeWalletRequest) (*GenerateQRCodeWalletResponse, error)
GenerateQRStaticWalletWithContext generates a QR code for a static wallet.
Details: https://doc.cryptomus.com/business/payments/qr-code-pay-form
You can generate a QR-code for a static wallet address or for an invoice address. Scanning it, the user will receive the address for depositing funds.
Example:
result, err := sdk.GenerateQRStaticWalletWithContext(ctx, &GenerateQRCodeWalletRequest{
WalletAddressUUID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) ListOfDiscount ¶
func (sdk *Cryptomus) ListOfDiscount() (*ListOfDiscountResponse, error)
ListOfDiscount returns a list of discounts.
Details: https://doc.cryptomus.com/business/discount/list
Example:
result, err := sdk.ListOfDiscount()
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) ListOfDiscountWithContext ¶
func (sdk *Cryptomus) ListOfDiscountWithContext(ctx context.Context) (*ListOfDiscountResponse, error)
ListOfDiscountWithContext returns a list of discounts.
Details: https://doc.cryptomus.com/business/discount/list
Example:
result, err := sdk.ListOfDiscountWithContext(ctx)
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) ListRecurringPayments ¶
func (sdk *Cryptomus) ListRecurringPayments(request ListRecurringPaymentsRequest) (*ListRecurringPaymentsResponse, error)
ListRecurringPayments returns a list of recurring payments.
Details: https://doc.cryptomus.com/business/recurring/list
Example:
result, err := sdk.ListRecurringPayments(ListRecurringPaymentsRequest{
Cursor: "eyJpZCI6MjEyLCJfcG9pbnRzVzVG9OZhXh0SXRlbXMiOnRydWV9",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) ListRecurringPaymentsWithContext ¶
func (sdk *Cryptomus) ListRecurringPaymentsWithContext(ctx context.Context, payload ListRecurringPaymentsRequest) (*ListRecurringPaymentsResponse, error)
ListRecurringPaymentsWithContext returns a list of recurring payments.
Details: https://doc.cryptomus.com/business/recurring/list
Example:
result, err := sdk.ListRecurringPaymentsWithContext(ctx, ListRecurringPaymentsRequest{
Cursor: "eyJpZCI6MjEyLCJfcG9pbnRzVzFG9OZhXh0SXRlbXMiOnRydWV9",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) PaymentHistory ¶
func (sdk *Cryptomus) PaymentHistory(payload *PaymentHistoryRequest) (*PaymentHistoryResponse, error)
PaymentHistory returns payment history.
Details: https://doc.cryptomus.com/business/payments/payment-history
To get next/previous page entries, specify the next/previous cursor hash
Example:
result, err := sdk.PaymentHistory(&PaymentHistoryRequest{
DateFrom: "2021-01-01 00:00:00",
DateTo: "2021-12-31 23:59:59",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) PaymentHistoryWithContext ¶
func (sdk *Cryptomus) PaymentHistoryWithContext(ctx context.Context, payload *PaymentHistoryRequest) (*PaymentHistoryResponse, error)
PaymentHistoryWithContext returns payment history.
Details: https://doc.cryptomus.com/business/payments/payment-history
To get next/previous page entries, specify the next/previous cursor hash
Example:
result, err := sdk.PaymentHistoryWithContext(ctx, &PaymentHistoryRequest{
DateFrom: "2021-01-01 00:00:00",
DateTo: "2021-12-31 23:59:59",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) PaymentInformation ¶
func (sdk *Cryptomus) PaymentInformation(payload *PaymentInformationRequest) (*PaymentInformationResponse, error)
PaymentInformation returns payment information.
Details: https://doc.cryptomus.com/business/payments/payment-information
To get the invoice status you need to pass one of the required parameters, if you pass both, the account will be identified by order_id
Example:
result, err := sdk.PaymentInformation(&PaymentInformationRequest{
UUID: "4b1b3b7b-7b1b-4b1b-7b1b-4b1b3b7b1b4b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) PaymentInformationWithContext ¶
func (sdk *Cryptomus) PaymentInformationWithContext(ctx context.Context, payload *PaymentInformationRequest) (*PaymentInformationResponse, error)
PaymentInformationWithContext returns payment information.
Details: https://doc.cryptomus.com/business/payments/payment-information
To get the invoice status you need to pass one of the required parameters, if you pass both, the account will be identified by order_id
Example:
result, err := sdk.PaymentInformationWithContext(ctx, &PaymentInformationRequest{
UUID: "4b1b3b7b-7b1b-4b1b-7b1b-4b1b3b7b1b4b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) PaymentListOfServices ¶
func (sdk *Cryptomus) PaymentListOfServices() (*PaymentListOfServicesResponse, error)
PaymentListOfServices returns a list of services.
Details: https://doc.cryptomus.com/business/payments/list-of-services
Returns a list of available payment services. Payment services store settings that are taken into account when creating an invoice. For example. currencies, networks, minimum and maximum limits, commissions.
Example:
result, err := sdk.PaymentListOfServices()
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) PaymentListOfServicesWithContext ¶
func (sdk *Cryptomus) PaymentListOfServicesWithContext(ctx context.Context) (*PaymentListOfServicesResponse, error)
PaymentListOfServicesWithContext returns a list of services.
Details: https://doc.cryptomus.com/business/payments/list-of-services
Returns a list of available payment services. Payment services store settings that are taken into account when creating an invoice. For example. currencies, networks, minimum and maximum limits, commissions.
Example:
result, err := sdk.PaymentListOfServicesWithContext(ctx)
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) PayoutHistory ¶
func (sdk *Cryptomus) PayoutHistory(payload *PayoutHistoryRequest) (*PayoutHistoryResponse, error)
PayoutHistory returns a list of payouts.
Details: https://doc.cryptomus.com/business/payouts/payout-history
Example:
result, err := sdk.PayoutHistory(&PayoutHistoryRequest{
DateFrom: "2022-01-01 00:00:00",
DateTo: "2022-01-31 23:59:59",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) PayoutHistoryWithContext ¶
func (sdk *Cryptomus) PayoutHistoryWithContext(ctx context.Context, payload *PayoutHistoryRequest) (*PayoutHistoryResponse, error)
PayoutHistoryWithContext returns a list of payouts.
Details: https://doc.cryptomus.com/business/payouts/payout-history
Example:
result, err := sdk.PayoutHistoryWithContext(ctx, &PayoutHistoryRequest{
DateFrom: "2022-01-01 00:00:00",
DateTo: "2022-01-31 23:59:59",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) PayoutInformation ¶
func (sdk *Cryptomus) PayoutInformation(payload *PayoutInformationRequest) (*PayoutInformationResponse, error)
PayoutInformation returns information about a payout.
Details: https://doc.cryptomus.com/business/payouts/payout-information
To get the payout information you need to pass one of the parameters, if you pass both, the payout will be identified by order_id
Example:
result, err := sdk.PayoutInformation(&PayoutInformationRequest{
UUID: "4b1b3b7b-7b1b-4b1b-7b1b-4b1b3b7b1b4b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) PayoutInformationWithContext ¶
func (sdk *Cryptomus) PayoutInformationWithContext(ctx context.Context, payload *PayoutInformationRequest) (*PayoutInformationResponse, error)
PayoutInformationWithContext returns information about a payout.
Details: https://doc.cryptomus.com/business/payouts/payout-information
To get the payout information you need to pass one of the parameters, if you pass both, the payout will be identified by order_id
Example:
result, err := sdk.PayoutInformationWithContext(ctx, &PayoutInformationRequest{
UUID: "4b1b3b7b-7b1b-4b1b-7b1b-4b1b3b7b1b4b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) PayoutListOfServices ¶
func (sdk *Cryptomus) PayoutListOfServices() (*PayoutListOfServicesResponse, error)
PayoutListOfServices returns a list of services for payouts.
Details: https://doc.cryptomus.com/business/payouts/list-of-services
Returns a list of available payout services. Payout services store settings that are taken into account when creating a payout. For example. currencies, networks, minimum and maximum limits, commissions.
Example:
result, err := sdk.PayoutListOfServices()
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) PayoutListOfServicesWithContext ¶
func (sdk *Cryptomus) PayoutListOfServicesWithContext(ctx context.Context) (*PayoutListOfServicesResponse, error)
PayoutListOfServicesWithContext returns a list of services for payouts.
Details: https://doc.cryptomus.com/business/payouts/list-of-services
Returns a list of available payout services. Payout services store settings that are taken into account when creating a payout. For example. currencies, networks, minimum and maximum limits, commissions.
Example:
result, err := sdk.PayoutListOfServicesWithContext(ctx)
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) RecurringPaymentInformation ¶
func (sdk *Cryptomus) RecurringPaymentInformation(request RecurringPaymentInformationRequest) (*RecurringPaymentInformationResponse, error)
RecurringPaymentInformation returns information about a recurring payment.
Details: https://doc.cryptomus.com/business/recurring/info
Example:
result, err := sdk.RecurringPaymentInformation(RecurringPaymentInformationRequest{
UUID: "4b1b3b7b-7b1b-4b1b-7b1b-4b1b3b7b1b4b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) RecurringPaymentInformationWithContext ¶
func (sdk *Cryptomus) RecurringPaymentInformationWithContext(ctx context.Context, payload RecurringPaymentInformationRequest) (*RecurringPaymentInformationResponse, error)
RecurringPaymentInformationWithContext returns information about a recurring payment.
Details: https://doc.cryptomus.com/business/recurring/info
To get the recurring payment status you need to pass one of the required parameters, if you pass both, the account will be identified by order_id
Example:
result, err := sdk.RecurringPaymentInformationWithContext(ctx, RecurringPaymentInformationRequest{
UUID: "4b1b3b7b-7b1b-4b1b-7b1b-4b1b3b7b1b4b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) Refund ¶
func (sdk *Cryptomus) Refund(payload *RefundRequest) (*RefundResponse, error)
Refund refunds a payment.
Details: https://doc.cryptomus.com/business/payments/refund
Invoice is identified by order_id or uuid, if you pass both, the account will be identified by uuid
Example:
result, err := sdk.Refund(&RefundRequest{
OrderID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
Address: "0x...",
IsSubtract: true,
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) RefundPaymentOnBlockedAddress ¶
func (sdk *Cryptomus) RefundPaymentOnBlockedAddress(payload *RefundPaymentOnBlockedAddressRequest) (*RefundPaymentOnBlockedAddressResponse, error)
RefundPaymentOnBlockedAddress refunds a payment on a blocked address.
Details: https://doc.cryptomus.com/business/payments/refundblocked
You can make a refund only once.
To refund payments you need to pass either uuid or order_id, if you pass both, the static wallet will be identified by uuid
Example:
result, err := sdk.RefundPaymentOnBlockedAddress(&RefundPaymentOnBlockedAddressRequest{
OrderID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
Address: "0x...",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) RefundPaymentOnBlockedAddressWithContext ¶
func (sdk *Cryptomus) RefundPaymentOnBlockedAddressWithContext(ctx context.Context, payload *RefundPaymentOnBlockedAddressRequest) (*RefundPaymentOnBlockedAddressResponse, error)
RefundPaymentOnBlockedAddressWithContext refunds a payment on a blocked address.
Details: https://doc.cryptomus.com/business/payments/refundblocked
You can make a refund only once.
To refund payments you need to pass either uuid or order_id, if you pass both, the static wallet will be identified by uuid
Example:
result, err := sdk.RefundPaymentOnBlockedAddressWithContext(ctx, &RefundPaymentOnBlockedAddressRequest{
OrderID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
Address: "0x...",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) RefundWithContext ¶
func (sdk *Cryptomus) RefundWithContext(ctx context.Context, payload *RefundRequest) (*RefundResponse, error)
RefundWithContext refunds a payment.
Details: https://doc.cryptomus.com/business/payments/refund
Invoice is identified by order_id or uuid, if you pass both, the account will be identified by uuid
Example:
result, err := sdk.RefundWithContext(ctx, &RefundRequest{
OrderID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
Address: "0x...",
IsSubtract: true,
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) ResendWebhook ¶
func (sdk *Cryptomus) ResendWebhook(payload *ResendWebhookRequest) (*ResendWebhookResponse, error)
ResendWebhook resends a webhook.
Details: https://doc.cryptomus.com/business/payments/resend-webhook
Resend the webhook by invoice. You can resend the webhook only for finalized invoices, that is, invoices in statuses: wrong_amount, paid, paid_over.
To resend the webhook on the invoice, the url_callback must be specified at the time of invoice creation.
Example:
result, err := sdk.ResendWebhook(&ResendWebhookRequest{
OrderID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) ResendWebhookWithContext ¶
func (sdk *Cryptomus) ResendWebhookWithContext(ctx context.Context, payload *ResendWebhookRequest) (*ResendWebhookResponse, error)
ResendWebhookWithContext resends a webhook.
Details: https://doc.cryptomus.com/business/payments/resend-webhook
Resend the webhook by invoice. You can resend the webhook only for finalized invoices, that is, invoices in statuses: wrong_amount, paid, paid_over.
To resend the webhook on the invoice, the url_callback must be specified at the time of invoice creation.
Example:
result, err := sdk.ResendWebhookWithContext(ctx, &ResendWebhookRequest{
OrderID: "9d7f7b9b-3b7b-4b7b-9b7b-7b9d7f7b9b7b",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) SetDiscountToPaymentMethod ¶
func (sdk *Cryptomus) SetDiscountToPaymentMethod(payload SetDiscountToPaymentMethodRequest) (*SetDiscountToPaymentMethodResponse, error)
SetDiscountToPaymentMethod sets a discount to a payment method.
Details: https://doc.cryptomus.com/business/discount/set
Discount Percent:
- Positive Numbers (>0): Provides buyers a discount for paying with a coin. Useful for promotions or encouraging payments with a particular cryptocurrency.
- Negative Numbers (<0): Adds a percentage (padding) for paying with a coin. This can help cover crypto/fiat conversion costs or adjust for local exchange differences.
Example:
err := sdk.SetDiscountToPaymentMethod(payload)
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) SetDiscountToPaymentMethodWithContext ¶
func (sdk *Cryptomus) SetDiscountToPaymentMethodWithContext(ctx context.Context, payload SetDiscountToPaymentMethodRequest) (*SetDiscountToPaymentMethodResponse, error)
SetDiscountToPaymentMethodWithContext sets a discount to a payment method.
Details: https://doc.cryptomus.com/business/discount/set
Discount Percent:
- Positive Numbers (>0): Provides buyers a discount for paying with a coin. Useful for promotions or encouraging payments with a particular cryptocurrency.
- Negative Numbers (<0): Adds a percentage (padding) for paying with a coin. This can help cover crypto/fiat conversion costs or adjust for local exchange differences.
Example:
err := sdk.SetDiscountToPaymentMethodWithContext(ctx, payload)
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) TestingWebhookPayment ¶
func (sdk *Cryptomus) TestingWebhookPayment(payload *TestingWebhookPaymentRequest) (*TestingWebhookPaymentResponse, error)
TestingWebhookPayment tests a webhook.
Details: https://doc.cryptomus.com/business/payments/testing-webhook
To validate the signature from the webhook data array, use the payment API key.
To ensure that you are correctly receiving webhooks and can validate the signature, you should use this method to test webhooks for payment. Please note that no data is saved to the database, and any data received in the webhook is only stored in an array for testing purposes to ensure the correctness of the signature and to test the retrieval of this array from us.
To test a webhook with an existing invoice, please provide its uuid or order ID. If these parameters are not provided, the webhook will be sent with a test invoice.
You may to pass one of the uuid or order_id parameters, if you pass both, the account will be identified by uuid
Example:
result, err := sdk.TestingWebhookPayment(&TestingWebhookRequest{
UUID: "4b1b3b7b-7b1b-4b1b-7b1b-4b1b3b7b1b4b",
URLCallback: "https://example.com/callback",
Currency: "USD",
Network: "btc",
Status: PaymentStatusPaid,
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) TestingWebhookPaymentWithContext ¶
func (sdk *Cryptomus) TestingWebhookPaymentWithContext(ctx context.Context, payload *TestingWebhookPaymentRequest) (*TestingWebhookPaymentResponse, error)
TestingWebhookPaymentWithContext tests a webhook.
Details: https://doc.cryptomus.com/business/payments/testing-webhook
To validate the signature from the webhook data array, use the payment API key.
To ensure that you are correctly receiving webhooks and can validate the signature, you should use this method to test webhooks for payment. Please note that no data is saved to the database, and any data received in the webhook is only stored in an array for testing purposes to ensure the correctness of the signature and to test the retrieval of this array from us.
To test a webhook with an existing invoice, please provide its uuid or order ID. If these parameters are not provided, the webhook will be sent with a test invoice.
You may to pass one of the uuid or order_id parameters, if you pass both, the account will be identified by uuid
Example:
result, err := sdk.TestingWebhookPaymentWithContext(ctx, &TestingWebhookRequest{
UUID: "4b1b3b7b-7b1b-4b1b-7b1b-4b1b3b7b1b4b",
URLCallback: "https://example.com/callback",
Currency: "USD",
Network: "btc",
Status: PaymentStatusPaid,
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) TestingWebhookPayout ¶
func (sdk *Cryptomus) TestingWebhookPayout(payload *TestingWebhookPayoutRequest) (*TestingWebhookPayoutResponse, error)
Example:
result, err := sdk.TestingWebhookPayout(&TestingWebhookPayoutRequest{
UUID: "4b1b3b7b-7b1b-4b1b-7b1b-4b1b3b7b1b4b",
URLCallback: "https://example.com/callback",
Currency: "USD",
Network: "btc",
Status: PayoutStatusPaid,
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) TestingWebhookPayoutWithContext ¶
func (sdk *Cryptomus) TestingWebhookPayoutWithContext(ctx context.Context, payload *TestingWebhookPayoutRequest) (*TestingWebhookPayoutResponse, error)
Example:
result, err := sdk.TestingWebhookPayoutWithContext(ctx, &TestingWebhookPayoutRequest{
UUID: "4b1b3b7b-7b1b-4b1b-7b1b-4b1b3b7b1b4b",
URLCallback: "https://example.com/callback",
Currency: "USD",
Network: "btc",
Status: PayoutStatusPaid,
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) TestingWebhookWallet ¶
func (sdk *Cryptomus) TestingWebhookWallet(payload *TestingWebhookWalletRequest) (*TestingWebhookWalletResponse, error)
TestingWebhookWallet tests a webhook.
Details: https://doc.cryptomus.com/business/payments/testing-webhook
To validate the signature from the webhook data array, use the payment API key.
Example:
result, err := sdk.TestingWebhookWallet(&TestingWebhookWalletRequest{
UUID: "4b1b3b7b-7b1b-4b1b-7b1b-4b1b3b7b1b4b",
URLCallback: "https://example.com/callback",
Currency: "USD",
Network: "btc",
Status: PaymentStatusPaid,
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) TestingWebhookWalletWithContext ¶
func (sdk *Cryptomus) TestingWebhookWalletWithContext(ctx context.Context, payload *TestingWebhookWalletRequest) (*TestingWebhookWalletResponse, error)
TestingWebhookWalletWithContext tests a webhook.
Details: https://doc.cryptomus.com/business/payments/testing-webhook
To validate the signature from the webhook data array, use the payment API key.
Example:
result, err := sdk.TestingWebhookWalletWithContext(ctx, &TestingWebhookWalletRequest{
UUID: "4b1b3b7b-7b1b-4b1b-7b1b-4b1b3b7b1b4b",
URLCallback: "https://example.com/callback",
Currency: "USD",
Network: "btc",
Status: PaymentStatusPaid,
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) TransferToBusinessWallet ¶
func (sdk *Cryptomus) TransferToBusinessWallet(payload *TransferToBusinessWalletRequest) (*TransferToBusinessWalletResponse, error)
TransferToBusinessWallet transfers funds from a personal wallet to a business wallet.
Details: https://doc.cryptomus.com/business/payouts/transfer-to-business
Example:
result, err := sdk.TransferToBusinessWallet(&TransferToBusinessWalletRequest{
Amount: "5",
Currency: "USDT",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) TransferToBusinessWalletWithContext ¶
func (sdk *Cryptomus) TransferToBusinessWalletWithContext(ctx context.Context, payload *TransferToBusinessWalletRequest) (*TransferToBusinessWalletResponse, error)
TransferToBusinessWalletWithContext transfers funds from a personal wallet to a business wallet.
Details: https://doc.cryptomus.com/business/payouts/transfer-to-business
Example:
result, err := sdk.TransferToBusinessWalletWithContext(ctx, &TransferToBusinessWalletRequest{
Amount: "5",
Currency: "USDT",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) TransferToPersonalWallet ¶
func (sdk *Cryptomus) TransferToPersonalWallet(payload *TransferToPersonalWalletRequest) (*TransferToPersonalWalletResponse, error)
TransferToPersonalWallet transfers funds from a business wallet to a personal wallet.
Details: https://doc.cryptomus.com/business/payouts/transfer-to-personal
Example:
result, err := sdk.TransferToPersonalWallet(&TransferToPersonalWalletRequest{
Amount: "5",
Currency: "USDT",
})
if err != nil {
log.Fatal(err)
}
func (*Cryptomus) TransferToPersonalWalletWithContext ¶
func (sdk *Cryptomus) TransferToPersonalWalletWithContext(ctx context.Context, payload *TransferToPersonalWalletRequest) (*TransferToPersonalWalletResponse, error)
TransferToPersonalWalletWithContext transfers funds from a business wallet to a personal wallet.
Details: https://doc.cryptomus.com/business/payouts/transfer-to-personal
Example:
result, err := sdk.TransferToPersonalWalletWithContext(ctx, &TransferToPersonalWalletRequest{
Amount: "5",
Currency: "USDT",
})
if err != nil {
log.Fatal(err)
}
type Currencies ¶
type Currencies []Currency
type Endpoint ¶
type Endpoint string
var ( CreateInvoiceEndpoint Endpoint = "/v1/payment" CreateStaticWalletEndpoint Endpoint = "/v1/wallet" GenerateQRCodeWalletEndpoint Endpoint = "/v1/wallet/qr" GenerateQRCodeInvoiceEndpoint Endpoint = "/v1/payment/qr" BlockStaticWalletEndpoint Endpoint = "/v1/wallet/block-address" RefundPaymentOnBlockedAddressEndpoint Endpoint = "/v1/wallet/blocked-address-refund" PaymentInformationEndpoint Endpoint = "/v1/payment/info" RefundEndpoint Endpoint = "/v1/payment/refund" ResendWebhookEndpoint Endpoint = "/v1/payment/resend" PaymentListOfServicesEndpoint Endpoint = "/v1/payment/services" PaymentHistoryEndpoint Endpoint = "/v1/payment/list" TestingWebhookPaymentEndpoint Endpoint = "/v1/test-webhook/payment" TestingWebhookPayoutEndpoint Endpoint = "/v1/test-webhook/payout" TestingWebhookWalletEndpoint Endpoint = "/v1/test-webhook/wallet" CreatePayoutEndpoint Endpoint = "/v1/payout" PayoutInformationEndpoint Endpoint = "/v1/payout/info" PayoutHistoryEndpoint Endpoint = "/v1/payout/list" PayoutListOfServicesEndpoint Endpoint = "/v1/payout/services" TransferToPersonalWalletEndpoint Endpoint = "/v1/transfer/to-personal" TransferToBusinessWalletEndpoint Endpoint = "/v1/transfer/to-business" CreateRecurringPaymentEndpoint Endpoint = "/v1/recurrence/create" RecurringPaymentInformationEndpoint Endpoint = "/v1/recurrence/info" ListRecurringPaymentsEndpoint Endpoint = "/v1/recurrence/list" CancelRecurringPaymentEndpoint Endpoint = "/v1/recurrence/cancel" ExchangeRateListEndpoint Endpoint = "/v1/exchange-rate/%s/list" ListOfDiscountsEndpoint Endpoint = "/v1/payment/discount/list" SetDiscountToPaymentMethodEndpoint Endpoint = "/v1/payment/discount/set" BalanceEndpoint Endpoint = "/v1/balance" )
type ExchangeRate ¶
type ExchangeRateList ¶
type ExchangeRateList []ExchangeRate
type ExchangeRateResponse ¶
type ExchangeRateResponse struct {
*HTTPResponse
Result ExchangeRateList `json:"result,omitempty"`
}
type GenerateQRCodeInvoiceData ¶
type GenerateQRCodeInvoiceData struct {
Image string `json:"image"`
}
type GenerateQRCodeInvoiceRequest ¶
type GenerateQRCodeInvoiceRequest struct {
MerchantPaymentUUID string `json:"merchant_payment_uuid"`
}
type GenerateQRCodeInvoiceResponse ¶
type GenerateQRCodeInvoiceResponse struct {
*HTTPResponse
Result GenerateQRCodeInvoiceData `json:"result"`
}
type GenerateQRCodeWalletData ¶
type GenerateQRCodeWalletData struct {
Image string `json:"image"`
}
type GenerateQRCodeWalletRequest ¶
type GenerateQRCodeWalletRequest struct {
WalletAddressUUID string `json:"wallet_address_uuid"`
}
type GenerateQRCodeWalletResponse ¶
type GenerateQRCodeWalletResponse struct {
*HTTPResponse
Result GenerateQRCodeWalletData `json:"result"`
}
type HTTPResponse ¶
type ListOfDiscount ¶
type ListOfDiscount []Discount
type ListOfDiscountResponse ¶
type ListOfDiscountResponse struct {
*HTTPResponse
Result ListOfDiscount `json:"result"`
}
type ListRecurringPaymentsData ¶
type ListRecurringPaymentsData struct {
Items []RecurringPaymentData `json:"items"`
Paginate *Pagination `json:"paginate"`
}
type ListRecurringPaymentsRequest ¶
type ListRecurringPaymentsRequest struct {
Cursor string `json:"cursor,omitempty"`
}
type ListRecurringPaymentsResponse ¶
type ListRecurringPaymentsResponse struct {
*HTTPResponse
Result ListRecurringPaymentsData `json:"result,omitempty"`
}
type Merchant ¶
type Merchant struct {
// Wallet UUID
UUID string `json:"uuid"`
// Business wallet balance
Balance string `json:"balance"`
// Wallet Currency code (e.g. BTC, ETH, USDT, etc.)
CurrencyCode string `json:"currency_code"`
}
Merchant represents a business account.
type Option ¶
type Option func(*Cryptomus)
func WithHttpClient ¶
func WithMerchant ¶
func WithPaymentToken ¶
func WithPayoutToken ¶
type Pagination ¶
type PaymentHistoryData ¶
type PaymentHistoryData struct {
Items []CreateInvoiceData `json:"items"`
Paginate *Pagination `json:"paginate"`
}
type PaymentHistoryRequest ¶
type PaymentHistoryResponse ¶
type PaymentHistoryResponse struct {
*HTTPResponse
Result PaymentHistoryData `json:"result"`
}
type PaymentInformationData ¶
type PaymentInformationData struct {
*CreateInvoiceData
}
type PaymentInformationResponse ¶
type PaymentInformationResponse struct {
*HTTPResponse
Result PaymentInformationData `json:"result"`
}
type PaymentListOfServicesData ¶
type PaymentListOfServicesData struct {
Network string `json:"network"`
Currency string `json:"currency"`
IsAvailable bool `json:"is_available"`
Limit PaymentListOfServiceLimit `json:"limit"`
Commission PaymentListOfServiceCommission `json:"commission"`
}
type PaymentListOfServicesResponse ¶
type PaymentListOfServicesResponse struct {
*HTTPResponse
Result []PaymentListOfServicesData `json:"result"`
}
type PaymentStatus ¶
type PaymentStatus string
const ( PaymentStatusProcess PaymentStatus = "process" // Payment in processing. PaymentStatusCheck PaymentStatus = "check" // Waiting for the transaction to appear on the blockchain. PaymentStatusConfirmCheck PaymentStatus = "confirm_check" // We have seen the transaction in the blockchain and are waiting for the required number of network confirmations. PaymentStatusWrongAmountWaiting PaymentStatus = "wrong_amount_waiting" // The client paid less than required, with the possibility of an additional payment. PaymentStatusPaid PaymentStatus = "paid" // The payment was successful and the client paid exactly as much as required. PaymentStatusPaidOver PaymentStatus = "paid_over" // The payment was successful and client paid more than required. PaymentStatusFail PaymentStatus = "fail" // Payment error. PaymentStatusWrongAmount PaymentStatus = "wrong_amount" // The client paid less than required. PaymentStatusCancel PaymentStatus = "cancel" // Payment cancelled, the client did not pay. PaymentStatusSystemFail PaymentStatus = "system_fail" // A system error has occurred. PaymentStatusRefundProcess PaymentStatus = "refund_process" // The refund is being processed. PaymentStatusRefundFail PaymentStatus = "refund_fail" // An error occurred during the refund. PaymentStatusRefundPaid PaymentStatus = "refund_paid" // The refund was successful. PaymentStatusLocked PaymentStatus = "locked" // Funds are locked due to the AML program. )
type PayoutData ¶
type PayoutData struct {
UUID string `json:"uuid"`
Amount string `json:"amount"`
Currency string `json:"currency"`
Network string `json:"network"`
Address string `json:"address"`
TxID string `json:"txid"`
Status PayoutStatus `json:"status"`
IsFinal bool `json:"is_final"`
Balance int64 `json:"balance"`
PayerCurrency string `json:"payer_currency"`
PayerAmount int64 `json:"payer_amount"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type PayoutHistoryData ¶
type PayoutHistoryData struct {
MerchantUUID string `json:"merchant_uuid"`
Items []*PayoutData `json:"items"`
Paginate *Pagination `json:"paginate"`
}
type PayoutHistoryRequest ¶
type PayoutHistoryResponse ¶
type PayoutHistoryResponse struct {
*HTTPResponse
Result *PayoutHistoryData `json:"result"`
}
type PayoutInformationResponse ¶
type PayoutInformationResponse struct {
*HTTPResponse
Result *PayoutData `json:"result"`
}
type PayoutListOfServicesData ¶
type PayoutListOfServicesData struct {
Network string `json:"network"`
Currency string `json:"currency"`
IsAvailable bool `json:"is_available"`
Limit PaymentListOfServiceLimit `json:"limit"`
Commission PaymentListOfServiceCommission `json:"commission"`
}
type PayoutListOfServicesResponse ¶
type PayoutListOfServicesResponse struct {
*HTTPResponse
Result []*PayoutListOfServicesData `json:"result"`
}
type PayoutStatus ¶
type PayoutStatus string
The payout status comes in the body of the response of some methods and indicates at what stage the payout is at the moment
Details: https://doc.cryptomus.com/business/payouts/payout-statuses
const ( PayoutStatusProcess PayoutStatus = "process" // Payout is in process PayoutStatusCheck PayoutStatus = "check" // The payout is being verified PayoutStatusPaid PayoutStatus = "paid" // The payout was successful PayoutStatusFail PayoutStatus = "fail" // Payout failed PayoutStatusCancel PayoutStatus = "cancel" // Payout cancelled PayoutStatusSystemFail PayoutStatus = "system_fail" // A system error has occurred )
type RecurringPaymentData ¶
type RecurringPaymentData struct {
UUID string `json:"uuid"`
Name string `json:"name"`
OrderID string `json:"order_id,omitempty"`
Amount string `json:"amount"`
Currency string `json:"currency"`
PayerCurrency string `json:"payer_currency,omitempty"`
PayerAmountUSD string `json:"payer_amount_usd"`
PayerAmount string `json:"payer_amount,omitempty"`
URLCallback string `json:"url_callback,omitempty"`
Period string `json:"period"`
Status string `json:"status"`
URL string `json:"url"`
LastPayOff *time.Time `json:"last_pay_off,omitempty"`
}
type RecurringPaymentInformationResponse ¶
type RecurringPaymentInformationResponse struct {
*HTTPResponse
Result RecurringPaymentData `json:"result,omitempty"`
}
type RecurringPaymentPeriod ¶
type RecurringPaymentPeriod string
const ( RecurringPaymentPeriodWeekly RecurringPaymentPeriod = "weekly" RecurringPaymentPeriodMonthly RecurringPaymentPeriod = "monthly" RecurringPaymentPeriodThreeMonth RecurringPaymentPeriod = "three_month" )
type RefundData ¶
type RefundData struct{}
type RefundPaymentOnBlockedAddressResponse ¶
type RefundPaymentOnBlockedAddressResponse struct {
*HTTPResponse
Result RefundPaymentOnBlockedAddressData `json:"result"`
}
type RefundRequest ¶
type RefundResponse ¶
type RefundResponse struct {
*HTTPResponse
Result []RefundData `json:"result"`
}
type ResendWebhookData ¶
type ResendWebhookData struct{}
type ResendWebhookRequest ¶
type ResendWebhookResponse ¶
type ResendWebhookResponse struct {
*HTTPResponse
Result []ResendWebhookData `json:"result"`
}
type SetDiscountToPaymentMethodRequest ¶
type SetDiscountToPaymentMethodRequest struct {
// Currency code (e.g. BTC, ETH, USDT, etc.)
Currency string `json:"currency"`
// Blockchain network (e.g. ARBITRUM, AVALANCHE, BCH, etc.)
Network string `json:"network"`
// Discount percent (e.g. 5, 10, -15, etc.)
Discount int `json:"discount_percent"`
}
type SetDiscountToPaymentMethodResponse ¶
type SetDiscountToPaymentMethodResponse struct {
*HTTPResponse
Result Discount `json:"result,omitempty"`
}
type TestingWebhookPaymentData ¶
type TestingWebhookPaymentData struct{}
type TestingWebhookPaymentResponse ¶
type TestingWebhookPaymentResponse struct {
*HTTPResponse
Result []TestingWebhookPaymentData `json:"result"`
}
type TestingWebhookPayoutData ¶
type TestingWebhookPayoutData struct{}
type TestingWebhookPayoutResponse ¶
type TestingWebhookPayoutResponse struct {
*HTTPResponse
Result []TestingWebhookPayoutData `json:"result"`
}
type TestingWebhookWalletData ¶
type TestingWebhookWalletData struct{}
type TestingWebhookWalletResponse ¶
type TestingWebhookWalletResponse struct {
*HTTPResponse
Result []TestingWebhookWalletData `json:"result"`
}
type TransferToBusinessWalletResponse ¶
type TransferToBusinessWalletResponse struct {
*HTTPResponse
Result *TransferToBusinessWalletData `json:"result"`
}
type TransferToPersonalWalletResponse ¶
type TransferToPersonalWalletResponse struct {
*HTTPResponse
Result *TransferToPersonalWalletData `json:"result"`
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
balance
command
|
|
|
exchange-rates
command
|
|
|
payments/create-invoice
command
|
|
|
recurring-payments/cancel
command
|
|
|
recurring-payments/create
command
|
|
|
recurring-payments/info
command
|
|
|
recurring-payments/list
command
|