Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CurrencyAmount ¶
type CurrencyAmount struct { CurrencyFrom string `json:"currency_from"` CurrencyTo string `json:"currency_to"` Amount float64 `json:"min_amount"` FiatEquivalent float64 `json:"fiat_equivalent"` }
CurrencyAmount has info about minimum payment amount for a specific pair
func MinimumAmount ¶
func MinimumAmount(currencyFrom, currencyTo, fiatEquivalent string) (*CurrencyAmount, error)
MinimumAmount returns the minimum payment amount for a specific pair fiatEquivalent is an optional param used to get equivalent amount in fiat currency (usd for example)
type Estimate ¶
type Estimate struct { CurrencyFrom string `json:"currency_from"` CurrencyTo string `json:"currency_to"` AmountFrom float64 `json:"amount_from"` EstimatedAmount string `json:"estimated_amount"` }
Estimate holds the estimated amount from one currency to another
type Invoice ¶
type Invoice struct { InvoiceArgs PriceAmount string `json:"price_amount"` ID string `json:"id"` CreatedAt string `json:"created_at,omitempty"` InvoiceURL string `json:"invoice_url,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` TokenID string `json:"token_id,omitempty"` IsFixedRate bool `json:"is_fixed_rate,omitempty"` IsFeePaidByUser bool `json:"is_fee_paid_by_user,omitempty"` PayCurrency *string `json:"pay_currency,omitempty"` IpnCallbackURL string `json:"ipn_callback_url,omitempty"` PartiallyPaidURL *string `json:"partially_paid_url,omitempty"` PayoutCurrency *string `json:"payout_currency,omitempty"` }
Invoice describes an invoice. InvoiceURL is the URL to follow to make the payment. FIXME: inconsistency on their side for PriceAmount field should be a float64, like the field used for a payment not string
type InvoiceArgs ¶
type InvoiceArgs struct { PaymentAmount CancelURL string `json:"cancel_url,omitempty"` SuccessURL string `json:"success_url,omitempty"` }
InvoiceArgs are the arguments used to make an invoice.
type InvoicePaymentArgs ¶
type InvoicePaymentArgs struct { InvoiceID string `json:"iid"` PayCurrency string `json:"pay_currency"` PurchaseID string `json:"purchase_id,omitempty"` OrderDescription string `json:"order_description,omitempty"` CustomerEmail string `json:"customer_email,omitempty"` PayoutCurrency string `json:"payout_currency,omitempty"` PayoutExtraID string `json:"payout_extra_id,omitempty"` PayoutAddress string `json:"payout_address,omitempty"` }
type LatestEstimate ¶
type LatestEstimate struct { PaymentID string `json:"id"` TokenID string `json:"token_id"` PayAmount float64 `json:"pay_amount"` ExpirationDate string `json:"expiration_estimate_date"` }
LatestEstimate holds info about the last price estimation
func RefreshEstimatedPrice ¶
func RefreshEstimatedPrice(paymentID string) (*LatestEstimate, error)
RefreshEstimatedPrice gets the current estimate on the payment and update the current estimate
type ListOption ¶
type ListOption struct { DateFrom string DateTo string Limit int OrderBy string Page int SortBy string }
ListOption are options applying to the list of transactions
type Payment ¶
type Payment[T string | int64] struct { PaymentAmount ID T `json:"payment_id"` InvoiceID json.Number `json:"invoice_id"` Status string `json:"payment_status"` PayAddress string `json:"pay_address"` PayinExtraID string `json:"payin_extra_id"` PayAmount float64 `json:"pay_amount"` ActuallyPaid float64 `json:"actually_paid"` PayCurrency string `json:"pay_currency"` PurchaseID json.Number `json:"purchase_id"` OutcomeAmount float64 `json:"outcome_amount"` OutcomeCurrency string `json:"outcome_currency"` PayoutHash *string `json:"payout_hash"` PayinHash *string `json:"payin_hash"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` Type string `json:"type"` AmountReceived float64 `json:"amount_received"` BurningPercent int `json:"burning_percent"` ExpirationEstimateDate string `json:"expiration_estimate_date,omitempty"` Network string `json:"network,omitempty"` NetworkPrecision int `json:"network_precision,omitempty"` SmartContract string `json:"smart_contract,omitempty"` TimeLimit string `json:"time_limit,omitempty"` }
Payment holds payment related information once we get a response This struct will be used in multiple API calls Inconsistency on their side: we need to use generics, because some times payment_id is string or int64
func List ¶
func List(o *ListOption) ([]*Payment[int64], error)
List returns a list of all transactions, depending on the supplied options (which can be nil) JWT is required for this request
func NewFromInvoice ¶
func NewFromInvoice(ipa *InvoicePaymentArgs) (*Payment[string], error)
NewFromInvoice creates a payment from an existing invoice. ID is the invoice's identifier.
type PaymentAmount ¶
type PaymentAmount struct { PriceAmount float64 `json:"price_amount"` PriceCurrency string `json:"price_currency"` PayCurrency string `json:"pay_currency"` PayAmount string `json:"pay_amount,omitempty"` CallbackURL string `json:"ipn_callback_url,omitempty"` OrderID string `json:"order_id,omitempty"` OrderDescription string `json:"order_description,omitempty"` }
PaymentAmount defines common fields used in PaymentArgs and Payment structs
type PaymentArgs ¶
type PaymentArgs struct { PaymentAmount // FeePaidByUser is optional, required for fixed-rate exchanges with all fees paid by users. FeePaidByUser bool `json:"is_fee_paid_by_user,omitempty"` // FixedRate is optional, required for fixed-rate exchanges. FixedRate bool `json:"fixed_rate,omitempty"` // PayoutAddress is optional, usually the funds will go to the address you specify in // your personal account. In case you want to receive funds on another address, you can specify // it in this parameter. PayoutAddress string `json:"payout_address,omitempty"` // PayAmount is optional, the amount that users have to pay for the order stated in crypto. // You can either specify it yourself, or we will automatically convert the amount indicated // in price_amount. PayAmount float64 `json:"pay_amount,omitempty"` // PayoutCurrency for the cryptocurrency name. PayoutCurrency string `json:"payout_currency,omitempty"` // PayoutExtraID is optional, extra id or memo or tag for external payout_address. PayoutExtraID string `json:"payout_extra_id,omitempty"` // PurchaseID is optional, id of purchase for which you want to create another // payment, only used for several payments for one order. PurchaseID string `json:"purchase_id,omitempty"` // optional, case which you want to test (sandbox only). Case string `json:"case,omitempty"` }
PaymentArgs are the arguments used to make a payment
type PaymentStatus ¶
type PaymentStatus struct { ID int64 `json:"payment_id"` InvoiceID int64 `json:"invoice_id"` Status string `json:"payment_status"` PayAddress string `json:"pay_address"` PayinExtraID string `json:"payin_extra_id"` PriceAmount float64 `json:"price_amount"` PriceCurrency string `json:"price_currency"` PayAmount float64 `json:"pay_amount"` ActuallyPaid float64 `json:"actually_paid"` PayCurrency string `json:"pay_currency"` OrderID string `json:"order_id"` PurchaseID int64 `json:"purchase_id"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` BurningPurcent string `json:"burning_percent"` Type string `json:"type"` }
PaymentStatus is the actual information about a payment
func Status ¶
func Status(paymentID string) (*PaymentStatus, error)
Status gets the actual information about the payment. You need to provide the payment ID