Documentation ¶
Index ¶
- Constants
- func NewIdempotenceKey() (string, error)
- func WithBaseURL(url string) func(*Client)
- func WithHTTPClient(client *http.Client) func(*Client)
- type AirlineTicketData
- type AirlineTicketLegData
- type AirlineTocketPassengerData
- type AlfaClickPaymentDetails
- type AlfaClickPaymentRequestData
- type Amount
- type ApplePayPaymentRequestData
- type AuthorizationDetails
- type BankCardData
- type BankCardInfo
- type BankCardPaymentDetails
- type BankCardPaymentRequestData
- type CancellationDetails
- type Client
- func (c *Client) CreatePayment(k string, p *PaymentRequest) (*PaymentResponse, error)
- func (c *Client) CreatePaymentContext(ctx context.Context, k string, p *PaymentRequest) (*PaymentResponse, error)
- func (c *Client) FetchPaymentInfo(id string) (*PaymentResponse, error)
- func (c *Client) FetchPaymentInfoContext(ctx context.Context, id string) (*PaymentResponse, error)
- type Confirmation
- type ConfirmationInfo
- type CustomerInfo
- type EmbededConfirmationDetails
- type Event
- type GooglePayPaymentRequestData
- type PayerBankDetails
- type PaymentError
- type PaymentMethod
- type PaymentRequest
- type PaymentResponse
- type PhoneNumberPaymentRequestData
- type QRCodeConfirmationDetails
- type ReceiptRequestData
- type Recipient
- type RecipientRequest
- type RedirectConfirmation
- type RedirectConfirmationDetails
- type SberBusinessOnlinePaymentDetails
- type SberBusinessOnlinePaymentRequestDate
- type SberOnlinePaymentDetails
- type SimplePaymentRequestData
- type TransferDetails
- type TransferRequestData
- type VATData
- type YooMoneyPaymentDetails
Constants ¶
View Source
const ( StatusPending = "pending" StatusWaiting = "waiting_for_capture" SatusSucceeded = "succeeded" StatusCanceled = "canceled" )
View Source
const ( ConfirmationRedirect = "redirect" ConfirmationQR = "qr" ConfirmationEmbeded = "embedded" ConfirmationExternal = "external" )
View Source
const ( PaymentByBankCard = "bank_card" PaymentByApplePay = "apple_pay" PaymentByGooglePay = "google_pay" PaymentByYooMoney = "yoo_money" PaymentByQIWI = "qiwi" PaymentByWebmoney = "webmoney" PaymentBySberOnline = "sberbank" PaymentBySberBusinessOnline = "b2b_sberbank" PaymentByAlfaClick = "alfabank" PaymentByTinkoff = "tinkoff_bank" PaymentByMobileBalance = "mobile_balance" PaymentByCash = "cash" PaymentByInstallments = "installments" VATUntaxed = "untaxed" VATCalculated = "calculated" VATMixed = "mixed" )
View Source
const ( EventWaitingForCapture = "payment.waiting_for_capture" EventPaymentSucceeded = "payment.succeeded" EventPaymentCancelled = "payment.canceled" EventRefundSucceeded = "refund.succeeded" )
Variables ¶
This section is empty.
Functions ¶
func NewIdempotenceKey ¶
NewIdempotenceKey generates a new V4 UUID to use as indepotency key as recommended in https://yookassa.ru/developers/using-api/basics.
func WithBaseURL ¶
func WithHTTPClient ¶
Types ¶
type AirlineTicketData ¶
type AirlineTicketData struct { TicketNumber string `json:"ticket_number,omitempty"` BookingReference string `json:"booking_reference,omitempty"` Passengers []AirlineTocketPassengerData `json:"passengers,omitempty"` Legs []AirlineTicketLegData `json:"legs"` }
type AirlineTicketLegData ¶
type AlfaClickPaymentDetails ¶
type AlfaClickPaymentDetails struct { Login string `json:"login"` // contains filtered or unexported fields }
type AlfaClickPaymentRequestData ¶
type AlfaClickPaymentRequestData struct {
Login string
}
func (*AlfaClickPaymentRequestData) MarshalJSON ¶
func (p *AlfaClickPaymentRequestData) MarshalJSON() ([]byte, error)
type ApplePayPaymentRequestData ¶
type ApplePayPaymentRequestData struct {
Token string
}
func (*ApplePayPaymentRequestData) MarshalJSON ¶
func (p *ApplePayPaymentRequestData) MarshalJSON() ([]byte, error)
type AuthorizationDetails ¶
type BankCardData ¶
type BankCardInfo ¶
type BankCardInfo struct { First6 string `json:"first_6,omitempty"` Last4 string `json:"last_4"` ExpiryYear string `json:"expiry_year"` ExpiryMonth string `json:"expiry_month"` Type string `json:"type"` IssuerCountry string `json:"issuer_country"` IssuerName string `json:"issuer_name"` Source string `json:"source"` }
type BankCardPaymentDetails ¶
type BankCardPaymentDetails struct {
Card BankCardInfo `json:"card"`
}
type BankCardPaymentRequestData ¶
type BankCardPaymentRequestData struct {
Card BankCardData
}
func (*BankCardPaymentRequestData) MarshalJSON ¶
func (p *BankCardPaymentRequestData) MarshalJSON() ([]byte, error)
type CancellationDetails ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreatePayment ¶
func (c *Client) CreatePayment(k string, p *PaymentRequest) (*PaymentResponse, error)
CreatePayment sends the new payment request with specific indepotence key `k`.
func (*Client) CreatePaymentContext ¶
func (c *Client) CreatePaymentContext(ctx context.Context, k string, p *PaymentRequest) (*PaymentResponse, error)
CreatePaymentContext sends the new payment request with specific indepotence key `k`.
func (*Client) FetchPaymentInfo ¶
func (c *Client) FetchPaymentInfo(id string) (*PaymentResponse, error)
func (*Client) FetchPaymentInfoContext ¶
type Confirmation ¶
type ConfirmationInfo ¶
type ConfirmationInfo struct { Type string `json:"type"` Details interface{} `json:"details,omitempty"` }
func (*ConfirmationInfo) UnmarshalJSON ¶
func (c *ConfirmationInfo) UnmarshalJSON(data []byte) error
type CustomerInfo ¶
type Event ¶
type Event struct { Type string `json:"type"` Name string `json:"event"` Object *PaymentResponse `json:"object"` }
type GooglePayPaymentRequestData ¶
type GooglePayPaymentRequestData struct {
Token string
}
func (*GooglePayPaymentRequestData) MarshalJSON ¶
func (p *GooglePayPaymentRequestData) MarshalJSON() ([]byte, error)
type PayerBankDetails ¶
type PayerBankDetails struct { FullName string `json:"full_name"` ShortName string `json:"short_name"` Address string `json:"address"` INN string `json:"inn"` KPP string `json:"kpp"` BankName string `json:"bank_name"` BankBranch string `json:"bank_branch"` BankBIK string `json:"bank_bik"` Account string `json:"account"` }
type PaymentError ¶
type PaymentError struct {
InternalError error
}
func NewPaymentError ¶
func NewPaymentError(err error) *PaymentError
func (*PaymentError) Error ¶
func (e *PaymentError) Error() string
func (*PaymentError) Is ¶
func (e *PaymentError) Is(err error) bool
type PaymentMethod ¶
type PaymentMethod struct { ID string `json:"id"` Type string `json:"type"` Saved bool `json:"saved"` Details interface{} `json:"details"` }
func (*PaymentMethod) UnmarshalJSON ¶
func (m *PaymentMethod) UnmarshalJSON(data []byte) error
type PaymentRequest ¶
type PaymentRequest struct { Amount Amount `json:"amount"` Description string `json:"description,omitempty"` Receipt *ReceiptRequestData `json:"receipt,omitempty"` Recipient *RecipientRequest `json:"recipient,omitempty"` PaymentToken string `json:"payment_token,omitempty"` PaymentMethodID string `json:"payment_method_id,omitempty"` PaymentMethodData *PaymentMethod `json:"payment_method_data,omitempty"` Confirmation interface{} `json:"confirmation"` SavePaymentMethod bool `json:"save_payment_method,omitempty"` Capture bool `json:"capture,omitempty"` ClientIP string `json:"client_ip,omitempty"` Metadata map[string]interface{} `json:"metadata,omitempty"` AirlineTicket *AirlineTicketData `json:"airline,omitempty"` Transfers []TransferRequestData `json:"transfers,omitempty"` }
type PaymentResponse ¶
type PaymentResponse struct { ID string `json:"id"` Status string `json:"status"` Test bool `json:"test"` Paid bool `json:"paid"` Refundable bool `json:"refundable"` Amount Amount `json:"amount"` IncomeAmount *Amount `json:"income_amount,omitempty"` RefundedAmount *Amount `json:"refunded_amount,omitempty"` Created time.Time `json:"created_at"` Captured time.Time `json:"captured_at"` Expires time.Time `json:"expires_at"` Description string `json:"description"` Recipient Recipient `json:"recipient"` PaymentMethod PaymentMethod `json:"payment_method"` ReceiptRegistration string `json:"receipt_registration,omitempty"` AuthorizationDetails *AuthorizationDetails `json:"authorization_details,omitempty"` CancellationDetails *CancellationDetails `json:"cancellation_details,omitempty"` Confirmation ConfirmationInfo `json:"confirmation"` Transfers []TransferDetails `json:"transfers,omitempty"` // Max 16 keys // Max key name length 32 // Max key value length 512 Metadata map[string]interface{} `json:"metadata,omitempty"` }
type ReceiptRequestData ¶
type ReceiptRequestData struct {
Customer CustomerInfo `json:"customer"`
}
type RecipientRequest ¶
type RecipientRequest struct {
GatewayID string `json:"gateway_id"`
}
type RedirectConfirmation ¶
type RedirectConfirmation struct { ReturnURL string `json:"return_url"` Locale string `json:"locale,omitempty"` Enforce bool `json:"enforce,omitempty"` }
func (*RedirectConfirmation) MarshalJSON ¶
func (c *RedirectConfirmation) MarshalJSON() ([]byte, error)
type SberBusinessOnlinePaymentDetails ¶
type SberBusinessOnlinePaymentDetails struct { PaymentPurpose string `json:"payment_purpose"` // Max 210 symbols PayerBankDetails PayerBankDetails `json:"payer_bank_details"` }
type SberBusinessOnlinePaymentRequestDate ¶
func (*SberBusinessOnlinePaymentRequestDate) MarshalJSON ¶
func (p *SberBusinessOnlinePaymentRequestDate) MarshalJSON() ([]byte, error)
type SberOnlinePaymentDetails ¶
type SberOnlinePaymentDetails struct {
Phone string `json:"phone"`
}
type SimplePaymentRequestData ¶
type SimplePaymentRequestData struct {
Type string `json:"type"`
}
type TransferDetails ¶
type TransferRequestData ¶
type YooMoneyPaymentDetails ¶
type YooMoneyPaymentDetails struct {
AccountNumber string `json:"account_number"`
}
Click to show internal directories.
Click to hide internal directories.