Help us shape the future of Go! Take the 2026 Go Developer Survey

razorpay

package module
v0.0.0-...-1aad6a1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: MIT Imports: 5 Imported by: 0

README

razorpay-go

Razorpay GO lang SDK

Documentation

Index

Constants

View Source
const BaseURL = "https://api.razorpay.com/v1"

BaseURL stores the API base URL

View Source
const VAReceiverType = "bank_account"

VAReceiverType currently it is the only receiver type supported by virtual account endpoint

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	ID            string `json:"id"`
	Entity        string `json:"entity"`
	Name          string `json:"name"`
	Last4         string `json:"last4"`
	Network       string `json:"network"`
	Type          string `json:"type"`
	Issuer        string `json:"issuer"`
	International string `json:"international"`
	EMI           string `json:"emi"`
}

Card struct represents the information of the card

func (*Card) Endpoint

func (c *Card) Endpoint() string

Endpoint method returns the endpoint of the resource

func (*Card) FindOne

func (c *Card) FindOne(id string, client *Client) (*Card, error)

FindOne tries to find the card with given id

func (*Card) New

func (c *Card) New() Resource

New method will create a card object and return a pointer to it

type CardParams

type CardParams struct {
	ID            string `json:"id"`
	Entity        string `json:"entity"`
	Name          string `json:"name"`
	Last4         string `json:"last4"`
	Network       string `json:"network"`
	Type          string `json:"type"`
	Issuer        string `json:"issuer"`
	International string `json:"international"`
	EMI           string `json:"emi"`
}

CardParams struct represents the information to create a card

type Client

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

Client struct

func NewClient

func NewClient(key, secret string) *Client

NewClient returns a pointer to the razorpay client

func (*Client) Delete

func (c *Client) Delete(path string, body []byte) (*http.Response, error)

Delete method makes a DELETE request to the resource

func (*Client) Get

func (c *Client) Get(path string) (*http.Response, error)

Get method makes a GET request to the resource

func (*Client) Patch

func (c *Client) Patch(path string, body []byte) (*http.Response, error)

Patch method makes a PATCH and sends data in json format

func (*Client) Post

func (c *Client) Post(path string, body []byte) (*http.Response, error)

Post method makes a POST and sends data in json format

type Customer

type Customer struct {
	ID     string `json:"id"`
	Entity string `json:"entity"`
	Name   string `json:"name"`
	Email  string `json:"email"`
	// Contact number of the customer
	Contact   string            `json:"contact"`
	Notes     map[string]string `json:"notes,omitempty"`
	CreatedAt int               `json:"created_at"`
}

Customer struct represents the information of the customer

func (*Customer) Create

func (c *Customer) Create(params *CustomerParams, client *Client) (*Customer, error)

Create method will try to create a customer on razorpay

func (*Customer) Endpoint

func (c *Customer) Endpoint() string

Endpoint method returns the endpoint of the resource

func (*Customer) FindOne

func (c *Customer) FindOne(id string, client *Client) (*Customer, error)

FindOne tries to find the customer with given id

func (*Customer) New

func (c *Customer) New() Resource

New method will create a customer object and return a pointer to it

type CustomerParams

type CustomerParams struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	// Contact number of the customer
	Contact string            `json:"contact"`
	Notes   map[string]string `json:"notes"`

	FailExisting string `json:"fail_existing"`
}

CustomerParams struct represents the information to create a customer

type Order

type Order struct {
	ID       string `json:"id"`
	Entity   string `json:"entity"`
	Amount   int64  `json:"amount"`
	Currency string `json:"currency"`
	Receipt  string `json:"receipt"`
	Status   string `json:"status"`
	Attempts int    `json:"attempts"`

	Notes     map[string]string `json:"notes,omitempty"`
	CreatedAt int               `json:"created_at"`

	AmountPaid int64 `json:"amount_paid"`
	AmountDue  int64 `json:"amount_due"`
}

Order struct represents the information of the order

func (*Order) Create

func (o *Order) Create(params *OrderParams, client *Client) (*Order, error)

Create method will try to create a order on razorpay

func (*Order) Endpoint

func (o *Order) Endpoint() string

Endpoint method returns the endpoint of the resource

func (*Order) FindOne

func (o *Order) FindOne(id string, client *Client) (*Order, error)

FindOne tries to find the order with given id

func (*Order) New

func (o *Order) New() Resource

New method will create a order object and return a pointer to it

type OrderParams

type OrderParams struct {
	Amount   int64  `json:"amount"`
	Currency string `json:"currency"`
	Receipt  string `json:"receipt"`

	PaymentCapture bool `json:"payment_capture"`

	Notes map[string]string `json:"notes"`
}

OrderParams struct represents the information to create a order

type Payment

type Payment struct {
	ID             string `json:"id"`
	Entity         string `json:"entity"`
	Amount         int64  `json:"amount"`
	Currency       string `json:"currency"`
	Status         string `json:"status"`
	OrderID        string `json:"order_id"`
	InvoiceID      string `json:"invoice_id"`
	International  bool   `json:"international"`
	Method         string `json:"method"`
	AmountRefunded int64  `json:"amount_refunded"`
	Captured       bool   `json:"captured"`
	Description    string `json:"description"`
	CardID         string `json:"card_id"`
	Card           Card   `json:"car"`
	Bank           string `json:"bank"`
	Email          string `json:"email"`
	Contact        string `json:"contact"`

	Notes     interface{} `json:"notes,omitempty"`
	Fee       int64       `json:"fee"`
	Tax       int64       `json:"tax"`
	CreatedAt int         `json:"created_at"`

	AmountPaid int64 `json:"amount_paid"`
	AmountDue  int64 `json:"amount_due"`
}

Payment struct represents the information of the payment

func (*Payment) Endpoint

func (p *Payment) Endpoint() string

Endpoint method returns the endpoint of the resource

func (*Payment) FindOne

func (p *Payment) FindOne(id string, client *Client) (*Payment, error)

FindOne tries to find the payment with given id

func (*Payment) GetNotes

func (p *Payment) GetNotes() map[string]string

GetNotes function is used to return a map of the notes

func (*Payment) New

func (p *Payment) New() Resource

New method will create a payment object and return a pointer to it

type PaymentParams

type PaymentParams struct {
	Amount   int64  `json:"amount"`
	Currency string `json:"currency"`
	Receipt  string `json:"receipt"`

	PaymentCapture bool `json:"payment_capture"`

	Notes map[string]string `json:"notes"`
}

PaymentParams struct represents the information to create a payment

type Receiver

type Receiver struct {
	ID        string `json:"id"`
	Entity    string `json:"entity"`
	Name      string `json:"name"`
	AccountNo string `json:"account_number"`
	IFSC      string `json:"ifsc"`
}

Receiver struct for holding bank account info

type Resource

type Resource interface {
	New() Resource
	Endpoint() string
}

Resource interface is to be used for generic decoding of object

type Settlement

type Settlement struct {
	ID        string `json:"id"`
	Entity    string `json:"entity"`
	Amount    int64  `json:"amount"`
	Status    string `json:"status"`
	Fees      int64  `json:"fees"`
	Tax       int64  `json:"tax"`
	UTR       string `json:"utr"`
	CreatedAt int64  `json:"created_at"`
}

Settlement struct contains the properties of settlement object

func (*Settlement) Endpoint

func (o *Settlement) Endpoint() string

Endpoint method returns the endpoint of the resource

func (*Settlement) New

func (o *Settlement) New() Resource

New method will create a settlement object and return a pointer to it

type VirtualAccount

type VirtualAccount struct {
	ID          string     `json:"id"`
	Entity      string     `json:"entity"`
	Description string     `json:"description"`
	CustomerID  string     `json:"customer_id"`
	Status      string     `json:"status"`
	AmountPaid  int        `json:"amount_paid"`
	Receivers   []Receiver `json:"receivers"`

	Notes     interface{} `json:"notes,omitempty"`
	CreatedAt int         `json:"created_at"`
}

VirtualAccount struct holds info regarding the virtual account

func (*VirtualAccount) Close

func (va *VirtualAccount) Close(id string, client *Client) (*VirtualAccount, error)

Close method will close the virtual account

func (*VirtualAccount) Create

func (va *VirtualAccount) Create(params *VirtualAccountParams, client *Client) (*VirtualAccount, error)

Create method will try to create a customer on razorpay

func (*VirtualAccount) Endpoint

func (va *VirtualAccount) Endpoint() string

Endpoint method returns the endpoint of the resource

func (*VirtualAccount) FindOne

func (va *VirtualAccount) FindOne(id string, client *Client) (*VirtualAccount, error)

FindOne tries to find the customer with given id

func (*VirtualAccount) GetNotes

func (va *VirtualAccount) GetNotes() map[string]string

GetNotes function is used to return a map of the notes

func (*VirtualAccount) New

func (va *VirtualAccount) New() Resource

New method will create a customer object and return a pointer to it

type VirtualAccountParams

type VirtualAccountParams struct {
	Description string `json:"description"`
	CustomerID  string `json:"customer_id"`

	Receivers VirtualAccountReceiver `json:"receivers"`

	Notes map[string]string `json:"notes,omitempty"`
}

VirtualAccountParams struct contains the params required for creating a virtual account

type VirtualAccountReceiver

type VirtualAccountReceiver struct {
	Types []string `json:"types"`
}

VirtualAccountReceiver struct contain the receiver properties

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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