idpay

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2022 License: MIT Imports: 5 Imported by: 0

README

idpay-golang

go module to work with idpay.ir api

example:
package main

import "github.com/MrMohebi/idpay-golang"

func main() {
	idpayC := idpay.NewClient("2bb467dd-aaaa-aaaa-aaaa-aaaaafc90add", true)

	createRes := idpayC.CreatePayment("123", 5000, "https://google.com", "", "", "", "")
	println(createRes.Link)

	verifyRes := idpayC.Verify("3adf8e642413ed0d5d17b9e4901f9065", "123")
	println(verifyRes.TrackId)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	APIKEY string
	// contains filtered or unexported fields
}

Client type

func NewClient

func NewClient(apikey string, isTest bool) Client

NewClient create new idpay client

func (*Client) CreatePayment

func (c *Client) CreatePayment(orderId string, amount int64, callBack string, name string, phone string, mail string, desc string) CreatePaymentRes

CreatePayment create payment link

func (*Client) SetHost

func (c *Client) SetHost(host string)

func (*Client) Verify

func (c *Client) Verify(id string, orderId string) VerifyRes

Verify verify payment

type CreatePaymentReq

type CreatePaymentReq struct {
	OrderId  string `json:"order_id"`
	Amount   int64  `json:"amount"`
	Name     string `json:"name"`
	Phone    string `json:"phone"`
	Mail     string `json:"mail"`
	Desc     string `json:"desc"`
	Callback string `json:"callback"`
}

type CreatePaymentRes

type CreatePaymentRes struct {
	ReqStatus    requestStatus
	ErrorCode    int    `json:"error_code"`
	ErrorMessage string `json:"error_message"`
	Id           string `json:"id"`
	Link         string `json:"link"`
}

type VerifyReq

type VerifyReq struct {
	Id      string `json:"id"`
	OrderId string `json:"order_id"`
}

type VerifyRes

type VerifyRes struct {
	ReqStatus    requestStatus
	ErrorCode    int    `json:"error_code"`
	ErrorMessage string `json:"error_message"`
	Status       int    `json:"status"`
	TrackId      int32  `json:"track_id,string"`
	Id           string `json:"id"`
	OrderId      string `json:"order_id"`
	Amount       int64  `json:"amount,string"`
	Date         int64  `json:"date,string"`
	Payment      payment
	Verify       verify
}

Jump to

Keyboard shortcuts

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