gomon

package module
v0.1.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: May 19, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

README

Gomon Go API Library

Go Reference

The Gomon Go library provides convenient access to the Gomon REST API from applications written in Go.

It is generated with Stainless.

Installation

import (
	"github.com/ankitdas13/goMon" // imported as gomon
)

Or to pin the version:

go get -u 'github.com/ankitdas13/goMon@v0.1.0-alpha.5'

Requirements

This library requires Go 1.18+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/ankitdas13/goMon"
	"github.com/ankitdas13/goMon/option"
)

func main() {
	client := gomon.NewClient(
		option.WithUsername("My Username"), // defaults to os.LookupEnv("GOMON_USERNAME")
		option.WithPassword("My Password"), // defaults to os.LookupEnv("GOMON_PASSWORD")
	)
	orders, err := client.Orders.List(context.TODO(), gomon.OrderListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", orders.Count)
}

Request fields

The gomon library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `json:"...,required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, gomon.String(string), gomon.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := gomon.ExampleParams{
	ID:   "id_xxx",            // required property
	Name: gomon.String("..."), // optional property

	Point: gomon.Point{
		X: 0,            // required field will serialize as 0
		Y: gomon.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: gomon.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[gomon.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of it's variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := gomon.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Orders.List(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

Errors

When the API returns a non-success status code, we return an error with type *gomon.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Orders.List(context.TODO(), gomon.OrderListParams{})
if err != nil {
	var apierr *gomon.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/orders": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Orders.List(
	ctx,
	gomon.OrderListParams{},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper gomon.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := gomon.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Orders.List(
	context.TODO(),
	gomon.OrderListParams{},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
orders, err := client.Orders.List(
	context.TODO(),
	gomon.OrderListParams{},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", orders)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: gomon.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := gomon.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (GOMON_USERNAME, GOMON_PASSWORD, GOMON_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type Card

type Card struct {
	// Unique identifier of the card.
	ID string `json:"id"`
	// Indicates if the card supports EMI.
	Emi bool `json:"emi"`
	// Name of the entity. Here, it is card.
	Entity string `json:"entity"`
	// Indicates if the card is international.
	International bool `json:"international"`
	// Card issuer code.
	Issuer string `json:"issuer"`
	// Last four digits of the card.
	Last4 string `json:"last4"`
	// Name on the card.
	Name string `json:"name"`
	// Card network.
	Network string `json:"network"`
	// Card sub type.
	SubType string `json:"sub_type"`
	// IIN of the tokenized card.
	TokenIin string `json:"token_iin,nullable"`
	// Card type.
	Type string `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		Emi           respjson.Field
		Entity        respjson.Field
		International respjson.Field
		Issuer        respjson.Field
		Last4         respjson.Field
		Name          respjson.Field
		Network       respjson.Field
		SubType       respjson.Field
		TokenIin      respjson.Field
		Type          respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Card) RawJSON

func (r Card) RawJSON() string

Returns the unmodified JSON received from the API

func (*Card) UnmarshalJSON

func (r *Card) UnmarshalJSON(data []byte) error

type Client

type Client struct {
	Options      []option.RequestOption
	Orders       OrderService
	Customers    CustomerService
	Payments     PaymentService
	PaymentLinks PaymentLinkService
	Refunds      RefundService
	Settlements  SettlementService
	Payouts      PayoutService
}

Client creates a struct with services and top level methods that help with interacting with the gomon API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (GOMON_USERNAME, GOMON_PASSWORD, GOMON_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type Customer

type Customer struct {
	// Unique identifier of the customer.
	ID string `json:"id"`
	// The customer's phone number. A maximum length of 15 characters including country
	// code.
	Contact string `json:"contact"`
	// UNIX timestamp, when the customer was created.
	CreatedAt int64 `json:"created_at"`
	// The customer's email address. A maximum length of 64 characters.
	Email string `json:"email"`
	// Indicates the type of entity.
	Entity string `json:"entity"`
	// GST number linked to the customer.
	Gstin string `json:"gstin,nullable"`
	// Customer's name. Alphanumeric, with period (.), apostrophe ('), forward slash
	// (/), at (@) and parentheses allowed. The name must be between 3-50 characters in
	// length.
	Name string `json:"name"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnion `json:"notes"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Contact     respjson.Field
		CreatedAt   respjson.Field
		Email       respjson.Field
		Entity      respjson.Field
		Gstin       respjson.Field
		Name        respjson.Field
		Notes       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Customer) RawJSON

func (r Customer) RawJSON() string

Returns the unmodified JSON received from the API

func (*Customer) UnmarshalJSON

func (r *Customer) UnmarshalJSON(data []byte) error

type CustomerListParams

type CustomerListParams struct {
	// The number of customer records to be retrieved from the system. The default
	// value is 10. The maximum value is 100. This can be used for pagination in
	// combination with skip.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// The number of customer records that must be skipped. The default value is 0.
	// This can be used for pagination in combination with count.
	Skip param.Opt[int64] `query:"skip,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CustomerListParams) URLQuery

func (r CustomerListParams) URLQuery() (v url.Values, err error)

URLQuery serializes CustomerListParams's query parameters as `url.Values`.

type CustomerListResponse

type CustomerListResponse struct {
	// The number of customer records returned in this response.
	Count int64 `json:"count"`
	// Indicates the type of entity. Always 'collection' for this response.
	Entity string `json:"entity"`
	// List of customer objects.
	Items []Customer `json:"items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Entity      respjson.Field
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CustomerListResponse) RawJSON

func (r CustomerListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*CustomerListResponse) UnmarshalJSON

func (r *CustomerListResponse) UnmarshalJSON(data []byte) error

type CustomerNewParams

type CustomerNewParams struct {
	// The customer's phone number. A maximum length of 15 characters including country
	// code.
	Contact string `json:"contact,required"`
	// The customer's email address. A maximum length of 64 characters.
	Email string `json:"email,required"`
	// Customer's name. Alphanumeric value with period (.), apostrophe ('), forward
	// slash (/), at (@) and parentheses are allowed. The name must be between 3-50
	// characters in length.
	Name string `json:"name,required"`
	// Possible values: false (fetches details of existing customer), true (default,
	// throws error if customer exists).
	FailExisting param.Opt[bool] `json:"fail_existing,omitzero"`
	// Customer's GST number, if available.
	Gstin param.Opt[string] `json:"gstin,omitzero"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnionParam `json:"notes,omitzero"`
	// contains filtered or unexported fields
}

func (CustomerNewParams) MarshalJSON

func (r CustomerNewParams) MarshalJSON() (data []byte, err error)

func (*CustomerNewParams) UnmarshalJSON

func (r *CustomerNewParams) UnmarshalJSON(data []byte) error

type CustomerService

type CustomerService struct {
	Options []option.RequestOption
}

CustomerService contains methods and other services that help with interacting with the gomon API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCustomerService method instead.

func NewCustomerService

func NewCustomerService(opts ...option.RequestOption) (r CustomerService)

NewCustomerService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CustomerService) Get

func (r *CustomerService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Customer, err error)

Use this endpoint to retrieve details of a customer with id. [See docs](https://razorpay.com/docs/api/customers/fetch-with-id/)

func (*CustomerService) List

Use this endpoint to retrieve the details of all the customers. [See docs](https://razorpay.com/docs/api/customers/fetch-all/)

func (*CustomerService) New

func (r *CustomerService) New(ctx context.Context, body CustomerNewParams, opts ...option.RequestOption) (res *Customer, err error)

Use this endpoint to create or add a customer with basic details such as name and contact details.

func (*CustomerService) Update

func (r *CustomerService) Update(ctx context.Context, id string, body CustomerUpdateParams, opts ...option.RequestOption) (res *Customer, err error)

Use this endpoint to edit the customer details such as name, email, and contact details. The combination of email and contact must be unique for every customer.

type CustomerUpdateParams

type CustomerUpdateParams struct {
	// The customer's phone number. A maximum length of 15 characters including country
	// code.
	Contact param.Opt[string] `json:"contact,omitzero"`
	// The customer's email address. A maximum length of 64 characters.
	Email param.Opt[string] `json:"email,omitzero"`
	// Customer's name. Alphanumeric, with period (.), apostrophe ('), forward slash
	// (/), at (@) and parentheses allowed. The name must be between 3-50 characters in
	// length.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (CustomerUpdateParams) MarshalJSON

func (r CustomerUpdateParams) MarshalJSON() (data []byte, err error)

func (*CustomerUpdateParams) UnmarshalJSON

func (r *CustomerUpdateParams) UnmarshalJSON(data []byte) error

type Error

type Error = apierror.Error

type NotesUnion

type NotesUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [[]string] instead of an object.
	OfStringArray []string `json:",inline"`
	JSON          struct {
		OfString      respjson.Field
		OfStringArray respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

NotesUnion contains all possible properties and values from [map[string]string], [[]string].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfStringArray]

func (NotesUnion) AsStringArray

func (u NotesUnion) AsStringArray() (v []string)

func (NotesUnion) AsStringMap

func (u NotesUnion) AsStringMap() (v map[string]string)

func (NotesUnion) RawJSON

func (u NotesUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (NotesUnion) ToParam

func (r NotesUnion) ToParam() NotesUnionParam

ToParam converts this NotesUnion to a NotesUnionParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with NotesUnionParam.Overrides()

func (*NotesUnion) UnmarshalJSON

func (r *NotesUnion) UnmarshalJSON(data []byte) error

type NotesUnionParam

type NotesUnionParam struct {
	OfStringMap   map[string]string `json:",omitzero,inline"`
	OfStringArray []string          `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (NotesUnionParam) MarshalJSON

func (u NotesUnionParam) MarshalJSON() ([]byte, error)

func (*NotesUnionParam) UnmarshalJSON

func (u *NotesUnionParam) UnmarshalJSON(data []byte) error

type Order

type Order struct {
	ID             string `json:"id"`
	Amount         int64  `json:"amount"`
	AmountDue      int64  `json:"amount_due"`
	AmountPaid     int64  `json:"amount_paid"`
	Attempts       int64  `json:"attempts"`
	CodFee         int64  `json:"cod_fee"`
	CreatedAt      int64  `json:"created_at"`
	Currency       string `json:"currency"`
	Entity         string `json:"entity"`
	LineItemsTotal int64  `json:"line_items_total"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes       NotesUnion `json:"notes"`
	OfferID     string     `json:"offer_id,nullable"`
	Receipt     string     `json:"receipt"`
	ShippingFee int64      `json:"shipping_fee"`
	Status      string     `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID             respjson.Field
		Amount         respjson.Field
		AmountDue      respjson.Field
		AmountPaid     respjson.Field
		Attempts       respjson.Field
		CodFee         respjson.Field
		CreatedAt      respjson.Field
		Currency       respjson.Field
		Entity         respjson.Field
		LineItemsTotal respjson.Field
		Notes          respjson.Field
		OfferID        respjson.Field
		Receipt        respjson.Field
		ShippingFee    respjson.Field
		Status         respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Order) RawJSON

func (r Order) RawJSON() string

Returns the unmodified JSON received from the API

func (*Order) UnmarshalJSON

func (r *Order) UnmarshalJSON(data []byte) error

type OrderFetchPaymentsParams

type OrderFetchPaymentsParams struct {
	// Use to expand the card or EMI details for each payment.
	//
	// Any of "card", "emi".
	Expand OrderFetchPaymentsParamsExpand `query:"expand[],omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (OrderFetchPaymentsParams) URLQuery

func (r OrderFetchPaymentsParams) URLQuery() (v url.Values, err error)

URLQuery serializes OrderFetchPaymentsParams's query parameters as `url.Values`.

type OrderFetchPaymentsParamsExpand

type OrderFetchPaymentsParamsExpand string

Use to expand the card or EMI details for each payment.

const (
	OrderFetchPaymentsParamsExpandCard OrderFetchPaymentsParamsExpand = "card"
	OrderFetchPaymentsParamsExpandEmi  OrderFetchPaymentsParamsExpand = "emi"
)

type OrderFetchPaymentsResponse

type OrderFetchPaymentsResponse struct {
	// Number of payments returned.
	Count int64 `json:"count"`
	// Name of the entity. Always 'collection'.
	Entity string `json:"entity"`
	// List of payment objects.
	Items []Payment `json:"items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Entity      respjson.Field
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OrderFetchPaymentsResponse) RawJSON

func (r OrderFetchPaymentsResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*OrderFetchPaymentsResponse) UnmarshalJSON

func (r *OrderFetchPaymentsResponse) UnmarshalJSON(data []byte) error

type OrderListParams

type OrderListParams struct {
	// The number of orders to be fetched. The default value is 10. The maximum value
	// is 100.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// Timestamp (in Unix format) from when the orders should be fetched.
	From param.Opt[int64] `query:"from,omitzero" json:"-"`
	// Retrieves the orders that contain the provided value for receipt.
	Receipt param.Opt[string] `query:"receipt,omitzero" json:"-"`
	// The number of orders to be skipped. The default value is 0.
	Skip param.Opt[int64] `query:"skip,omitzero" json:"-"`
	// Timestamp (in Unix format) up till when orders are to be fetched.
	To param.Opt[int64] `query:"to,omitzero" json:"-"`
	// Retrieves Orders for which payments have been authorized. Payment and order
	// states differ.
	//
	// Any of true, false.
	Authorized bool `query:"authorized,omitzero" json:"-"`
	// Used to retrieve additional information about the payment.
	//
	// Any of "payments", "payments.card", "transfers", "virtual_account".
	Expand []string `query:"expand,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (OrderListParams) URLQuery

func (r OrderListParams) URLQuery() (v url.Values, err error)

URLQuery serializes OrderListParams's query parameters as `url.Values`.

type OrderListResponse

type OrderListResponse struct {
	Count  int64   `json:"count"`
	Entity string  `json:"entity"`
	Items  []Order `json:"items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Entity      respjson.Field
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OrderListResponse) RawJSON

func (r OrderListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*OrderListResponse) UnmarshalJSON

func (r *OrderListResponse) UnmarshalJSON(data []byte) error

type OrderNewParams

type OrderNewParams struct {
	// Amount in the smallest currency unit (e.g., paise)
	Amount int64 `json:"amount,required"`
	// ISO currency code
	Currency string `json:"currency,required"`
	// Minimum amount for the first partial payment
	FirstPaymentMinAmount param.Opt[int64] `json:"first_payment_min_amount,omitzero"`
	// Unique identifier for the offer
	OfferID param.Opt[string] `json:"offer_id,omitzero"`
	// Allow partial payments
	PartialPayment param.Opt[bool] `json:"partial_payment,omitzero"`
	// Receipt number for internal reference
	Receipt param.Opt[string] `json:"receipt,omitzero"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnionParam `json:"notes,omitzero"`
	// contains filtered or unexported fields
}

func (OrderNewParams) MarshalJSON

func (r OrderNewParams) MarshalJSON() (data []byte, err error)

func (*OrderNewParams) UnmarshalJSON

func (r *OrderNewParams) UnmarshalJSON(data []byte) error

type OrderService

type OrderService struct {
	Options []option.RequestOption
}

OrderService contains methods and other services that help with interacting with the gomon API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewOrderService method instead.

func NewOrderService

func NewOrderService(opts ...option.RequestOption) (r OrderService)

NewOrderService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*OrderService) FetchPayments

func (r *OrderService) FetchPayments(ctx context.Context, id string, query OrderFetchPaymentsParams, opts ...option.RequestOption) (res *OrderFetchPaymentsResponse, err error)

Use this endpoint to retrieve all payments corresponding to a specific order. [See docs](https://razorpay.com/docs/api/payments/fetch-payments-orders)

func (*OrderService) Get

func (r *OrderService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Order, err error)

Fetch an order by its unique ID.

func (*OrderService) List

func (r *OrderService) List(ctx context.Context, query OrderListParams, opts ...option.RequestOption) (res *OrderListResponse, err error)

Use this endpoint to retrieve the details of all the orders you created.

func (*OrderService) New

func (r *OrderService) New(ctx context.Context, body OrderNewParams, opts ...option.RequestOption) (res *Order, err error)

Create a new order.

func (*OrderService) Update

func (r *OrderService) Update(ctx context.Context, id string, body OrderUpdateParams, opts ...option.RequestOption) (res *Order, err error)

Update an order's notes or other editable fields.

type OrderUpdateParams

type OrderUpdateParams struct {
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnionParam `json:"notes,omitzero"`
	// contains filtered or unexported fields
}

func (OrderUpdateParams) MarshalJSON

func (r OrderUpdateParams) MarshalJSON() (data []byte, err error)

func (*OrderUpdateParams) UnmarshalJSON

func (r *OrderUpdateParams) UnmarshalJSON(data []byte) error

type Payment

type Payment struct {
	// Unique identifier of the payment.
	ID string `json:"id"`
	// A dynamic array consisting of unique reference numbers.
	AcquirerData PaymentAcquirerData `json:"acquirer_data"`
	// The payment amount in currency subunits. For example, for an amount of ₹1.00
	// enter 100.
	Amount int64 `json:"amount"`
	// The amount refunded in currency subunits.
	AmountRefunded int64 `json:"amount_refunded"`
	// The 4-character bank code which the customer's account is associated with.
	Bank string `json:"bank,nullable"`
	// Indicates if the payment is captured.
	Captured bool `json:"captured"`
	// Details of the card used to make the payment. Present only if method is 'card'
	// and expand[]=card is used.
	Card Card `json:"card,nullable"`
	// The unique identifier of the card used by the customer to make the payment.
	CardID string `json:"card_id,nullable"`
	// Customer contact number used for the payment.
	Contact string `json:"contact"`
	// Timestamp, in UNIX format, on which the payment was created.
	CreatedAt int64 `json:"created_at"`
	// The currency in which the payment is made.
	Currency string `json:"currency"`
	// Description of the payment, if any.
	Description string `json:"description"`
	// Customer email address used for the payment.
	Email string `json:"email"`
	// Details of the EMI plan used to make the payment. Present only if method is
	// 'emi' and expand[]=emi is used.
	Emi PaymentEmi `json:"emi,nullable"`
	// Indicates the type of entity.
	Entity string `json:"entity"`
	// Error that occurred during payment.
	ErrorCode string `json:"error_code,nullable"`
	// Description of the error that occurred during payment.
	ErrorDescription string `json:"error_description,nullable"`
	// The exact error reason.
	ErrorReason string `json:"error_reason,nullable"`
	// The point of failure.
	ErrorSource string `json:"error_source,nullable"`
	// The stage where the transaction failure occurred.
	ErrorStep string `json:"error_step,nullable"`
	// Fee (including GST) charged by Razorpay.
	Fee int64 `json:"fee"`
	// Indicates whether the payment is done via an international card or a domestic
	// one.
	International bool `json:"international"`
	// Invoice id, if any.
	InvoiceID string `json:"invoice_id,nullable"`
	// The payment method used for making the payment.
	//
	// Any of "card", "netbanking", "wallet", "emi", "upi".
	Method PaymentMethod `json:"method"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnion `json:"notes"`
	// Order id, if provided.
	OrderID string `json:"order_id"`
	// The refund status of the payment.
	RefundStatus  string `json:"refund_status,nullable"`
	Reward        string `json:"reward,nullable"`
	SourceChannel string `json:"source_channel,nullable"`
	// The status of the payment.
	//
	// Any of "created", "authorized", "captured", "refunded", "failed".
	Status PaymentStatus `json:"status"`
	// GST charged for the payment.
	Tax int64 `json:"tax"`
	// The customer's VPA (Virtual Payment Address) or UPI id used to make the payment.
	Vpa string `json:"vpa,nullable"`
	// The name of the wallet used by the customer to make the payment.
	Wallet string `json:"wallet,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID               respjson.Field
		AcquirerData     respjson.Field
		Amount           respjson.Field
		AmountRefunded   respjson.Field
		Bank             respjson.Field
		Captured         respjson.Field
		Card             respjson.Field
		CardID           respjson.Field
		Contact          respjson.Field
		CreatedAt        respjson.Field
		Currency         respjson.Field
		Description      respjson.Field
		Email            respjson.Field
		Emi              respjson.Field
		Entity           respjson.Field
		ErrorCode        respjson.Field
		ErrorDescription respjson.Field
		ErrorReason      respjson.Field
		ErrorSource      respjson.Field
		ErrorStep        respjson.Field
		Fee              respjson.Field
		International    respjson.Field
		InvoiceID        respjson.Field
		Method           respjson.Field
		Notes            respjson.Field
		OrderID          respjson.Field
		RefundStatus     respjson.Field
		Reward           respjson.Field
		SourceChannel    respjson.Field
		Status           respjson.Field
		Tax              respjson.Field
		Vpa              respjson.Field
		Wallet           respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Payment) RawJSON

func (r Payment) RawJSON() string

Returns the unmodified JSON received from the API

func (*Payment) UnmarshalJSON

func (r *Payment) UnmarshalJSON(data []byte) error

type PaymentAcquirerData

type PaymentAcquirerData struct {
	Arn string `json:"arn"`
	// Bank transaction ID
	BankTransactionID string `json:"bank_transaction_id"`
	Rrn               string `json:"rrn"`
	// transaction ID
	TransactionID string `json:"transaction_id"`
	// Upi transaction ID
	UpiTransactionID string `json:"upi_transaction_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Arn               respjson.Field
		BankTransactionID respjson.Field
		Rrn               respjson.Field
		TransactionID     respjson.Field
		UpiTransactionID  respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A dynamic array consisting of unique reference numbers.

func (PaymentAcquirerData) RawJSON

func (r PaymentAcquirerData) RawJSON() string

Returns the unmodified JSON received from the API

func (*PaymentAcquirerData) UnmarshalJSON

func (r *PaymentAcquirerData) UnmarshalJSON(data []byte) error

type PaymentCaptureParams

type PaymentCaptureParams struct {
	// The amount to be captured.
	Amount param.Opt[int64] `json:"amount,omitzero"`
	// The currency in which the payment is made.
	Currency param.Opt[string] `json:"currency,omitzero"`
	// contains filtered or unexported fields
}

func (PaymentCaptureParams) MarshalJSON

func (r PaymentCaptureParams) MarshalJSON() (data []byte, err error)

func (*PaymentCaptureParams) UnmarshalJSON

func (r *PaymentCaptureParams) UnmarshalJSON(data []byte) error

type PaymentEmi

type PaymentEmi struct {
	// The duration of the EMI plan in months.
	Duration int64 `json:"duration"`
	// The bank code of the EMI issuer.
	Issuer string `json:"issuer"`
	// The interest rate (in basis points) for the EMI plan.
	Rate int64  `json:"rate"`
	Type string `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Duration    respjson.Field
		Issuer      respjson.Field
		Rate        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Details of the EMI plan used to make the payment. Present only if method is 'emi' and expand[]=emi is used.

func (PaymentEmi) RawJSON

func (r PaymentEmi) RawJSON() string

Returns the unmodified JSON received from the API

func (*PaymentEmi) UnmarshalJSON

func (r *PaymentEmi) UnmarshalJSON(data []byte) error

type PaymentGetParams

type PaymentGetParams struct {
	// Use to expand the card or EMI details when the payment method is 'card' or
	// 'emi'.
	//
	// Any of "card", "emi".
	Expand PaymentGetParamsExpand `query:"expand[],omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PaymentGetParams) URLQuery

func (r PaymentGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes PaymentGetParams's query parameters as `url.Values`.

type PaymentGetParamsExpand

type PaymentGetParamsExpand string

Use to expand the card or EMI details when the payment method is 'card' or 'emi'.

const (
	PaymentGetParamsExpandCard PaymentGetParamsExpand = "card"
	PaymentGetParamsExpandEmi  PaymentGetParamsExpand = "emi"
)

type PaymentGetRefundParams

type PaymentGetRefundParams struct {
	ID string `path:"id,required" json:"-"`
	// contains filtered or unexported fields
}
type PaymentLink struct {
	// Unique identifier of the Payment Link.
	ID string `json:"id"`
	// Indicates whether customers can make partial payments.
	AcceptPartial bool `json:"accept_partial"`
	// Amount to be paid using the Payment Link.
	Amount int64 `json:"amount"`
	// Amount paid by the customer.
	AmountPaid int64 `json:"amount_paid"`
	// Callback method.
	CallbackMethod string `json:"callback_method"`
	// Redirect URL after payment.
	CallbackURL string `json:"callback_url"`
	// Timestamp at which the Payment Link was cancelled.
	CancelledAt int64 `json:"cancelled_at"`
	// Timestamp when the Payment Link was created.
	CreatedAt int64 `json:"created_at"`
	// Currency code.
	Currency string `json:"currency"`
	// Customer details.
	Customer PaymentLinkCustomer `json:"customer"`
	// Description of the Payment Link.
	Description string `json:"description"`
	// Name of the entity. Always 'payment_link'.
	Entity string `json:"entity"`
	// Expiry timestamp.
	ExpireBy int64 `json:"expire_by"`
	// Timestamp at which the Payment Link expired.
	ExpiredAt int64 `json:"expired_at"`
	// Minimum amount for the first partial payment.
	FirstMinPartialAmount int64 `json:"first_min_partial_amount"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnion `json:"notes"`
	// Notification settings.
	Notify PaymentLinkNotify `json:"notify"`
	// Payment details such as amount, payment id, Payment Link id and more. This array
	// is populated only after a payment is made by the customer or if the payment
	// fails. Until then, the value is null.
	Payments []PaymentLinkPayment `json:"payments,nullable"`
	// Reference number tagged to a Payment Link.
	ReferenceID string `json:"reference_id"`
	// Used to send reminders for the Payment Link.
	ReminderEnable bool                      `json:"reminder_enable"`
	Reminders      PaymentLinkRemindersUnion `json:"reminders"`
	// The unique short URL generated for the Payment Link.
	ShortURL string `json:"short_url"`
	// Source of the Payment Link creation (if applicable).
	Source string `json:"source"`
	// Identifier for the source (if applicable).
	SourceID string `json:"source_id"`
	// Current state of the Payment Link.
	//
	// Any of "created", "partially_paid", "expired", "cancelled", "paid".
	Status PaymentLinkStatus `json:"status"`
	// Timestamp when the Payment Link was updated.
	UpdatedAt int64 `json:"updated_at"`
	// Unique identifier for the user role through which the Payment Link was created.
	UserID string `json:"user_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                    respjson.Field
		AcceptPartial         respjson.Field
		Amount                respjson.Field
		AmountPaid            respjson.Field
		CallbackMethod        respjson.Field
		CallbackURL           respjson.Field
		CancelledAt           respjson.Field
		CreatedAt             respjson.Field
		Currency              respjson.Field
		Customer              respjson.Field
		Description           respjson.Field
		Entity                respjson.Field
		ExpireBy              respjson.Field
		ExpiredAt             respjson.Field
		FirstMinPartialAmount respjson.Field
		Notes                 respjson.Field
		Notify                respjson.Field
		Payments              respjson.Field
		ReferenceID           respjson.Field
		ReminderEnable        respjson.Field
		Reminders             respjson.Field
		ShortURL              respjson.Field
		Source                respjson.Field
		SourceID              respjson.Field
		Status                respjson.Field
		UpdatedAt             respjson.Field
		UserID                respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PaymentLink) RawJSON

func (r PaymentLink) RawJSON() string

Returns the unmodified JSON received from the API

func (*PaymentLink) UnmarshalJSON

func (r *PaymentLink) UnmarshalJSON(data []byte) error

type PaymentLinkCustomer

type PaymentLinkCustomer struct {
	// Contact number of the customer.
	Contact string `json:"contact"`
	// Email address of the customer.
	Email string `json:"email"`
	// Name of the customer.
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Contact     respjson.Field
		Email       respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Customer details.

func (PaymentLinkCustomer) RawJSON

func (r PaymentLinkCustomer) RawJSON() string

Returns the unmodified JSON received from the API

func (*PaymentLinkCustomer) UnmarshalJSON

func (r *PaymentLinkCustomer) UnmarshalJSON(data []byte) error

type PaymentLinkListParams

type PaymentLinkListParams struct {
	// Unique identifier of the payment associated with the Payment Link.
	PaymentID param.Opt[string] `query:"payment_id,omitzero" json:"-"`
	// The unique reference number entered while creating the Payment Link.
	ReferenceID param.Opt[string] `query:"reference_id,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PaymentLinkListParams) URLQuery

func (r PaymentLinkListParams) URLQuery() (v url.Values, err error)

URLQuery serializes PaymentLinkListParams's query parameters as `url.Values`.

type PaymentLinkListResponse

type PaymentLinkListResponse struct {
	// List of Payment Links.
	PaymentLinks []PaymentLink `json:"payment_links"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		PaymentLinks respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PaymentLinkListResponse) RawJSON

func (r PaymentLinkListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PaymentLinkListResponse) UnmarshalJSON

func (r *PaymentLinkListResponse) UnmarshalJSON(data []byte) error

type PaymentLinkNewParams

type PaymentLinkNewParams struct {
	// Amount to be paid using the Payment Link. Must be in the smallest unit of the
	// currency.
	Amount int64 `json:"amount,required"`
	// A three-letter ISO code for the currency in which you want to accept the
	// payment.
	Currency string `json:"currency,required"`
	// Indicates whether customers can make partial payments using the Payment Link.Not
	// allowed for UPI Payment Links.
	AcceptPartial param.Opt[bool] `json:"accept_partial,omitzero"`
	// If callback_url parameter is passed, callback_method must be passed with the
	// value get.
	CallbackMethod param.Opt[string] `json:"callback_method,omitzero"`
	// If specified, adds a redirect URL to the Payment Link.
	CallbackURL param.Opt[string] `json:"callback_url,omitzero"`
	// A brief description of the Payment Link. Max 2048 characters.
	Description param.Opt[string] `json:"description,omitzero"`
	// Timestamp, in Unix, at which the Payment Link will expire.
	ExpireBy param.Opt[int64] `json:"expire_by,omitzero"`
	// Minimum amount, in currency subunits, that must be paid by the customer as the
	// first partial payment. Must be passed along with accept_partial.
	FirstMinPartialAmount param.Opt[int64] `json:"first_min_partial_amount,omitzero"`
	// Reference number tagged to a Payment Link. Must be unique for each Payment Link.
	// Max 40 characters.
	ReferenceID param.Opt[string] `json:"reference_id,omitzero"`
	// Used to send reminders for the Payment Link.
	ReminderEnable param.Opt[bool] `json:"reminder_enable,omitzero"`
	// Must be set to true for creating a UPI Payment Link. If not passed or false, a
	// Standard Payment Link will be created.
	UpiLink param.Opt[bool] `json:"upi_link,omitzero"`
	// Customer details.
	Customer PaymentLinkNewParamsCustomer `json:"customer,omitzero"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnionParam `json:"notes,omitzero"`
	// Defines who handles Payment Link notification.
	Notify PaymentLinkNewParamsNotify `json:"notify,omitzero"`
	// contains filtered or unexported fields
}

func (PaymentLinkNewParams) MarshalJSON

func (r PaymentLinkNewParams) MarshalJSON() (data []byte, err error)

func (*PaymentLinkNewParams) UnmarshalJSON

func (r *PaymentLinkNewParams) UnmarshalJSON(data []byte) error

type PaymentLinkNewParamsCustomer

type PaymentLinkNewParamsCustomer struct {
	// Contact number of the customer.
	Contact param.Opt[string] `json:"contact,omitzero"`
	// Email address of the customer.
	Email param.Opt[string] `json:"email,omitzero"`
	// Name of the customer.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

Customer details.

func (PaymentLinkNewParamsCustomer) MarshalJSON

func (r PaymentLinkNewParamsCustomer) MarshalJSON() (data []byte, err error)

func (*PaymentLinkNewParamsCustomer) UnmarshalJSON

func (r *PaymentLinkNewParamsCustomer) UnmarshalJSON(data []byte) error

type PaymentLinkNewParamsNotify

type PaymentLinkNewParamsNotify struct {
	// Send email notification.
	Email param.Opt[bool] `json:"email,omitzero"`
	// Send SMS notification.
	SMS param.Opt[bool] `json:"sms,omitzero"`
	// contains filtered or unexported fields
}

Defines who handles Payment Link notification.

func (PaymentLinkNewParamsNotify) MarshalJSON

func (r PaymentLinkNewParamsNotify) MarshalJSON() (data []byte, err error)

func (*PaymentLinkNewParamsNotify) UnmarshalJSON

func (r *PaymentLinkNewParamsNotify) UnmarshalJSON(data []byte) error

type PaymentLinkNotify

type PaymentLinkNotify struct {
	// Email notification enabled.
	Email bool `json:"email"`
	// SMS notification enabled.
	SMS bool `json:"sms"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Email       respjson.Field
		SMS         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Notification settings.

func (PaymentLinkNotify) RawJSON

func (r PaymentLinkNotify) RawJSON() string

Returns the unmodified JSON received from the API

func (*PaymentLinkNotify) UnmarshalJSON

func (r *PaymentLinkNotify) UnmarshalJSON(data []byte) error

type PaymentLinkNotifyParams

type PaymentLinkNotifyParams struct {
	ID string `path:"id,required" json:"-"`
	// contains filtered or unexported fields
}

type PaymentLinkNotifyParamsMedium

type PaymentLinkNotifyParamsMedium string
const (
	PaymentLinkNotifyParamsMediumSMS   PaymentLinkNotifyParamsMedium = "sms"
	PaymentLinkNotifyParamsMediumEmail PaymentLinkNotifyParamsMedium = "email"
)

type PaymentLinkNotifyResponse

type PaymentLinkNotifyResponse struct {
	// Indicates whether the notification was sent successfully.
	Success bool `json:"success"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PaymentLinkNotifyResponse) RawJSON

func (r PaymentLinkNotifyResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PaymentLinkNotifyResponse) UnmarshalJSON

func (r *PaymentLinkNotifyResponse) UnmarshalJSON(data []byte) error

type PaymentLinkPayment

type PaymentLinkPayment struct {
	// The amount paid by the customer using the Payment Link.
	Amount int64 `json:"amount"`
	// Timestamp, in Unix, indicating when the payment was made.
	CreatedAt int64 `json:"created_at"`
	// The payment method used to make the payment.
	//
	// Any of "netbanking", "card", "wallet", "upi", "emi", "bank_transfer".
	Method string `json:"method"`
	// Unique identifier of the payment made against the Payment Link.
	PaymentID string `json:"payment_id"`
	// Unique identifier of the Payment Link.
	PlinkID string `json:"plink_id"`
	// The payment state.
	Status string `json:"status"`
	// Timestamp, in Unix, indicating when the payment was updated.
	UpdatedAt int64 `json:"updated_at"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount      respjson.Field
		CreatedAt   respjson.Field
		Method      respjson.Field
		PaymentID   respjson.Field
		PlinkID     respjson.Field
		Status      respjson.Field
		UpdatedAt   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PaymentLinkPayment) RawJSON

func (r PaymentLinkPayment) RawJSON() string

Returns the unmodified JSON received from the API

func (*PaymentLinkPayment) UnmarshalJSON

func (r *PaymentLinkPayment) UnmarshalJSON(data []byte) error

type PaymentLinkRemindersUnion

type PaymentLinkRemindersUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [[]string] instead of an object.
	OfStringArray []string `json:",inline"`
	JSON          struct {
		OfString      respjson.Field
		OfStringArray respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

PaymentLinkRemindersUnion contains all possible properties and values from [map[string]string], [[]string].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfStringArray]

func (PaymentLinkRemindersUnion) AsStringArray

func (u PaymentLinkRemindersUnion) AsStringArray() (v []string)

func (PaymentLinkRemindersUnion) AsStringMap

func (u PaymentLinkRemindersUnion) AsStringMap() (v map[string]string)

func (PaymentLinkRemindersUnion) RawJSON

func (u PaymentLinkRemindersUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*PaymentLinkRemindersUnion) UnmarshalJSON

func (r *PaymentLinkRemindersUnion) UnmarshalJSON(data []byte) error

type PaymentLinkService

type PaymentLinkService struct {
	Options []option.RequestOption
}

PaymentLinkService contains methods and other services that help with interacting with the gomon API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPaymentLinkService method instead.

func NewPaymentLinkService

func NewPaymentLinkService(opts ...option.RequestOption) (r PaymentLinkService)

NewPaymentLinkService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*PaymentLinkService) Get

func (r *PaymentLinkService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *PaymentLink, err error)

Use this endpoint to retrieve the details of a Payment Link using its id. [See docs](https://razorpay.com/docs/api/payments/payment-links/fetch-id-standard/)

func (*PaymentLinkService) List

Use this endpoint to retrieve the details of all Payment Links. To get only UPI Payment Links, filter the response objects where `upi_link` is `true`. [See docs](https://razorpay.com/docs/api/payments/payment-links/fetch-all-upi)

func (*PaymentLinkService) New

Use this endpoint to create a Payment Link using basic details such as amount, expiry date, reference id, description, customer details and so on. [See docs](https://razorpay.com/docs/api/payments/payment-links/create-standard/)

func (*PaymentLinkService) Notify

Use this endpoint to send or resend notifications to your customers via email or SMS. [See docs](https://razorpay.com/docs/api/payments/payment-links/resend/)

func (*PaymentLinkService) Update

Use this endpoint to edit the Standard Payment Link details such as the reference id, expiry date, enabling reminders and so on. [See docs](https://razorpay.com/docs/api/payments/payment-links/update-standard)

type PaymentLinkStatus

type PaymentLinkStatus string

Current state of the Payment Link.

const (
	PaymentLinkStatusCreated       PaymentLinkStatus = "created"
	PaymentLinkStatusPartiallyPaid PaymentLinkStatus = "partially_paid"
	PaymentLinkStatusExpired       PaymentLinkStatus = "expired"
	PaymentLinkStatusCancelled     PaymentLinkStatus = "cancelled"
	PaymentLinkStatusPaid          PaymentLinkStatus = "paid"
)

type PaymentLinkUpdateParams

type PaymentLinkUpdateParams struct {
	// Indicates whether customers can make partial payments. Not allowed for UPI
	// Payment Links.
	AcceptPartial param.Opt[bool] `json:"accept_partial,omitzero"`
	// Unix timestamp when the payment link should expire.
	ExpireBy param.Opt[int64] `json:"expire_by,omitzero"`
	// Adds a unique reference number to an existing link.
	ReferenceID param.Opt[string] `json:"reference_id,omitzero"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnionParam `json:"notes,omitzero"`
	// contains filtered or unexported fields
}

func (PaymentLinkUpdateParams) MarshalJSON

func (r PaymentLinkUpdateParams) MarshalJSON() (data []byte, err error)

func (*PaymentLinkUpdateParams) UnmarshalJSON

func (r *PaymentLinkUpdateParams) UnmarshalJSON(data []byte) error

type PaymentListParams

type PaymentListParams struct {
	// Number of payments to be fetched. Default is 10. Maximum is 100.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// UNIX timestamp, in seconds, from when payments are to be fetched.
	From param.Opt[int64] `query:"from,omitzero" json:"-"`
	// Number of records to be skipped while fetching the payments.
	Skip param.Opt[int64] `query:"skip,omitzero" json:"-"`
	// UNIX timestamp, in seconds, till when payments are to be fetched.
	To param.Opt[int64] `query:"to,omitzero" json:"-"`
	// Use to expand the card or EMI details for each payment.
	//
	// Any of "card", "emi".
	Expand PaymentListParamsExpand `query:"expand[],omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PaymentListParams) URLQuery

func (r PaymentListParams) URLQuery() (v url.Values, err error)

URLQuery serializes PaymentListParams's query parameters as `url.Values`.

type PaymentListParamsExpand

type PaymentListParamsExpand string

Use to expand the card or EMI details for each payment.

const (
	PaymentListParamsExpandCard PaymentListParamsExpand = "card"
	PaymentListParamsExpandEmi  PaymentListParamsExpand = "emi"
)

type PaymentListRefundsParams

type PaymentListRefundsParams struct {
	// The number of refunds to fetch for the payment. Maximum is 100.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// UNIX timestamp at which the refunds were created.
	From param.Opt[int64] `query:"from,omitzero" json:"-"`
	// The number of refunds to be skipped for the payment.
	Skip param.Opt[int64] `query:"skip,omitzero" json:"-"`
	// UNIX timestamp till which the refunds were created.
	To param.Opt[int64] `query:"to,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PaymentListRefundsParams) URLQuery

func (r PaymentListRefundsParams) URLQuery() (v url.Values, err error)

URLQuery serializes PaymentListRefundsParams's query parameters as `url.Values`.

type PaymentListResponse

type PaymentListResponse struct {
	// Number of payments returned.
	Count int64 `json:"count"`
	// Name of the entity. Always 'collection'.
	Entity string `json:"entity"`
	// List of payment objects.
	Items []Payment `json:"items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Entity      respjson.Field
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PaymentListResponse) RawJSON

func (r PaymentListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PaymentListResponse) UnmarshalJSON

func (r *PaymentListResponse) UnmarshalJSON(data []byte) error

type PaymentMethod

type PaymentMethod string

The payment method used for making the payment.

const (
	PaymentMethodCard       PaymentMethod = "card"
	PaymentMethodNetbanking PaymentMethod = "netbanking"
	PaymentMethodWallet     PaymentMethod = "wallet"
	PaymentMethodEmi        PaymentMethod = "emi"
	PaymentMethodUpi        PaymentMethod = "upi"
)

type PaymentNewRefundParams

type PaymentNewRefundParams struct {
	// The amount to be refunded. Amount should be in the smallest unit of the currency
	// in which the payment was made. Required in case of partial refund.
	Amount param.Opt[int64] `json:"amount,omitzero"`
	// A unique identifier provided by you for your internal reference.
	Receipt param.Opt[string] `json:"receipt,omitzero"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnionParam `json:"notes,omitzero"`
	// Indicates that the refund will be processed at an optimal speed based on
	// Razorpay's internal fund transfer logic. Must be 'optimum'.
	//
	// Any of "optimum".
	Speed PaymentNewRefundParamsSpeed `json:"speed,omitzero"`
	// contains filtered or unexported fields
}

func (PaymentNewRefundParams) MarshalJSON

func (r PaymentNewRefundParams) MarshalJSON() (data []byte, err error)

func (*PaymentNewRefundParams) UnmarshalJSON

func (r *PaymentNewRefundParams) UnmarshalJSON(data []byte) error

type PaymentNewRefundParamsSpeed

type PaymentNewRefundParamsSpeed string

Indicates that the refund will be processed at an optimal speed based on Razorpay's internal fund transfer logic. Must be 'optimum'.

const (
	PaymentNewRefundParamsSpeedOptimum PaymentNewRefundParamsSpeed = "optimum"
)

type PaymentQrCodeGetParams

type PaymentQrCodeGetParams struct {
	// The unique identifier of the payment whose QR Codes are to be fetched.
	PaymentID string `query:"payment_id,required" json:"-"`
	// contains filtered or unexported fields
}

func (PaymentQrCodeGetParams) URLQuery

func (r PaymentQrCodeGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes PaymentQrCodeGetParams's query parameters as `url.Values`.

type PaymentQrCodeListParams

type PaymentQrCodeListParams struct {
	// Number of QR Codes to be fetched. Default is 10. Maximum is 100.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// The unique identifier of the customer whose QR Codes are to be fetched.
	CustomerID param.Opt[string] `query:"customer_id,omitzero" json:"-"`
	// UNIX timestamp, in seconds, from when QR Codes are to be fetched.
	From param.Opt[int64] `query:"from,omitzero" json:"-"`
	// The unique identifier of the payment whose QR Codes are to be fetched.
	PaymentID param.Opt[string] `query:"payment_id,omitzero" json:"-"`
	// Number of records to be skipped while fetching the QR Codes.
	Skip param.Opt[int64] `query:"skip,omitzero" json:"-"`
	// UNIX timestamp, in seconds, till when QR Codes are to be fetched.
	To param.Opt[int64] `query:"to,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PaymentQrCodeListParams) URLQuery

func (r PaymentQrCodeListParams) URLQuery() (v url.Values, err error)

URLQuery serializes PaymentQrCodeListParams's query parameters as `url.Values`.

type PaymentQrCodeNewParams

type PaymentQrCodeNewParams struct {
	// Indicates if the QR should accept payments of specific amounts or any amount.
	FixedAmount bool `json:"fixed_amount,required"`
	// The type of the QR Code. Only 'upi_qr' is supported.
	//
	// Any of "upi_qr".
	Type PaymentQrCodeNewParamsType `json:"type,omitzero,required"`
	// Indicates if the QR Code should accept single or multiple payments.
	//
	// Any of "single_use", "multiple_use".
	Usage PaymentQrCodeNewParamsUsage `json:"usage,omitzero,required"`
	// Unix timestamp at which the QR Code is scheduled to be automatically closed.
	CloseBy param.Opt[int64] `json:"close_by,omitzero"`
	// The unique identifier of the customer the QR Code is linked with.
	CustomerID param.Opt[string] `json:"customer_id,omitzero"`
	// A brief description about the QR Code.
	Description param.Opt[string] `json:"description,omitzero"`
	// Label entered to identify the QR Code.
	Name param.Opt[string] `json:"name,omitzero"`
	// The amount allowed for a transaction (in the smallest currency unit).
	PaymentAmount param.Opt[int64] `json:"payment_amount,omitzero"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnionParam `json:"notes,omitzero"`
	// contains filtered or unexported fields
}

func (PaymentQrCodeNewParams) MarshalJSON

func (r PaymentQrCodeNewParams) MarshalJSON() (data []byte, err error)

func (*PaymentQrCodeNewParams) UnmarshalJSON

func (r *PaymentQrCodeNewParams) UnmarshalJSON(data []byte) error

type PaymentQrCodeNewParamsType

type PaymentQrCodeNewParamsType string

The type of the QR Code. Only 'upi_qr' is supported.

const (
	PaymentQrCodeNewParamsTypeUpiQr PaymentQrCodeNewParamsType = "upi_qr"
)

type PaymentQrCodeNewParamsUsage

type PaymentQrCodeNewParamsUsage string

Indicates if the QR Code should accept single or multiple payments.

const (
	PaymentQrCodeNewParamsUsageSingleUse   PaymentQrCodeNewParamsUsage = "single_use"
	PaymentQrCodeNewParamsUsageMultipleUse PaymentQrCodeNewParamsUsage = "multiple_use"
)

type PaymentQrCodeService

type PaymentQrCodeService struct {
	Options []option.RequestOption
}

PaymentQrCodeService contains methods and other services that help with interacting with the gomon API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPaymentQrCodeService method instead.

func NewPaymentQrCodeService

func NewPaymentQrCodeService(opts ...option.RequestOption) (r PaymentQrCodeService)

NewPaymentQrCodeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*PaymentQrCodeService) Close

func (r *PaymentQrCodeService) Close(ctx context.Context, id string, opts ...option.RequestOption) (res *QrCode, err error)

Use this endpoint to close a QR Code. [See docs](https://razorpay.com/docs/api/qr-codes/close/)

func (*PaymentQrCodeService) Get

Use this endpoint to retrieve the details of a QR Code by using a Payment Id. [See docs](https://razorpay.com/docs/api/qr-codes/fetch-payment-id/)

func (*PaymentQrCodeService) List

Use this endpoint to retrieve details of all QR Codes. By default, only the last 10 QR Codes are returned. You can use count and skip query parameters to change that behaviour. You can also filter QR Codes by customer_id. [See docs](https://razorpay.com/docs/api/qr-codes/fetch-customer-id)

func (*PaymentQrCodeService) New

Use this endpoint to create a QR Code. You can share the short URL with customers to accept payments, print, and download it. [See docs](https://razorpay.com/docs/api/qr-codes/create/)

type PaymentRefundService

type PaymentRefundService struct {
	Options []option.RequestOption
}

PaymentRefundService contains methods and other services that help with interacting with the gomon API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPaymentRefundService method instead.

func NewPaymentRefundService

func NewPaymentRefundService(opts ...option.RequestOption) (r PaymentRefundService)

NewPaymentRefundService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type PaymentService

type PaymentService struct {
	Options []option.RequestOption
	QrCodes PaymentQrCodeService
	Refunds PaymentRefundService
}

PaymentService contains methods and other services that help with interacting with the gomon API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPaymentService method instead.

func NewPaymentService

func NewPaymentService(opts ...option.RequestOption) (r PaymentService)

NewPaymentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*PaymentService) Capture

func (r *PaymentService) Capture(ctx context.Context, id string, body PaymentCaptureParams, opts ...option.RequestOption) (res *Payment, err error)

Use this endpoint to change the payment status from authorized to captured. Attempting to capture a payment whose status is not authorized will produce an error. [See docs](https://razorpay.com/docs/api/payments/capture/)

func (*PaymentService) Get

func (r *PaymentService) Get(ctx context.Context, id string, query PaymentGetParams, opts ...option.RequestOption) (res *Payment, err error)

Use this endpoint to retrieve the details of a specific payment using its id. You can expand the card or EMI details by passing the query parameter `expand[]=card` or `expand[]=emi`. [See docs for card](https://razorpay.com/docs/api/payments/fetch-payment-expanded-card) [See docs for EMI](https://razorpay.com/docs/api/payments/fetch-payment-expanded-emi)

func (*PaymentService) GetCardDetails

func (r *PaymentService) GetCardDetails(ctx context.Context, id string, opts ...option.RequestOption) (res *Card, err error)

Use this endpoint to retrieve the details of the card used to make a payment. [See docs](https://razorpay.com/docs/api/payments/fetch-card-details-payment)

func (*PaymentService) GetRefund

func (r *PaymentService) GetRefund(ctx context.Context, refundID string, query PaymentGetRefundParams, opts ...option.RequestOption) (res *Refund, err error)

Use this endpoint to retrieve details of a specific refund made for a payment. [See docs](https://razorpay.com/docs/api/refunds/fetch-specific-refund-payment)

func (*PaymentService) List

Use this endpoint to retrieve details of all the payments. By default, only the last 10 records are displayed. You can use the `count` and `skip` parameters to retrieve the specific number of records that you need. You can also expand card or EMI details using `expand[]=card` or `expand[]=emi`. [See docs](https://razorpay.com/docs/api/payments/fetch-all-payments)

func (*PaymentService) ListRefunds

func (r *PaymentService) ListRefunds(ctx context.Context, id string, query PaymentListRefundsParams, opts ...option.RequestOption) (res *RefundList, err error)

Use this endpoint to retrieve multiple refunds for a payment. By default, only the last 10 refunds are returned. You can use count and skip query parameters to change that behaviour. [See docs](https://razorpay.com/docs/api/refunds/fetch-multiple-refund-payment)

func (*PaymentService) NewRefund

func (r *PaymentService) NewRefund(ctx context.Context, id string, body PaymentNewRefundParams, opts ...option.RequestOption) (res *Refund, err error)

Use this endpoint to process refunds instantaneously to your customers. The instant refund is enabled by default for your account. You should set the refund speed to `optimum` when creating a refund request to ensure refunds are processed instantly. [See docs](https://razorpay.com/docs/api/refunds/create-instant/)

func (*PaymentService) Update

func (r *PaymentService) Update(ctx context.Context, id string, body PaymentUpdateParams, opts ...option.RequestOption) (res *Payment, err error)

Use this endpoint to update the `notes` field for a particular payment. Only the `notes` field can be updated. You can add up to 15 key-value pairs, each value not exceeding 256 characters. [See docs](https://razorpay.com/docs/api/payments/update)

type PaymentStatus

type PaymentStatus string

The status of the payment.

const (
	PaymentStatusCreated    PaymentStatus = "created"
	PaymentStatusAuthorized PaymentStatus = "authorized"
	PaymentStatusCaptured   PaymentStatus = "captured"
	PaymentStatusRefunded   PaymentStatus = "refunded"
	PaymentStatusFailed     PaymentStatus = "failed"
)

type PaymentUpdateParams

type PaymentUpdateParams struct {
	// Contains user-defined fields, stored for reference purposes. Maximum 15
	// key-value pairs, 256 characters each.
	Notes PaymentUpdateParamsNotesUnion `json:"notes,omitzero,required"`
	// contains filtered or unexported fields
}

func (PaymentUpdateParams) MarshalJSON

func (r PaymentUpdateParams) MarshalJSON() (data []byte, err error)

func (*PaymentUpdateParams) UnmarshalJSON

func (r *PaymentUpdateParams) UnmarshalJSON(data []byte) error

type PaymentUpdateParamsNotesUnion

type PaymentUpdateParamsNotesUnion struct {
	OfStringMap   map[string]string `json:",omitzero,inline"`
	OfStringArray []string          `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (PaymentUpdateParamsNotesUnion) MarshalJSON

func (u PaymentUpdateParamsNotesUnion) MarshalJSON() ([]byte, error)

func (*PaymentUpdateParamsNotesUnion) UnmarshalJSON

func (u *PaymentUpdateParamsNotesUnion) UnmarshalJSON(data []byte) error

type Payout

type Payout struct {
	// The unique identifier of the payout.
	ID string `json:"id"`
	// The payout amount, in paise. The value does not include fees and tax. Fees and
	// tax, if any, are deducted from your account balance.
	Amount int64 `json:"amount"`
	// This value is returned if the contact was created as part of a bulk upload.
	BatchID string `json:"batch_id,nullable"`
	// Indicates the Unix timestamp when this payout was created.
	CreatedAt int64 `json:"created_at"`
	// The payout's currency. Here, it is INR.
	Currency string `json:"currency"`
	// The entity being created. Here, it will be payout.
	Entity string `json:"entity"`
	// Indicates the fee type charged for the payout. Possible value is free_payout.
	FeeType string `json:"fee_type"`
	// The fees for the payout. This value is returned only when the payout moves to
	// the processing state.
	Fees int64 `json:"fees"`
	// The unique identifier linked to the fund account.
	FundAccountID string `json:"fund_account_id"`
	// The mode used to make the payout.
	//
	// Any of "NEFT", "RTGS", "IMPS", "card", "UPI", "amazonpay".
	Mode PayoutMode `json:"mode"`
	// Custom note that also appears on the bank statement. Maximum length 30
	// characters.
	Narration string `json:"narration"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnion `json:"notes"`
	// The purpose of the payout that is being created.
	Purpose string `json:"purpose"`
	// A user-generated reference given to the payout. Maximum length is 40 characters.
	ReferenceID string `json:"reference_id"`
	// The payout status.
	//
	// Any of "queued", "pending", "rejected", "processing", "processed", "cancelled",
	// "reversed", "failed".
	Status PayoutStatus `json:"status"`
	// This parameter returns the current status of the payout.
	StatusDetails PayoutStatusDetails `json:"status_details"`
	// The tax that is applicable for the fee being charged. This value is returned
	// only when the payout moves to the processing state.
	Tax int64 `json:"tax"`
	// The unique transaction number linked to a payout.
	Utr string `json:"utr,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		Amount        respjson.Field
		BatchID       respjson.Field
		CreatedAt     respjson.Field
		Currency      respjson.Field
		Entity        respjson.Field
		FeeType       respjson.Field
		Fees          respjson.Field
		FundAccountID respjson.Field
		Mode          respjson.Field
		Narration     respjson.Field
		Notes         respjson.Field
		Purpose       respjson.Field
		ReferenceID   respjson.Field
		Status        respjson.Field
		StatusDetails respjson.Field
		Tax           respjson.Field
		Utr           respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Payout) RawJSON

func (r Payout) RawJSON() string

Returns the unmodified JSON received from the API

func (*Payout) UnmarshalJSON

func (r *Payout) UnmarshalJSON(data []byte) error

type PayoutListParams

type PayoutListParams struct {
	// The account from which the payouts were done. For example, 7878780080316316.
	AccountNumber string `query:"account_number,required" json:"-"`
	// The unique identifier of the contact for which you want to fetch payouts.
	ContactID param.Opt[string] `query:"contact_id,omitzero" json:"-"`
	// Number of payouts to be fetched. Default value is 10. Maximum value is 100.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// Timestamp, in Unix, from when you want to fetch payouts.
	From param.Opt[int64] `query:"from,omitzero" json:"-"`
	// The unique identifier of the fund account for which you want to fetch payouts.
	FundAccountID param.Opt[string] `query:"fund_account_id,omitzero" json:"-"`
	// The user-generated reference for which payouts are to be fetched. Maximum length
	// is 40 characters.
	ReferenceID param.Opt[string] `query:"reference_id,omitzero" json:"-"`
	// Numbers of payouts to be skipped. Default value is 0.
	Skip param.Opt[int64] `query:"skip,omitzero" json:"-"`
	// Timestamp, in Unix, till when you want to fetch payouts.
	To param.Opt[int64] `query:"to,omitzero" json:"-"`
	// The mode for which payouts are to be fetched. You can use one of the following
	// payout modes NEFT, RTGS, IMPS, UPI, card, amazonpay.
	//
	// Any of "NEFT", "RTGS", "IMPS", "UPI", "card", "amazonpay".
	Mode PayoutListParamsMode `query:"mode,omitzero" json:"-"`
	// The payout status. Possible payout states queued, pending, rejected, processing,
	// processed, cancelled, reversed, failed.
	//
	// Any of "queued", "pending", "rejected", "processing", "processed", "cancelled",
	// "reversed", "failed".
	Status PayoutListParamsStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PayoutListParams) URLQuery

func (r PayoutListParams) URLQuery() (v url.Values, err error)

URLQuery serializes PayoutListParams's query parameters as `url.Values`.

type PayoutListParamsMode

type PayoutListParamsMode string

The mode for which payouts are to be fetched. You can use one of the following payout modes NEFT, RTGS, IMPS, UPI, card, amazonpay.

const (
	PayoutListParamsModeNeft      PayoutListParamsMode = "NEFT"
	PayoutListParamsModeRtgs      PayoutListParamsMode = "RTGS"
	PayoutListParamsModeImps      PayoutListParamsMode = "IMPS"
	PayoutListParamsModeUpi       PayoutListParamsMode = "UPI"
	PayoutListParamsModeCard      PayoutListParamsMode = "card"
	PayoutListParamsModeAmazonpay PayoutListParamsMode = "amazonpay"
)

type PayoutListParamsStatus

type PayoutListParamsStatus string

The payout status. Possible payout states queued, pending, rejected, processing, processed, cancelled, reversed, failed.

const (
	PayoutListParamsStatusQueued     PayoutListParamsStatus = "queued"
	PayoutListParamsStatusPending    PayoutListParamsStatus = "pending"
	PayoutListParamsStatusRejected   PayoutListParamsStatus = "rejected"
	PayoutListParamsStatusProcessing PayoutListParamsStatus = "processing"
	PayoutListParamsStatusProcessed  PayoutListParamsStatus = "processed"
	PayoutListParamsStatusCancelled  PayoutListParamsStatus = "cancelled"
	PayoutListParamsStatusReversed   PayoutListParamsStatus = "reversed"
	PayoutListParamsStatusFailed     PayoutListParamsStatus = "failed"
)

type PayoutListResponse

type PayoutListResponse struct {
	// Number of payouts returned.
	Count int64 `json:"count"`
	// Name of the entity. Always collection.
	Entity string `json:"entity"`
	// List of payout objects.
	Items []Payout `json:"items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Entity      respjson.Field
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PayoutListResponse) RawJSON

func (r PayoutListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PayoutListResponse) UnmarshalJSON

func (r *PayoutListResponse) UnmarshalJSON(data []byte) error

type PayoutMode

type PayoutMode string

The mode used to make the payout.

const (
	PayoutModeNeft      PayoutMode = "NEFT"
	PayoutModeRtgs      PayoutMode = "RTGS"
	PayoutModeImps      PayoutMode = "IMPS"
	PayoutModeCard      PayoutMode = "card"
	PayoutModeUpi       PayoutMode = "UPI"
	PayoutModeAmazonpay PayoutMode = "amazonpay"
)

type PayoutService

type PayoutService struct {
	Options []option.RequestOption
}

PayoutService contains methods and other services that help with interacting with the gomon API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPayoutService method instead.

func NewPayoutService

func NewPayoutService(opts ...option.RequestOption) (r PayoutService)

NewPayoutService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*PayoutService) Get

func (r *PayoutService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Payout, err error)

Use this endpoint to retrieve the details of a particular payout in the system. [See docs](https://razorpay.com/docs/api/x/payouts/fetch-with-id)

func (*PayoutService) List

func (r *PayoutService) List(ctx context.Context, query PayoutListParams, opts ...option.RequestOption) (res *PayoutListResponse, err error)

Use this endpoint to retrieve the details of all the available payouts in the system. [See docs](https://razorpay.com/docs/api/x/payouts/fetch-all/)

type PayoutStatus

type PayoutStatus string

The payout status.

const (
	PayoutStatusQueued     PayoutStatus = "queued"
	PayoutStatusPending    PayoutStatus = "pending"
	PayoutStatusRejected   PayoutStatus = "rejected"
	PayoutStatusProcessing PayoutStatus = "processing"
	PayoutStatusProcessed  PayoutStatus = "processed"
	PayoutStatusCancelled  PayoutStatus = "cancelled"
	PayoutStatusReversed   PayoutStatus = "reversed"
	PayoutStatusFailed     PayoutStatus = "failed"
)

type PayoutStatusDetails

type PayoutStatusDetails struct {
	// Status description.
	Description string `json:"description"`
	// Status reason.
	Reason string `json:"reason"`
	// Status source.
	Source string `json:"source"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Description respjson.Field
		Reason      respjson.Field
		Source      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

This parameter returns the current status of the payout.

func (PayoutStatusDetails) RawJSON

func (r PayoutStatusDetails) RawJSON() string

Returns the unmodified JSON received from the API

func (*PayoutStatusDetails) UnmarshalJSON

func (r *PayoutStatusDetails) UnmarshalJSON(data []byte) error

type QrCode

type QrCode struct {
	// The unique identifier of the QR Code.
	ID string `json:"id"`
	// Unix timestamp at which the QR Code is scheduled to be automatically closed.
	CloseBy int64 `json:"close_by"`
	// The reason for the closure of the QR Code.
	//
	// Any of "on_demand", "paid".
	CloseReason QrCodeCloseReason `json:"close_reason,nullable"`
	// Unix timestamp at which the QR Code is automatically closed.
	ClosedAt int64 `json:"closed_at"`
	// Unix timestamp at which the QR Code is created.
	CreatedAt int64 `json:"created_at"`
	// The unique identifier of the customer the QR Code is linked with.
	CustomerID string `json:"customer_id"`
	// A brief description about the QR Code.
	Description string `json:"description"`
	// Indicates the type of entity. Here, it is qr_code.
	Entity string `json:"entity"`
	// Indicates if the QR Code should accept payments of specific amounts or any
	// amount.
	FixedAmount bool `json:"fixed_amount"`
	// The URL of the QR Code image.
	ImageURL string `json:"image_url"`
	// Label entered to identify the QR Code.
	Name string `json:"name"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnion `json:"notes"`
	// The amount allowed for a transaction (in the smallest currency unit).
	PaymentAmount int64 `json:"payment_amount"`
	// The total amount received on the QR Code.
	PaymentsAmountReceived int64 `json:"payments_amount_received"`
	// The total number of payments received on the QR Code.
	PaymentsCountReceived int64 `json:"payments_count_received"`
	// Indicates the status of the QR Code.
	//
	// Any of "active", "closed".
	Status     QrCodeStatus       `json:"status"`
	TaxInvoice []QrCodeTaxInvoice `json:"tax_invoice"`
	// The type of the QR Code. Only 'upi_qr' is supported.
	//
	// Any of "upi_qr".
	Type QrCodeType `json:"type"`
	// Indicates if the QR Code should accept single or multiple payments.
	//
	// Any of "single_use", "multiple_use".
	Usage QrCodeUsage `json:"usage"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                     respjson.Field
		CloseBy                respjson.Field
		CloseReason            respjson.Field
		ClosedAt               respjson.Field
		CreatedAt              respjson.Field
		CustomerID             respjson.Field
		Description            respjson.Field
		Entity                 respjson.Field
		FixedAmount            respjson.Field
		ImageURL               respjson.Field
		Name                   respjson.Field
		Notes                  respjson.Field
		PaymentAmount          respjson.Field
		PaymentsAmountReceived respjson.Field
		PaymentsCountReceived  respjson.Field
		Status                 respjson.Field
		TaxInvoice             respjson.Field
		Type                   respjson.Field
		Usage                  respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (QrCode) RawJSON

func (r QrCode) RawJSON() string

Returns the unmodified JSON received from the API

func (*QrCode) UnmarshalJSON

func (r *QrCode) UnmarshalJSON(data []byte) error

type QrCodeCloseReason

type QrCodeCloseReason string

The reason for the closure of the QR Code.

const (
	QrCodeCloseReasonOnDemand QrCodeCloseReason = "on_demand"
	QrCodeCloseReasonPaid     QrCodeCloseReason = "paid"
)

type QrCodeList

type QrCodeList struct {
	// Number of QR Codes returned.
	Count int64 `json:"count"`
	// Name of the entity. Always 'collection'.
	Entity string `json:"entity"`
	// List of QR Code objects.
	Items []QrCode `json:"items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Entity      respjson.Field
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (QrCodeList) RawJSON

func (r QrCodeList) RawJSON() string

Returns the unmodified JSON received from the API

func (*QrCodeList) UnmarshalJSON

func (r *QrCodeList) UnmarshalJSON(data []byte) error

type QrCodeStatus

type QrCodeStatus string

Indicates the status of the QR Code.

const (
	QrCodeStatusActive QrCodeStatus = "active"
	QrCodeStatusClosed QrCodeStatus = "closed"
)

type QrCodeTaxInvoice

type QrCodeTaxInvoice struct {
	// The GSTIN mentioned on the invoice. If not passed, it is picked up from the
	// database.
	BusinessGstin string `json:"business_gstin,required"`
	// CESS Amount on the invoice in paise. If not provided, the transaction will
	// default to the non-GST compliant UPI flow.
	CessAmount int64 `json:"cess_amount,required"`
	// Customer name on the invoice. If not provided, the transaction will default to
	// non-GST compliant UPI flow.
	CustomerName string `json:"customer_name,required"`
	// Unix Timestamp that indicates the issue date of the invoice. If not provided, it
	// will default to the current date.
	Date int64 `json:"date,required"`
	// GST amount on the invoice in paise. If not provided, the transaction will
	// default to the non-GST compliant UPI flow.
	GstAmount int64 `json:"gst_amount,required"`
	// This is the invoice number against which the payment is collected. If not
	// provided, the transaction will default to non-GST compliant UPI flow.
	Number string `json:"number,required"`
	// Indicates whether the transaction is interstate or intrastate
	//
	// Any of "interstate", "intrastate".
	SupplyType string `json:"supply_type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BusinessGstin respjson.Field
		CessAmount    respjson.Field
		CustomerName  respjson.Field
		Date          respjson.Field
		GstAmount     respjson.Field
		Number        respjson.Field
		SupplyType    respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Tax invoice details for GST compliant transactions

func (QrCodeTaxInvoice) RawJSON

func (r QrCodeTaxInvoice) RawJSON() string

Returns the unmodified JSON received from the API

func (*QrCodeTaxInvoice) UnmarshalJSON

func (r *QrCodeTaxInvoice) UnmarshalJSON(data []byte) error

type QrCodeType

type QrCodeType string

The type of the QR Code. Only 'upi_qr' is supported.

const (
	QrCodeTypeUpiQr QrCodeType = "upi_qr"
)

type QrCodeUsage

type QrCodeUsage string

Indicates if the QR Code should accept single or multiple payments.

const (
	QrCodeUsageSingleUse   QrCodeUsage = "single_use"
	QrCodeUsageMultipleUse QrCodeUsage = "multiple_use"
)

type Refund

type Refund struct {
	// The unique identifier of the refund.
	ID string `json:"id"`
	// A dynamic array consisting of unique reference numbers.
	AcquirerData RefundAcquirerData `json:"acquirer_data"`
	// The amount to be refunded (in the smallest unit of currency).
	Amount int64 `json:"amount"`
	// This parameter is populated if the refund was created as part of a batch upload.
	BatchID string `json:"batch_id,nullable"`
	// Unix timestamp at which the refund was created.
	CreatedAt int64 `json:"created_at"`
	// The currency of payment amount for which the refund is initiated.
	Currency string `json:"currency"`
	// Indicates the type of entity. Here, it is refund.
	Entity string `json:"entity"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnion `json:"notes"`
	// The unique identifier of the payment for which a refund is initiated.
	PaymentID string `json:"payment_id"`
	// A unique identifier provided by you for your internal reference.
	Receipt string `json:"receipt"`
	// The mode used to process a refund.
	//
	// Any of "instant", "normal".
	SpeedProcessed RefundSpeedProcessed `json:"speed_processed"`
	// The processing mode of the refund seen in the refund response.
	//
	// Any of "normal", "optimum".
	SpeedRequested RefundSpeedRequested `json:"speed_requested"`
	// Indicates the state of the refund.
	//
	// Any of "pending", "processed", "failed".
	Status RefundStatus `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID             respjson.Field
		AcquirerData   respjson.Field
		Amount         respjson.Field
		BatchID        respjson.Field
		CreatedAt      respjson.Field
		Currency       respjson.Field
		Entity         respjson.Field
		Notes          respjson.Field
		PaymentID      respjson.Field
		Receipt        respjson.Field
		SpeedProcessed respjson.Field
		SpeedRequested respjson.Field
		Status         respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Refund) RawJSON

func (r Refund) RawJSON() string

Returns the unmodified JSON received from the API

func (*Refund) UnmarshalJSON

func (r *Refund) UnmarshalJSON(data []byte) error

type RefundAcquirerData

type RefundAcquirerData struct {
	Arn string `json:"arn"`
	// Bank transaction ID
	BankTransactionID string `json:"bank_transaction_id"`
	Rrn               string `json:"rrn"`
	// transaction ID
	TransactionID string `json:"transaction_id"`
	// Upi transaction ID
	UpiTransactionID string `json:"upi_transaction_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Arn               respjson.Field
		BankTransactionID respjson.Field
		Rrn               respjson.Field
		TransactionID     respjson.Field
		UpiTransactionID  respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A dynamic array consisting of unique reference numbers.

func (RefundAcquirerData) RawJSON

func (r RefundAcquirerData) RawJSON() string

Returns the unmodified JSON received from the API

func (*RefundAcquirerData) UnmarshalJSON

func (r *RefundAcquirerData) UnmarshalJSON(data []byte) error

type RefundList

type RefundList struct {
	// Number of refunds returned.
	Count int64 `json:"count"`
	// Name of the entity. Always 'collection'.
	Entity string `json:"entity"`
	// List of refund objects.
	Items []Refund `json:"items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Entity      respjson.Field
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RefundList) RawJSON

func (r RefundList) RawJSON() string

Returns the unmodified JSON received from the API

func (*RefundList) UnmarshalJSON

func (r *RefundList) UnmarshalJSON(data []byte) error

type RefundListParams

type RefundListParams struct {
	// The number of refunds to fetch. Maximum is 100.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// UNIX timestamp at which the refunds were created.
	From param.Opt[int64] `query:"from,omitzero" json:"-"`
	// The number of refunds to be skipped.
	Skip param.Opt[int64] `query:"skip,omitzero" json:"-"`
	// UNIX timestamp till which the refunds were created.
	To param.Opt[int64] `query:"to,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (RefundListParams) URLQuery

func (r RefundListParams) URLQuery() (v url.Values, err error)

URLQuery serializes RefundListParams's query parameters as `url.Values`.

type RefundService

type RefundService struct {
	Options []option.RequestOption
}

RefundService contains methods and other services that help with interacting with the gomon API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRefundService method instead.

func NewRefundService

func NewRefundService(opts ...option.RequestOption) (r RefundService)

NewRefundService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RefundService) Get

func (r *RefundService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Refund, err error)

Use this endpoint to retrieve the refund using the id. [See docs](https://razorpay.com/docs/api/refunds/fetch-with-id/)

func (*RefundService) List

func (r *RefundService) List(ctx context.Context, query RefundListParams, opts ...option.RequestOption) (res *RefundList, err error)

Use this endpoint to retrieve details of all refunds. By default, only the last 10 refunds are returned. You can use count and skip query parameters to change that behaviour. [See docs](https://razorpay.com/docs/api/refunds/fetch-all/)

func (*RefundService) Update

func (r *RefundService) Update(ctx context.Context, id string, body RefundUpdateParams, opts ...option.RequestOption) (res *Refund, err error)

Use this endpoint to update the notes field for a particular refund. Only the notes field can be updated. [See docs](https://razorpay.com/docs/api/refunds/update/)

type RefundSpeedProcessed

type RefundSpeedProcessed string

The mode used to process a refund.

const (
	RefundSpeedProcessedInstant RefundSpeedProcessed = "instant"
	RefundSpeedProcessedNormal  RefundSpeedProcessed = "normal"
)

type RefundSpeedRequested

type RefundSpeedRequested string

The processing mode of the refund seen in the refund response.

const (
	RefundSpeedRequestedNormal  RefundSpeedRequested = "normal"
	RefundSpeedRequestedOptimum RefundSpeedRequested = "optimum"
)

type RefundStatus

type RefundStatus string

Indicates the state of the refund.

const (
	RefundStatusPending   RefundStatus = "pending"
	RefundStatusProcessed RefundStatus = "processed"
	RefundStatusFailed    RefundStatus = "failed"
)

type RefundUpdateParams

type RefundUpdateParams struct {
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnionParam `json:"notes,omitzero,required"`
	// contains filtered or unexported fields
}

func (RefundUpdateParams) MarshalJSON

func (r RefundUpdateParams) MarshalJSON() (data []byte, err error)

func (*RefundUpdateParams) UnmarshalJSON

func (r *RefundUpdateParams) UnmarshalJSON(data []byte) error

type Settlement

type Settlement struct {
	// The unique identifier of the settlement transaction.
	ID string `json:"id"`
	// The amount to be settled (in the smallest unit of currency).
	Amount int64 `json:"amount"`
	// Unix timestamp at which the settlement transaction was created.
	CreatedAt int64 `json:"created_at"`
	// Indicates the type of entity. Here, it is settlement.
	Entity string `json:"entity"`
	// The total fee charged for processing all payments received from customers
	// settled to you in this settlement transaction.
	Fees int64 `json:"fees"`
	// Indicates the settlement state.
	//
	// Any of "created", "processed", "failed".
	Status SettlementStatus `json:"status"`
	// The total tax, in currency subunits, charged on the fees collected to process
	// all payments received from customers settled to you in this settlement
	// transaction.
	Tax int64 `json:"tax"`
	// The Unique Transaction Reference (UTR) number available across banks.
	Utr string `json:"utr"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Amount      respjson.Field
		CreatedAt   respjson.Field
		Entity      respjson.Field
		Fees        respjson.Field
		Status      respjson.Field
		Tax         respjson.Field
		Utr         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Settlement) RawJSON

func (r Settlement) RawJSON() string

Returns the unmodified JSON received from the API

func (*Settlement) UnmarshalJSON

func (r *Settlement) UnmarshalJSON(data []byte) error

type SettlementListParams

type SettlementListParams struct {
	// Number of settlement records to be fetched. Default is 10. Possible value- 1
	// to 100.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// UNIX timestamp (in seconds) from when settlements are to be fetched.
	From param.Opt[int64] `query:"from,omitzero" json:"-"`
	// Number of settlement records to be skipped. Default is 0.
	Skip param.Opt[int64] `query:"skip,omitzero" json:"-"`
	// UNIX timestamp (in seconds) till when settlements are to be fetched.
	To param.Opt[int64] `query:"to,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SettlementListParams) URLQuery

func (r SettlementListParams) URLQuery() (v url.Values, err error)

URLQuery serializes SettlementListParams's query parameters as `url.Values`.

type SettlementListResponse

type SettlementListResponse struct {
	// Number of settlements returned.
	Count int64 `json:"count"`
	// Name of the entity. Always 'collection'.
	Entity string `json:"entity"`
	// List of settlement objects.
	Items []Settlement `json:"items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Entity      respjson.Field
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SettlementListResponse) RawJSON

func (r SettlementListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SettlementListResponse) UnmarshalJSON

func (r *SettlementListResponse) UnmarshalJSON(data []byte) error

type SettlementOndemand

type SettlementOndemand struct {
	// The unique identifier of the instant settlement transaction.
	ID string `json:"id"`
	// Portion of the requested amount, in paise, yet to be settled to you.
	AmountPending int64 `json:"amount_pending"`
	// The settlement amount, in paise, requested by you.
	AmountRequested int64 `json:"amount_requested"`
	// Portion of the requested amount, in paise, that was not settled to you. This
	// amount is reversed to your PG current balance.
	AmountReversed int64 `json:"amount_reversed"`
	// Total amount (minus fees and tax), in paise, settled to the bank account.
	AmountSettled int64 `json:"amount_settled"`
	// Unix timestamp at which the instant settlement was created.
	CreatedAt int64 `json:"created_at"`
	// The 3-letter ISO currency code for the settlement.
	Currency string `json:"currency"`
	// Custom note for the instant settlement.
	Description string `json:"description"`
	// Indicates the type of entity. Here it is settlement.ondemand.
	Entity string `json:"entity"`
	// Total amount (fees+tax), in paise, deducted for the instant settlement.
	Fees int64 `json:"fees"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnion `json:"notes"`
	// List of payouts created for the instant settlement.
	OndemandPayouts SettlementOndemandOndemandPayouts `json:"ondemand_payouts"`
	// Indicates whether full balance is settled.
	SettleFullBalance bool `json:"settle_full_balance"`
	// Indicates the state of the instant settlement.
	//
	// Any of "created", "initiated", "partially_processed", "processed", "reversed".
	Status SettlementOndemandStatus `json:"status"`
	// Total tax, in paise, charged for the fee component.
	Tax int64 `json:"tax"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		AmountPending     respjson.Field
		AmountRequested   respjson.Field
		AmountReversed    respjson.Field
		AmountSettled     respjson.Field
		CreatedAt         respjson.Field
		Currency          respjson.Field
		Description       respjson.Field
		Entity            respjson.Field
		Fees              respjson.Field
		Notes             respjson.Field
		OndemandPayouts   respjson.Field
		SettleFullBalance respjson.Field
		Status            respjson.Field
		Tax               respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SettlementOndemand) RawJSON

func (r SettlementOndemand) RawJSON() string

Returns the unmodified JSON received from the API

func (*SettlementOndemand) UnmarshalJSON

func (r *SettlementOndemand) UnmarshalJSON(data []byte) error

type SettlementOndemandNewParams

type SettlementOndemandNewParams struct {
	// The amount, in paise, you want to get settled instantly.
	Amount int64 `json:"amount,required"`
	// Custom note for the instant settlement. Max 30 characters. Allowed a-z, A-Z,
	// 0-9, space.
	Description param.Opt[string] `json:"description,omitzero"`
	// Indicates whether full balance is settled. If true, Razorpay will settle the
	// maximum amount possible and ignore the amount parameter.
	SettleFullBalance param.Opt[bool] `json:"settle_full_balance,omitzero"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnionParam `json:"notes,omitzero"`
	// contains filtered or unexported fields
}

func (SettlementOndemandNewParams) MarshalJSON

func (r SettlementOndemandNewParams) MarshalJSON() (data []byte, err error)

func (*SettlementOndemandNewParams) UnmarshalJSON

func (r *SettlementOndemandNewParams) UnmarshalJSON(data []byte) error

type SettlementOndemandOndemandPayouts

type SettlementOndemandOndemandPayouts struct {
	Count  int64                                   `json:"count"`
	Entity string                                  `json:"entity"`
	Items  []SettlementOndemandOndemandPayoutsItem `json:"items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Entity      respjson.Field
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

List of payouts created for the instant settlement.

func (SettlementOndemandOndemandPayouts) RawJSON

Returns the unmodified JSON received from the API

func (*SettlementOndemandOndemandPayouts) UnmarshalJSON

func (r *SettlementOndemandOndemandPayouts) UnmarshalJSON(data []byte) error

type SettlementOndemandOndemandPayoutsItem

type SettlementOndemandOndemandPayoutsItem struct {
	ID            string `json:"id"`
	Amount        int64  `json:"amount"`
	AmountSettled int64  `json:"amount_settled,nullable"`
	CreatedAt     int64  `json:"created_at"`
	Entity        string `json:"entity"`
	Fees          int64  `json:"fees"`
	InitiatedAt   int64  `json:"initiated_at,nullable"`
	ProcessedAt   int64  `json:"processed_at,nullable"`
	ReversedAt    int64  `json:"reversed_at,nullable"`
	Status        string `json:"status"`
	Tax           int64  `json:"tax"`
	Utr           string `json:"utr,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		Amount        respjson.Field
		AmountSettled respjson.Field
		CreatedAt     respjson.Field
		Entity        respjson.Field
		Fees          respjson.Field
		InitiatedAt   respjson.Field
		ProcessedAt   respjson.Field
		ReversedAt    respjson.Field
		Status        respjson.Field
		Tax           respjson.Field
		Utr           respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SettlementOndemandOndemandPayoutsItem) RawJSON

Returns the unmodified JSON received from the API

func (*SettlementOndemandOndemandPayoutsItem) UnmarshalJSON

func (r *SettlementOndemandOndemandPayoutsItem) UnmarshalJSON(data []byte) error

type SettlementOndemandService

type SettlementOndemandService struct {
	Options []option.RequestOption
}

SettlementOndemandService contains methods and other services that help with interacting with the gomon API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSettlementOndemandService method instead.

func NewSettlementOndemandService

func NewSettlementOndemandService(opts ...option.RequestOption) (r SettlementOndemandService)

NewSettlementOndemandService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SettlementOndemandService) Get

Use this endpoint to retrieve the details of a particular Instant Settlement. [See docs](https://razorpay.com/docs/api/settlements/instant/fetch-with-id/)

func (*SettlementOndemandService) New

Use this endpoint to create an Instant Settlement. [See docs](https://razorpay.com/docs/api/settlements/instant/create/)

type SettlementOndemandStatus

type SettlementOndemandStatus string

Indicates the state of the instant settlement.

const (
	SettlementOndemandStatusCreated            SettlementOndemandStatus = "created"
	SettlementOndemandStatusInitiated          SettlementOndemandStatus = "initiated"
	SettlementOndemandStatusPartiallyProcessed SettlementOndemandStatus = "partially_processed"
	SettlementOndemandStatusProcessed          SettlementOndemandStatus = "processed"
	SettlementOndemandStatusReversed           SettlementOndemandStatus = "reversed"
)

type SettlementReconGetParams

type SettlementReconGetParams struct {
	// The month the settlement was received in the MM format. For example, 06.
	Month int64 `query:"month,required" json:"-"`
	// The year the settlement was received in the YYYY format. For example, 2022.
	Year int64 `query:"year,required" json:"-"`
	// Specifies the number of available settlements to be fetched. Possible values- 1
	// to 1000.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// The date on which the settlement was received in the DD format. For example, 11.
	Day param.Opt[int64] `query:"day,omitzero" json:"-"`
	// Specifies the number of available settlements to be skipped when fetching a
	// count.
	Skip param.Opt[int64] `query:"skip,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SettlementReconGetParams) URLQuery

func (r SettlementReconGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes SettlementReconGetParams's query parameters as `url.Values`.

type SettlementReconGetResponse

type SettlementReconGetResponse struct {
	// Number of settlement recon records returned.
	Count int64 `json:"count"`
	// Name of the entity. Always 'collection'.
	Entity string `json:"entity"`
	// List of settlement recon objects.
	Items []SettlementReconGetResponseItem `json:"items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Entity      respjson.Field
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SettlementReconGetResponse) RawJSON

func (r SettlementReconGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SettlementReconGetResponse) UnmarshalJSON

func (r *SettlementReconGetResponse) UnmarshalJSON(data []byte) error

type SettlementReconGetResponseItem

type SettlementReconGetResponseItem struct {
	// The total amount of the transaction (in the smallest unit of currency).
	Amount int64 `json:"amount"`
	// The 4-character code denoting the issuing bank.
	CardIssuer string `json:"card_issuer,nullable"`
	// The card network used to process the payment.
	CardNetwork string `json:"card_network,nullable"`
	// The card type used to process the payment.
	CardType string `json:"card_type,nullable"`
	// Unix timestamp at which the transaction was created.
	CreatedAt int64 `json:"created_at"`
	// The amount, in currency subunits, that has been credited to your account for
	// this transaction.
	Credit int64 `json:"credit"`
	// The type of credit for the transaction.
	CreditType string `json:"credit_type"`
	// The currency of the transaction.
	Currency string `json:"currency"`
	// The amount, in currency subunits, that has been debited from your account for
	// this transaction.
	Debit int64 `json:"debit"`
	// Brief description about the transaction.
	Description string `json:"description,nullable"`
	// The unique identifier of any dispute, if any, for this transaction.
	DisputeID string `json:"dispute_id,nullable"`
	// The unique identifier of the transaction that has been settled.
	EntityID string `json:"entity_id"`
	// The fee charged for processing the transaction.
	Fee int64 `json:"fee"`
	// The payment method used to complete the payment.
	Method string `json:"method,nullable"`
	// Key-value pair that can be used to store additional information about the
	// entity.
	Notes NotesUnion `json:"notes"`
	// Indicates whether the account settlement for transfer is on hold.
	OnHold bool `json:"on_hold"`
	// Order id linked to the payment made by the customer that has been settled.
	OrderID string `json:"order_id,nullable"`
	// Receipt number entered while creating the Order.
	OrderReceipt string `json:"order_receipt,nullable"`
	// The unique identifier of the payment linked to refund or transfer that has been
	// settled.
	PaymentID string `json:"payment_id,nullable"`
	// Unix timestamp when the transaction was posted.
	PostedAt int64 `json:"posted_at,nullable"`
	// Indicates whether the transaction has been settled or not.
	Settled bool `json:"settled"`
	// Unix timestamp when the transaction was settled.
	SettledAt int64 `json:"settled_at"`
	// The unique identifier of the settlement transaction.
	SettlementID string `json:"settlement_id"`
	// The unique reference number linked to the settlement.
	SettlementUtr string `json:"settlement_utr,nullable"`
	// The tax charged for processing the transaction.
	Tax int64 `json:"tax"`
	// Indicates the type of transaction.
	//
	// Any of "payment", "refund", "transfer", "adjustment".
	Type string `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount        respjson.Field
		CardIssuer    respjson.Field
		CardNetwork   respjson.Field
		CardType      respjson.Field
		CreatedAt     respjson.Field
		Credit        respjson.Field
		CreditType    respjson.Field
		Currency      respjson.Field
		Debit         respjson.Field
		Description   respjson.Field
		DisputeID     respjson.Field
		EntityID      respjson.Field
		Fee           respjson.Field
		Method        respjson.Field
		Notes         respjson.Field
		OnHold        respjson.Field
		OrderID       respjson.Field
		OrderReceipt  respjson.Field
		PaymentID     respjson.Field
		PostedAt      respjson.Field
		Settled       respjson.Field
		SettledAt     respjson.Field
		SettlementID  respjson.Field
		SettlementUtr respjson.Field
		Tax           respjson.Field
		Type          respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SettlementReconGetResponseItem) RawJSON

Returns the unmodified JSON received from the API

func (*SettlementReconGetResponseItem) UnmarshalJSON

func (r *SettlementReconGetResponseItem) UnmarshalJSON(data []byte) error

type SettlementReconService

type SettlementReconService struct {
	Options []option.RequestOption
}

SettlementReconService contains methods and other services that help with interacting with the gomon API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSettlementReconService method instead.

func NewSettlementReconService

func NewSettlementReconService(opts ...option.RequestOption) (r SettlementReconService)

NewSettlementReconService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SettlementReconService) Get

Use this endpoint to return a list of all transactions such as payments, refunds, transfers and adjustments settled to your account on a particular day or month. [See docs](https://razorpay.com/docs/api/settlements/fetch-recon)

type SettlementService

type SettlementService struct {
	Options  []option.RequestOption
	Recon    SettlementReconService
	Ondemand SettlementOndemandService
}

SettlementService contains methods and other services that help with interacting with the gomon API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSettlementService method instead.

func NewSettlementService

func NewSettlementService(opts ...option.RequestOption) (r SettlementService)

NewSettlementService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SettlementService) Get

func (r *SettlementService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Settlement, err error)

Use this endpoint to retrieve details of a settlement with its id. [See docs](https://razorpay.com/docs/api/settlements/fetch-with-id)

func (*SettlementService) List

Use this endpoint to retrieve details of all settlements. [See docs](https://razorpay.com/docs/api/settlements/fetch-all/)

type SettlementStatus

type SettlementStatus string

Indicates the settlement state.

const (
	SettlementStatusCreated   SettlementStatus = "created"
	SettlementStatusProcessed SettlementStatus = "processed"
	SettlementStatusFailed    SettlementStatus = "failed"
)

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.21, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.21, and used by the Go 1.24 encoding/json package.
packages
shared

Jump to

Keyboard shortcuts

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