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"` }
CurrencyAmount has info about minimum payment amount for a specific pair.
func MinimumAmount ¶
func MinimumAmount(currencyFrom, currencyTo string) (*CurrencyAmount, error)
MinimumAmount returns the minimum payment amount for a specific pair.
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 of crypto for a given Fiat value.
func EstimatedPrice ¶
EstimatedPrice calculates the approximate price in cryptocurrency for a given value in Fiat currency. Need to provide the initial cost in the Fiat currency (amount, currency_from) and the necessary cryptocurrency (currency_to). Currently following fiat currencies are available: usd, eur, nzd, brl.
type Invoice ¶
type Invoice struct { InvoiceArgs // FIXME: inconsistency on their side: should be a float64, like // the field used for a payment. 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"` }
Invoice describes an invoice. InvoiceURL is the URL to follow to make the payment.
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 struct { PaymentAmount ID string `json:"payment_id"` AmountReceived float64 `json:"amount_received"` BurningPercent int `json:"burning_percent"` CreatedAt string `json:"created_at"` ExpirationEstimateDate string `json:"expiration_estimate_date"` Network string `json:"network"` NetworkPrecision int `json:"network_precision"` PayAddress string `json:"pay_address"` PayAmount float64 `json:"pay_amount"` PayCurrency string `json:"pay_currency"` PayinExtraID string `json:"payin_extra_id"` PurchaseID string `json:"purchase_id"` SmartContract string `json:"smart_contract"` Status string `json:"payment_status"` TimeLimit string `json:"time_limit"` UpdatedAt string `json:"updated_at"` }
Payment holds payment related information once we get a response from the server. FIXME: the API doc misses information about returned fields. Misses also HTTP return codes. Why is purchase_id an int instead of a string (payment status response)? Another inconsistency: list of all payments returns a payment ID as an int instead of a string https://documenter.getpostman.com/view/7907941/S1a32n38?version=latest#5e37f3ad-0fa1-4292-af51-5c7f95730486
func List ¶
func List(o *ListOption) ([]*Payment, error)
List returns a list of all transactions for a given API key, depending on the supplied options (which can be nil).
func NewFromInvoice ¶
func NewFromInvoice(ipa *InvoicePaymentArgs) (*Payment, error)
NewFromInvoice creates a payment from an existing invoice. ID is the invoice's identifier.
func (*Payment) UnmarshalJSON ¶ added in v1.0.4
UnmarshalJSON provides custom unmarshalling to the Payment struct so it can work it all known cases. This is to prevent 2 inconsistencies where their API returns: ID as an int (after "list payments" call) or a string (after "create payment" call) PayAmount as a string or a float64 (difference betwwen prod and sandbox APIs).
type PaymentAmount ¶
type PaymentAmount struct { PriceAmount float64 `json:"price_amount"` PriceCurrency string `json:"price_currency"` PayCurrency string `json:"pay_currency"` 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 { ActuallyPaid float64 `json:"actually_paid"` // CreatedAt looks like 2019-04-18T13:39:27.982Z. CreatedAt string `json:"created_at"` OutcomeAmount float64 `json:"outcome_amount"` OutcomeCurrency string `json:"outcome_currency"` PayAddress string `json:"pay_address"` PayAmount float64 `json:"pay_amount"` PayCurrency string `json:"pay_currency"` PriceAmount float64 `json:"price_amount"` PriceCurrency string `json:"price_currency"` PurchaseID int `json:"purchase_id"` Status string `json:"payment_status"` UpdatedAt string `json:"updated_at"` }
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 ID of the payment in the request. Note that unlike what the official doc says, a Bearer JWTtoken is required for this endpoint to work.