Documentation
¶
Overview ¶
Package epoint is a Go client for the epoint.az payment gateway.
It covers all 30 documented endpoints: payments, saved cards, refunds and payouts, split payments, pre-authorisation, installments, wallets, Apple Pay and Google Pay, invoices, and B2B transfers.
Create a client and start a payment:
client := epoint.New("i000000001", "your-private-key")
payment, err := client.CreatePayment(ctx, 30.75, "order-1", nil)
if err != nil {
return err
}
// send the customer to payment.RedirectURL()
Point BaseURL at the local sandbox to build and test without a merchant account: https://github.com/martian56/epoint-sandbox
Index ¶
- Variables
- type B2BStatus
- type BankTransfer
- type Callback
- type CardStatus
- type ChargeOptions
- type Client
- func (c *Client) Capture(ctx context.Context, transaction string, amount float64) (*Response, error)
- func (c *Client) ChangePaymentSum(ctx context.Context, amount float64, orderID string, opts *PaymentOptions) (*Response, error)
- func (c *Client) ChargeSavedCard(ctx context.Context, cardID string, amount float64, orderID string, ...) (*Response, error)
- func (c *Client) CreateAmexPayment(ctx context.Context, amount float64, orderID string, opts *PaymentOptions) (*Response, error)
- func (c *Client) CreateBankTransfer(ctx context.Context, transfer BankTransfer) (*Response, error)
- func (c *Client) CreateInvoice(ctx context.Context, amount float64, periodFrom, periodTo string, ...) (*Response, error)
- func (c *Client) CreatePayment(ctx context.Context, amount float64, orderID string, opts *PaymentOptions) (*Response, error)
- func (c *Client) CreatePaymentRequest(ctx context.Context, amount float64, orderID string, opts *PaymentOptions) (*Response, error)
- func (c *Client) CreateSplitPayment(ctx context.Context, amount float64, orderID, splitAccount string, ...) (*Response, error)
- func (c *Client) CreateWidget(ctx context.Context, amount float64, orderID, description string) (*Response, error)
- func (c *Client) GetBankTransfer(ctx context.Context, orderID string) (*Response, error)
- func (c *Client) GetCardStatus(ctx context.Context, cardID string) (*Response, error)
- func (c *Client) GetInstallmentPlans(ctx context.Context, orderID string, opts *InstallmentQueryOptions) ([]map[string]any, error)
- func (c *Client) GetInvoice(ctx context.Context, invoiceID int) (*Response, error)
- func (c *Client) GetStatus(ctx context.Context, transaction string) (*Response, error)
- func (c *Client) Heartbeat(ctx context.Context) (*Response, error)
- func (c *Client) ListInvoices(ctx context.Context, kind, order string) (*Response, error)
- func (c *Client) ListWallets(ctx context.Context) (map[string]string, error)
- func (c *Client) PayByInstallment(ctx context.Context, amount float64, orderID, installmentCardID string, ...) (*Response, error)
- func (c *Client) PayWithWallet(ctx context.Context, walletID string, amount float64, orderID string, ...) (*Response, error)
- func (c *Client) Refund(ctx context.Context, cardID string, amount float64, orderID string, ...) (*Response, error)
- func (c *Client) RegisterCard(ctx context.Context, opts *RegisterCardOptions) (*Response, error)
- func (c *Client) RegisterCardAndPay(ctx context.Context, amount float64, orderID string, opts *PaymentOptions) (*Response, error)
- func (c *Client) Reserve(ctx context.Context, amount float64, orderID string, opts *PaymentOptions) (*Response, error)
- func (c *Client) Reverse(ctx context.Context, transaction string, opts *ReverseOptions) (*Response, error)
- func (c *Client) SendInvoiceEmail(ctx context.Context, invoiceID int, email string) (*Response, error)
- func (c *Client) SendInvoiceSMS(ctx context.Context, invoiceID int, phone string) (*Response, error)
- func (c *Client) SplitChargeSavedCard(ctx context.Context, cardID string, amount float64, ...) (*Response, error)
- func (c *Client) UpdateInvoice(ctx context.Context, invoiceID int, amount float64, ...) (*Response, error)
- func (c *Client) VerifyCallback(data, signature string) (*Callback, error)
- type Currency
- type GatewayError
- type InstallmentQueryOptions
- type InvoiceOptions
- type InvoiceStatus
- type Language
- type OperationCode
- type Option
- type PaymentOptions
- type RegisterCardOptions
- type Response
- type ReverseOptions
- type SignatureError
- type Status
- type TransportError
Constants ¶
This section is empty.
Variables ¶
var AZNOnly = []Currency{CurrencyAZN}
Split, pre-auth, refund, reverse, payout and wallet take AZN and nothing else.
var SupportedCurrencies = []Currency{CurrencyAZN, CurrencyUSD, CurrencyEUR, CurrencyRUB}
SupportedCurrencies are the ones checkout takes.
Functions ¶
This section is empty.
Types ¶
type B2BStatus ¶ added in v0.2.0
type B2BStatus string
B2BStatus is the state of a business to business payment.
type BankTransfer ¶
type Callback ¶
type Callback struct {
OrderID string
Status string
Code string
Message string
Transaction string
BankTransaction string
OperationCode string
RRN string
CardMask string
CardName string
Amount float64
OtherAttr any
Raw map[string]any
}
func VerifyCallback ¶
type CardStatus ¶ added in v0.2.0
type CardStatus string
CardStatus is the state of a saved card.
const ( CardStatusNew CardStatus = "new" CardStatusActive CardStatus = "active" CardStatusPending CardStatus = "pending" CardStatusRejected CardStatus = "rejected" CardStatusExpired CardStatus = "expired" CardStatusSessionExpired CardStatus = "session_expired" )
func (CardStatus) Usable ¶ added in v0.2.0
func (c CardStatus) Usable() bool
Usable reports whether the card can be charged.
type ChargeOptions ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ChangePaymentSum ¶
func (*Client) ChargeSavedCard ¶
func (*Client) CreateAmexPayment ¶
func (*Client) CreateBankTransfer ¶
func (*Client) CreateInvoice ¶
func (*Client) CreatePayment ¶
func (*Client) CreatePaymentRequest ¶
func (*Client) CreateSplitPayment ¶
func (*Client) CreateWidget ¶
func (*Client) GetBankTransfer ¶
func (*Client) GetCardStatus ¶
func (*Client) GetInstallmentPlans ¶
func (*Client) GetInvoice ¶
func (*Client) ListInvoices ¶
func (*Client) ListWallets ¶
func (*Client) PayByInstallment ¶
func (*Client) PayWithWallet ¶
func (*Client) RegisterCard ¶
func (*Client) RegisterCardAndPay ¶
func (*Client) SendInvoiceEmail ¶
func (*Client) SendInvoiceSMS ¶
func (*Client) SplitChargeSavedCard ¶
func (*Client) UpdateInvoice ¶
type GatewayError ¶
func (*GatewayError) Error ¶
func (e *GatewayError) Error() string
type InstallmentQueryOptions ¶
type InvoiceOptions ¶
type InvoiceStatus ¶ added in v0.2.0
type InvoiceStatus string
InvoiceStatus is the state of an invoice.
const ( InvoiceStatusWaiting InvoiceStatus = "waiting_for_payment" InvoiceStatusPaid InvoiceStatus = "paid" InvoiceStatusCanceled InvoiceStatus = "canceled" )
type Language ¶ added in v0.2.0
type Language string
Language is the language of the hosted checkout page.
type OperationCode ¶ added in v0.2.0
type OperationCode string
OperationCode says what the transaction did, as it comes back on a callback.
const ( OperationCardRegistration OperationCode = "001" OperationPayment OperationCode = "100" OperationRegistrationWithPayment OperationCode = "200" )
type Option ¶
type Option func(*Client)
func WithBaseURL ¶
func WithCurrency ¶
func WithHTTPClient ¶
func WithLanguage ¶
func WithRedirectURLs ¶
type PaymentOptions ¶
type RegisterCardOptions ¶
type ReverseOptions ¶
type SignatureError ¶
type SignatureError struct {
Message string
}
func (*SignatureError) Error ¶
func (e *SignatureError) Error() string
type TransportError ¶
func (*TransportError) Error ¶
func (e *TransportError) Error() string