zarinpal

package
v1.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	APIPurchaseURL = "https://api.zarinpal.com/pg/v4/payment/request.json"
	APIVerifyURL   = "https://api.zarinpal.com/pg/v4/payment/verify.json"
	APIPaymentURL  = "https://www.zarinpal.com/pg/StartPay/"
)

Const's for zarinpal driver

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver struct {
	MerchantID string
	Callback   string
}

Driver config struct for zarinpal driver

func (Driver) GetDriverName

func (Driver) GetDriverName() string

GetDriverName returns driver name

func (*Driver) PayMethod

func (*Driver) PayMethod() string

PayMethod returns the Request Method to be used to pay the invoice.

func (*Driver) PayURL

func (*Driver) PayURL(invoice *invoice.Invoice) string

PayURL returns the url to redirect the user to in order to pay the invoice.

func (*Driver) Purchase

func (d *Driver) Purchase(invoice *invoice.Invoice) (string, error)

Purchase sends a request to Zarinpal to purchase an invoice.

func (*Driver) RenderRedirectForm added in v1.7.0

func (d *Driver) RenderRedirectForm(invoice *invoice.Invoice) (string, error)

RenderRedirectForm renders the html form for redirect to payment page.

func (Driver) SetClient added in v1.4.0

func (Driver) SetClient(c httpClient.Client)

SetClient sets the http client

func (*Driver) Verify

func (d *Driver) Verify(vReq interface{}) (*receipt.Receipt, error)

Verify is the function to verify a payment

type VerifyRequest

type VerifyRequest struct {
	Amount    string `json:"Amount"`
	Authority string `json:"Authority"`
}

VerifyRequest is the request struct for verify

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL