Documentation
¶
Overview ¶
Package bitpay implements the BitPay.ir gateway (REST, bitpay.ir).
Credentials: core.Config.MerchantKey is the API key. The literal "bitpay.ir-demo-api-key" is BitPay's own sandbox key and is used when the gateway is built with core.WithSandbox.
Index ¶
- Constants
- func Message(code int64) string
- func WithDefaultDescription(description string) core.Option
- type Gateway
- func (g *Gateway) Capabilities() core.Capabilities
- func (g *Gateway) Name() core.Name
- func (g *Gateway) ParseCallback(r *http.Request) (core.Callback, error)
- func (g *Gateway) Purchase(ctx context.Context, req core.PurchaseRequest) (core.PurchaseResponse, error)
- func (g *Gateway) Verify(ctx context.Context, req core.VerifyRequest) (core.VerifyResponse, error)
Constants ¶
const Name core.Name = "bitpay"
Name is the registry name of this gateway.
Variables ¶
This section is empty.
Functions ¶
func WithDefaultDescription ¶
WithDefaultDescription sets the description used when a purchase request carries none.
Types ¶
type Gateway ¶
type Gateway struct {
// Unsupported answers Refund and Inquiry, which BitPay does not expose.
core.Unsupported
// contains filtered or unexported fields
}
Gateway is the BitPay.ir implementation of core.Gateway.
func (*Gateway) Capabilities ¶
func (g *Gateway) Capabilities() core.Capabilities
Capabilities reports what BitPay offers.
func (*Gateway) ParseCallback ¶
ParseCallback reads the id_get/trans_id pair BitPay returns the payer with.
func (*Gateway) Purchase ¶
func (g *Gateway) Purchase(ctx context.Context, req core.PurchaseRequest) (core.PurchaseResponse, error)
Purchase creates a payment and returns the BitPay redirect URL.
func (*Gateway) Verify ¶
func (g *Gateway) Verify(ctx context.Context, req core.VerifyRequest) (core.VerifyResponse, error)
Verify settles the payment. BitPay identifies it by the pair (id_get, trans_id); the transaction id comes from the callback.