Documentation ¶
Index ¶
Constants ¶
const (
// HeaderNameHMAC is used for authentication
HeaderNameHMAC = "HMAC"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Payment *paymentService // contains filtered or unexported fields }
Client is the coinpayments API client. Do not instantiate this client with Client{}. Use the New method instead.
type CreatePaymentRequest ¶
type CreatePaymentRequest struct { Amount string `json:"amount"` OriginalCurrency string `json:"currency1"` SendingCurrency string `json:"currency2"` BuyerEmail string `json:"buyer_email"` }
CreatePaymentRequest are the parameters for creating a payment
type CreatePaymentResponse ¶
type CreatePaymentResponse struct { Error string `json:"error"` Result CreatePaymentResult `json:"result"` }
CreatePaymentResponse is the api response after creating a payment
type CreatePaymentResult ¶
type CreatePaymentResult struct { Amount string `json:"amount"` Address string `json:"address"` DestTag string `json:"dest_tag"` TransactionID string `json:"txn_id"` ConfirmsNeeded string `json:"confirms_needed"` Timeout int `json:"timeout"` CheckoutURL string `json:"checkout_url"` StatusURL string `json:"status_url"` QrcodeURL string `json:"qrcode_url"` }
CreatePaymentResult is the result of creating a payment
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is options for constructing a client
func WithAPISecret ¶
WithAPISecret the coinpayments api secret
func WithBaseURL ¶
WithBaseURL set's the base url for the coinpayments API
func WithHTTPClient ¶
WithHTTPClient sets the underlying HTTP client used for API requests. By default, http.DefaultClient is used.
func WithIPNSecret ¶ added in v0.0.3
WithIPNSecret the coinpayments IPN secret
type PaymentIpnRequest ¶ added in v0.0.2
type PaymentIpnRequest struct { Status string `form:"status"` StatusText string `form:"status_text"` TxnID string `form:"txn_id"` Currency1 string `form:"currency1"` Currency2 string `form:"currency2"` Amount1 string `form:"amount1"` Amount2 string `form:"amount2"` Fee string `form:"fee"` IpnType string `form:"ipn_type"` BuyerName string `form:"buyer_name"` Email string `form:"email"` ItemName string `form:"item_name"` ItemNumber string `form:"item_number"` Invoice string `form:"invoice"` Custom string `form:"custom"` ReceivedAmount string `form:"received_amount"` ReceivedConfirms string `form:"received_confirms"` }
PaymentIpnRequest is the response we expect back from the server when the command is "api"
func (PaymentIpnRequest) IsComplete ¶ added in v0.0.3
func (request PaymentIpnRequest) IsComplete() bool
IsComplete returns true with the payment is completed
func (PaymentIpnRequest) IsFailed ¶ added in v0.0.3
func (request PaymentIpnRequest) IsFailed() bool
IsFailed returns ttrue when the payment is failed
func (PaymentIpnRequest) IsWaiting ¶ added in v0.0.3
func (request PaymentIpnRequest) IsWaiting() bool
IsWaiting returns true when the payment is in the waiting state
type PaymentTransaction ¶ added in v0.0.3
type PaymentTransaction struct { TimeCreated int `json:"time_created"` TimeExpires int `json:"time_expires"` Status int `json:"status"` StatusText string `json:"status_text"` Type string `json:"type"` Coin string `json:"coin"` Amount int `json:"amount"` AmountFormatted string `json:"amountf"` Received int `json:"received"` ReceivedFormatted string `json:"receivedf"` ReceiveConfirms int `json:"recv_confirms"` PaymentAddress string `json:"payment_address"` TimeCompleted int `json:"time_completed"` SenderIP string `json:"sender_ip"` }
PaymentTransaction is the transaction details
type PaymentTransactionResponse ¶ added in v0.0.3
type PaymentTransactionResponse struct { Error string `json:"error"` Result PaymentTransaction `json:"result"` }
PaymentTransactionResponse is the response gotten when we fetch a transaction