cashfreego

package module
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 13 Imported by: 0

README

Go SDK

Payments infrastructure for India

SDK Installation

go get github.com/speakeasy-sdks/cashfree-go

SDK Example Usage

Example

package main

import (
	"context"
	cashfreego "github.com/speakeasy-sdks/cashfree-go"
	"github.com/speakeasy-sdks/cashfree-go/pkg/models/shared"
	"log"
)

func main() {
	s := cashfreego.New(
		cashfreego.WithSecurity(shared.Security{
			Option1: &shared.SecurityOption1{
				XClientID:     "<YOUR_API_KEY_HERE>",
				XClientSecret: "<YOUR_API_KEY_HERE>",
			},
		}),
	)

	var customerID string = "<value>"

	var instrumentID string = "<value>"

	var xAPIVersion string = "2022-09-01"

	var xRequestID *string = cashfreego.String("<value>")

	ctx := context.Background()
	res, err := s.TokenVault.DeleteSavedInstrument(ctx, customerID, instrumentID, xAPIVersion, xRequestID)
	if err != nil {
		log.Fatal(err)
	}
	if res.FetchAllSavedInstruments != nil {
		// handle response
	}
}

Available Resources and Operations

TokenVault

Eligibility

  • Cancel - Cancel Payment Link
  • Create - Create Payment Link
  • Fetch - Fetch Payment Link Details
  • GetOrders - Get Orders for a Payment Link

Offers

  • Create - Create Offer
  • Get - Get Offer by ID

Orders

Payments

Refunds

Settlements

PGReconciliation

  • Get - PG Reconciliation

SoftPOS

Special Types

Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or an error, they will never return both. When specified by the OpenAPI spec document, the SDK will return the appropriate subclass.

Error Object Status Code Content Type
sdkerrors.BadRequestError 400 application/json
sdkerrors.AuthenticationError 401 application/json
sdkerrors.APIError404 404 application/json
sdkerrors.APIError409 409 application/json
sdkerrors.IdempotencyError 422 application/json
sdkerrors.RateLimitError 429 application/json
sdkerrors.APIError 500 application/json
sdkerrors.APIError502 502 application/json
sdkerrors.SDKError 4xx-5xx /

Example

package main

import (
	"context"
	"errors"
	cashfreego "github.com/speakeasy-sdks/cashfree-go"
	"github.com/speakeasy-sdks/cashfree-go/pkg/models/sdkerrors"
	"github.com/speakeasy-sdks/cashfree-go/pkg/models/shared"
	"log"
)

func main() {
	s := cashfreego.New(
		cashfreego.WithSecurity(shared.Security{
			Option1: &shared.SecurityOption1{
				XClientID:     "<YOUR_API_KEY_HERE>",
				XClientSecret: "<YOUR_API_KEY_HERE>",
			},
		}),
	)

	var customerID string = "<value>"

	var instrumentID string = "<value>"

	var xAPIVersion string = "2022-09-01"

	var xRequestID *string = cashfreego.String("<value>")

	ctx := context.Background()
	res, err := s.TokenVault.DeleteSavedInstrument(ctx, customerID, instrumentID, xAPIVersion, xRequestID)
	if err != nil {

		var e *sdkerrors.BadRequestError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *sdkerrors.AuthenticationError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *sdkerrors.APIError404
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *sdkerrors.APIError409
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *sdkerrors.IdempotencyError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *sdkerrors.RateLimitError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *sdkerrors.APIError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *sdkerrors.APIError502
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *sdkerrors.SDKError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}
	}
}

Server Selection

Select Server by Index

You can override the default server globally using the WithServerIndex option when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:

# Server Variables
0 https://sandbox.cashfree.com/pg None
1 https://api.cashfree.com/pg None
Example
package main

import (
	"context"
	cashfreego "github.com/speakeasy-sdks/cashfree-go"
	"github.com/speakeasy-sdks/cashfree-go/pkg/models/shared"
	"log"
)

func main() {
	s := cashfreego.New(
		cashfreego.WithServerIndex(1),
		cashfreego.WithSecurity(shared.Security{
			Option1: &shared.SecurityOption1{
				XClientID:     "<YOUR_API_KEY_HERE>",
				XClientSecret: "<YOUR_API_KEY_HERE>",
			},
		}),
	)

	var customerID string = "<value>"

	var instrumentID string = "<value>"

	var xAPIVersion string = "2022-09-01"

	var xRequestID *string = cashfreego.String("<value>")

	ctx := context.Background()
	res, err := s.TokenVault.DeleteSavedInstrument(ctx, customerID, instrumentID, xAPIVersion, xRequestID)
	if err != nil {
		log.Fatal(err)
	}
	if res.FetchAllSavedInstruments != nil {
		// handle response
	}
}

Override Server URL Per-Client

The default server can also be overridden globally using the WithServerURL option when initializing the SDK client instance. For example:

package main

import (
	"context"
	cashfreego "github.com/speakeasy-sdks/cashfree-go"
	"github.com/speakeasy-sdks/cashfree-go/pkg/models/shared"
	"log"
)

func main() {
	s := cashfreego.New(
		cashfreego.WithServerURL("https://sandbox.cashfree.com/pg"),
		cashfreego.WithSecurity(shared.Security{
			Option1: &shared.SecurityOption1{
				XClientID:     "<YOUR_API_KEY_HERE>",
				XClientSecret: "<YOUR_API_KEY_HERE>",
			},
		}),
	)

	var customerID string = "<value>"

	var instrumentID string = "<value>"

	var xAPIVersion string = "2022-09-01"

	var xRequestID *string = cashfreego.String("<value>")

	ctx := context.Background()
	res, err := s.TokenVault.DeleteSavedInstrument(ctx, customerID, instrumentID, xAPIVersion, xRequestID)
	if err != nil {
		log.Fatal(err)
	}
	if res.FetchAllSavedInstruments != nil {
		// handle response
	}
}

Custom HTTP Client

The Go SDK makes API calls that wrap an internal HTTP client. The requirements for the HTTP client are very simple. It must match this interface:

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

The built-in net/http client satisfies this interface and a default client based on the built-in is provided by default. To replace this default with a client of your own, you can implement this interface yourself or provide your own client configured as desired. Here's a simple example, which adds a client with a 30 second timeout.

import (
	"net/http"
	"time"
	"github.com/myorg/your-go-sdk"
)

var (
	httpClient = &http.Client{Timeout: 30 * time.Second}
	sdkClient  = sdk.New(sdk.WithClient(httpClient))
)

This can be a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration.

Retries

Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.

To change the default retry strategy for a single API call, simply provide a RetryConfig object to the call by using the WithRetries option:

package main

import (
	"context"
	cashfreego "github.com/speakeasy-sdks/cashfree-go"
	"github.com/speakeasy-sdks/cashfree-go/pkg/models/shared"
	"github.com/speakeasy-sdks/cashfree-go/pkg/utils"
	"log"
	"pkg/models/operations"
)

func main() {
	s := cashfreego.New(
		cashfreego.WithSecurity(shared.Security{
			Option1: &shared.SecurityOption1{
				XClientID:     "<YOUR_API_KEY_HERE>",
				XClientSecret: "<YOUR_API_KEY_HERE>",
			},
		}),
	)

	var customerID string = "<value>"

	var instrumentID string = "<value>"

	var xAPIVersion string = "2022-09-01"

	var xRequestID *string = cashfreego.String("<value>")

	ctx := context.Background()
	res, err := s.TokenVault.DeleteSavedInstrument(ctx, customerID, instrumentID, xAPIVersion, xRequestID, operations.WithRetries(
		utils.RetryConfig{
			Strategy: "backoff",
			Backoff: &utils.BackoffStrategy{
				InitialInterval: 1,
				MaxInterval:     50,
				Exponent:        1.1,
				MaxElapsedTime:  100,
			},
			RetryConnectionErrors: false,
		}))
	if err != nil {
		log.Fatal(err)
	}
	if res.FetchAllSavedInstruments != nil {
		// handle response
	}
}

If you'd like to override the default retry strategy for all operations that support retries, you can use the WithRetryConfig option at SDK initialization:

package main

import (
	"context"
	cashfreego "github.com/speakeasy-sdks/cashfree-go"
	"github.com/speakeasy-sdks/cashfree-go/pkg/models/shared"
	"github.com/speakeasy-sdks/cashfree-go/pkg/utils"
	"log"
)

func main() {
	s := cashfreego.New(
		cashfreego.WithRetryConfig(
			utils.RetryConfig{
				Strategy: "backoff",
				Backoff: &utils.BackoffStrategy{
					InitialInterval: 1,
					MaxInterval:     50,
					Exponent:        1.1,
					MaxElapsedTime:  100,
				},
				RetryConnectionErrors: false,
			}),
		cashfreego.WithSecurity(shared.Security{
			Option1: &shared.SecurityOption1{
				XClientID:     "<YOUR_API_KEY_HERE>",
				XClientSecret: "<YOUR_API_KEY_HERE>",
			},
		}),
	)

	var customerID string = "<value>"

	var instrumentID string = "<value>"

	var xAPIVersion string = "2022-09-01"

	var xRequestID *string = cashfreego.String("<value>")

	ctx := context.Background()
	res, err := s.TokenVault.DeleteSavedInstrument(ctx, customerID, instrumentID, xAPIVersion, xRequestID)
	if err != nil {
		log.Fatal(err)
	}
	if res.FetchAllSavedInstruments != nil {
		// handle response
	}
}

Authentication

Per-Client Security Schemes

This SDK supports multiple security scheme combinations globally. You can choose from one of the alternatives by using the WithSecurity option when initializing the SDK client instance. The selected option will be used by default to authenticate with the API for all operations that support it.

Option1

All of the following schemes must be satisfied to use the Option1 alternative:

Name Type Scheme
XClientID apiKey API key
XClientSecret apiKey API key

Example:

package main

import (
	"context"
	cashfreego "github.com/speakeasy-sdks/cashfree-go"
	"github.com/speakeasy-sdks/cashfree-go/pkg/models/shared"
	"log"
)

func main() {
	s := cashfreego.New(
		cashfreego.WithSecurity(shared.Security{
			Option1: &shared.SecurityOption1{
				XClientID:     "<YOUR_API_KEY_HERE>",
				XClientSecret: "<YOUR_API_KEY_HERE>",
			},
		}),
	)

	var customerID string = "<value>"

	var instrumentID string = "<value>"

	var xAPIVersion string = "2022-09-01"

	var xRequestID *string = cashfreego.String("<value>")

	ctx := context.Background()
	res, err := s.TokenVault.DeleteSavedInstrument(ctx, customerID, instrumentID, xAPIVersion, xRequestID)
	if err != nil {
		log.Fatal(err)
	}
	if res.FetchAllSavedInstruments != nil {
		// handle response
	}
}

Option2

All of the following schemes must be satisfied to use the Option2 alternative:

Name Type Scheme
XClientID apiKey API key
XPartnerAPIKey apiKey API key

Example:

package main

import (
	"context"
	cashfreego "github.com/speakeasy-sdks/cashfree-go"
	"github.com/speakeasy-sdks/cashfree-go/pkg/models/shared"
	"log"
)

func main() {
	s := cashfreego.New(
		cashfreego.WithSecurity(shared.Security{
			Option2: &shared.SecurityOption2{
				XClientID:      "<YOUR_API_KEY_HERE>",
				XPartnerAPIKey: "<YOUR_API_KEY_HERE>",
			},
		}),
	)

	var customerID string = "<value>"

	var instrumentID string = "<value>"

	var xAPIVersion string = "2022-09-01"

	var xRequestID *string = cashfreego.String("<value>")

	ctx := context.Background()
	res, err := s.TokenVault.DeleteSavedInstrument(ctx, customerID, instrumentID, xAPIVersion, xRequestID)
	if err != nil {
		log.Fatal(err)
	}
	if res.FetchAllSavedInstruments != nil {
		// handle response
	}
}

Option3

All of the following schemes must be satisfied to use the Option3 alternative:

Name Type Scheme
XClientID apiKey API key
XClientSignatureHeader apiKey API key

Example:

package main

import (
	"context"
	cashfreego "github.com/speakeasy-sdks/cashfree-go"
	"github.com/speakeasy-sdks/cashfree-go/pkg/models/shared"
	"log"
)

func main() {
	s := cashfreego.New(
		cashfreego.WithSecurity(shared.Security{
			Option3: &shared.SecurityOption3{
				XClientID:              "<YOUR_API_KEY_HERE>",
				XClientSignatureHeader: "<YOUR_API_KEY_HERE>",
			},
		}),
	)

	var customerID string = "<value>"

	var instrumentID string = "<value>"

	var xAPIVersion string = "2022-09-01"

	var xRequestID *string = cashfreego.String("<value>")

	ctx := context.Background()
	res, err := s.TokenVault.DeleteSavedInstrument(ctx, customerID, instrumentID, xAPIVersion, xRequestID)
	if err != nil {
		log.Fatal(err)
	}
	if res.FetchAllSavedInstruments != nil {
		// handle response
	}
}

Option4

All of the following schemes must be satisfied to use the Option4 alternative:

Name Type Scheme
XPartnerAPIKey apiKey API key
XPartnerMerchantID apiKey API key

Example:

package main

import (
	"context"
	cashfreego "github.com/speakeasy-sdks/cashfree-go"
	"github.com/speakeasy-sdks/cashfree-go/pkg/models/shared"
	"log"
)

func main() {
	s := cashfreego.New(
		cashfreego.WithSecurity(shared.Security{
			Option4: &shared.SecurityOption4{
				XPartnerAPIKey:     "<YOUR_API_KEY_HERE>",
				XPartnerMerchantID: "<YOUR_API_KEY_HERE>",
			},
		}),
	)

	var customerID string = "<value>"

	var instrumentID string = "<value>"

	var xAPIVersion string = "2022-09-01"

	var xRequestID *string = cashfreego.String("<value>")

	ctx := context.Background()
	res, err := s.TokenVault.DeleteSavedInstrument(ctx, customerID, instrumentID, xAPIVersion, xRequestID)
	if err != nil {
		log.Fatal(err)
	}
	if res.FetchAllSavedInstruments != nil {
		// handle response
	}
}

Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!

SDK Created by Speakeasy

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerList = []string{

	"https://sandbox.cashfree.com/pg",

	"https://api.cashfree.com/pg",
}

ServerList contains the list of servers available to the SDK

Functions

func Bool

func Bool(b bool) *bool

Bool provides a helper function to return a pointer to a bool

func Float32

func Float32(f float32) *float32

Float32 provides a helper function to return a pointer to a float32

func Float64

func Float64(f float64) *float64

Float64 provides a helper function to return a pointer to a float64

func Int

func Int(i int) *int

Int provides a helper function to return a pointer to an int

func Int64

func Int64(i int64) *int64

Int64 provides a helper function to return a pointer to an int64

func String

func String(s string) *string

String provides a helper function to return a pointer to a string

Types

type Cashfree

type Cashfree struct {
	// Cashfree's token Vault helps you save cards and tokenize them in a PCI complaint manner. We support creation of network tokens which can be used across acquiring banks
	TokenVault  *TokenVault
	Eligibility *Eligibility
	// Collection of APIs handle payment links.
	PaymentLinks *PaymentLinks
	// Collection of apis to get offers applicable for an order
	Offers *Offers
	// Collection of APIs to create, accept payments and refund for an order.
	Orders *Orders
	// Collection of APIs handle payments.
	Payments *Payments
	// Collection of APIs handle refunds.
	Refunds *Refunds
	// Collection of APIs handle settlements.
	Settlements *Settlements
	// Transac1tio1n reconciliation
	PGReconciliation *PGReconciliation
	// softPOS' agent and order management system now supported by APIs
	SoftPOS *SoftPOS
	// contains filtered or unexported fields
}

Cashfree Payment Gateway APIs: Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites.

func New

func New(opts ...SDKOption) *Cashfree

New creates a new instance of the SDK with the provided options

type Eligibility added in v0.9.0

type Eligibility struct {
	// contains filtered or unexported fields
}

func (*Eligibility) GetAllOffers added in v0.9.0

func (s *Eligibility) GetAllOffers(ctx context.Context, xAPIVersion string, eligibilityOffersRequest *shared.EligibilityOffersRequest, xRequestID *string, opts ...operations.Option) (*operations.GetEligibilityOfferResponse, error)

GetAllOffers - Get eligible Offers Use this API to get eligible offers for an order or amount.

func (*Eligibility) GetCardlessEMI added in v0.9.0

func (s *Eligibility) GetCardlessEMI(ctx context.Context, xAPIVersion string, eligibilityCardlessEMIRequest *shared.EligibilityCardlessEMIRequest, xRequestID *string, opts ...operations.Option) (*operations.GetEligibilityCardlessEMIResponse, error)

GetCardlessEMI - Get eligible Cardless EMI Use this API to get eligible Cardless EMI Payment Methods for a customer on an order.

func (*Eligibility) GetPaylaterMethods added in v0.9.0

func (s *Eligibility) GetPaylaterMethods(ctx context.Context, xAPIVersion string, eligibilityCardlessEMIRequest *shared.EligibilityCardlessEMIRequest, xRequestID *string, opts ...operations.Option) (*operations.GetEligibilityPaylaterResponse, error)

GetPaylaterMethods - Get eligible Paylater Use this API to get eligible Paylater Payment Methods for a customer on an order.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient provides an interface for suplying the SDK with a custom HTTP client

type Offers added in v0.9.0

type Offers struct {
	// contains filtered or unexported fields
}

Offers - Collection of apis to get offers applicable for an order

func (*Offers) Create added in v0.9.0

func (s *Offers) Create(ctx context.Context, xAPIVersion string, createOfferBackendRequest *shared.CreateOfferBackendRequest, xRequestID *string, opts ...operations.Option) (*operations.CreateOfferResponse, error)

Create Offer Use this API to create offers with Cashfree from your backend

func (*Offers) Get added in v0.9.0

func (s *Offers) Get(ctx context.Context, offerID string, xAPIVersion string, xRequestID *string, opts ...operations.Option) (*operations.GetOfferResponse, error)

Get Offer by ID Use this API to get offer by offer_id

type Orders added in v0.9.0

type Orders struct {
	// contains filtered or unexported fields
}

Orders - Collection of APIs to create, accept payments and refund for an order.

func (*Orders) Create added in v0.9.0

func (s *Orders) Create(ctx context.Context, xAPIVersion string, createOrderBackendRequest *shared.CreateOrderBackendRequest, xIdempotencyKey *string, xRequestID *string, opts ...operations.Option) (*operations.CreateOrderResponse, error)

Create Order ### Order An order is an entity which has a amount and currency associated with it. It is something for which you want to collect payment for. Use this API to create orders with Cashfree from your backend to get a `payment_sessions_id`. You can use the `payment_sessions_id` to create a transaction for the order.

func (*Orders) Get added in v0.9.0

func (s *Orders) Get(ctx context.Context, orderID string, xAPIVersion string, xRequestID *string, opts ...operations.Option) (*operations.GetOrderResponse, error)

Get Order Use this API to fetch the order that was created at Cashfree's using the `order_id`. ## When to use this API - To check the status of your order - Once the order is PAID - Once your customer returns to `return_url`

type PGReconciliation added in v0.9.0

type PGReconciliation struct {
	// contains filtered or unexported fields
}

PGReconciliation - Transac1tio1n reconciliation

func (*PGReconciliation) Get added in v0.9.0

Get - PG Reconciliation Use this API to get the payment gateway reconciliation details with date range.

type PaymentLinks struct {
	// contains filtered or unexported fields
}

PaymentLinks - Collection of APIs handle payment links.

func (*PaymentLinks) Cancel added in v0.9.0

func (s *PaymentLinks) Cancel(ctx context.Context, linkID string, xAPIVersion string, xIdempotencyKey *string, xRequestID *string, opts ...operations.Option) (*operations.CancelPaymentLinkResponse, error)

Cancel Payment Link Use this API to cancel a payment link. No further payments can be done against a cancelled link. Only a link in ACTIVE status can be cancelled.

func (*PaymentLinks) Create added in v0.9.0

func (s *PaymentLinks) Create(ctx context.Context, xAPIVersion string, createLinkRequest *shared.CreateLinkRequest, xIdempotencyKey *string, xRequestID *string, opts ...operations.Option) (*operations.CreatePaymentLinkResponse, error)

Create Payment Link Use this API to create a new payment link. The created payment link url will be available in the API response parameter link_url.

func (*PaymentLinks) Fetch added in v0.9.0

func (s *PaymentLinks) Fetch(ctx context.Context, linkID string, xAPIVersion string, xRequestID *string, opts ...operations.Option) (*operations.FetchPaymentLinkDetailsResponse, error)

Fetch Payment Link Details Use this API to view all details and status of a payment link.

func (*PaymentLinks) GetOrders added in v0.9.0

func (s *PaymentLinks) GetOrders(ctx context.Context, linkID string, xAPIVersion string, xRequestID *string, opts ...operations.Option) (*operations.GetPaymentLinkOrdersResponse, error)

GetOrders - Get Orders for a Payment Link Use this API to view all order details for a payment link.

type Payments added in v0.9.0

type Payments struct {
	// contains filtered or unexported fields
}

Payments - Collection of APIs handle payments.

func (*Payments) GetforOrder added in v0.9.0

func (s *Payments) GetforOrder(ctx context.Context, orderID string, xAPIVersion string, xRequestID *string, opts ...operations.Option) (*operations.GetPaymentsforOrderResponse, error)

GetforOrder - Get Payments for an Order Use this API to view all payment details for an order.

func (*Payments) PayOrder added in v0.9.0

func (s *Payments) PayOrder(ctx context.Context, xAPIVersion string, orderPayRequest *shared.OrderPayRequest, xRequestID *string, opts ...operations.Option) (*operations.OrderPayResponse, error)

PayOrder - Order Pay Use this API when you have already created the orders and want # Raj nadna Cashfree to process the payment. To use this API S2S flag needs to be enabled from the backend. In case you want to use the cards payment option the PCI DSS flag is required, for more information send an email to "care@cashfree.com".

func (*Payments) Payment added in v0.9.0

func (s *Payments) Payment(ctx context.Context, cfPaymentID int64, orderID string, xAPIVersion string, xRequestID *string, opts ...operations.Option) (*operations.GetPaymentbyIDResponse, error)

Get Payment by ID Use this API to view payment details of an order for a payment ID.

func (*Payments) PreauthorizeOrder added in v0.9.0

PreauthorizeOrder - Preauthorization Use this API to capture or void a preauthorized payment

func (*Payments) Submit added in v0.9.0

func (s *Payments) Submit(ctx context.Context, paymentID string, xAPIVersion string, otpRequest *shared.OTPRequest, xRequestID *string, opts ...operations.Option) (*operations.SubmitOTPRequestResponse, error)

Submit or Resend OTP If you accept OTP on your own page, you can use the below API to send OTP to Cashfree.

type Refunds added in v0.9.0

type Refunds struct {
	// contains filtered or unexported fields
}

Refunds - Collection of APIs handle refunds.

func (*Refunds) Create added in v0.9.0

Create Refund Use this API to initiate refunds.

func (*Refunds) Get added in v0.9.0

func (s *Refunds) Get(ctx context.Context, orderID string, refundID string, xAPIVersion string, xRequestID *string, opts ...operations.Option) (*operations.GetRefundResponse, error)

Get Refund Use this API to fetch a specific refund processed on your Cashfree Account.

func (*Refunds) GetAllforOrder added in v0.9.0

func (s *Refunds) GetAllforOrder(ctx context.Context, orderID string, xAPIVersion string, xRequestID *string, opts ...operations.Option) (*operations.GetAllRefundsForOrderResponse, error)

GetAllforOrder - Get All Refunds for an Order Use this API to fetch all refunds processed against an order.

type SDKOption

type SDKOption func(*Cashfree)

func WithClient

func WithClient(client HTTPClient) SDKOption

WithClient allows the overriding of the default HTTP client used by the SDK

func WithRetryConfig added in v0.5.0

func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption

func WithSecurity

func WithSecurity(security shared.Security) SDKOption

WithSecurity configures the SDK to use the provided security details

func WithSecuritySource added in v0.7.0

func WithSecuritySource(security func(context.Context) (shared.Security, error)) SDKOption

WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication

func WithServerIndex

func WithServerIndex(serverIndex int) SDKOption

WithServerIndex allows the overriding of the default server by index

func WithServerURL

func WithServerURL(serverURL string) SDKOption

WithServerURL allows the overriding of the default server URL

func WithTemplatedServerURL

func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption

WithTemplatedServerURL allows the overriding of the default server URL with a templated URL populated with the provided parameters

type Settlements added in v0.9.0

type Settlements struct {
	// contains filtered or unexported fields
}

Settlements - Collection of APIs handle settlements.

func (*Settlements) Fetch added in v0.9.0

Fetch - Settlement Reconciliation Use this API to get settlement reconciliation details using Settlement ID, settlement UTR or date range.

func (*Settlements) GetAll added in v0.9.0

GetAll - Get All Settlements Use this API to get all settlement details by specifying the settlement ID, settlement UTR or date range.

func (*Settlements) GetForOrder added in v0.9.0

func (s *Settlements) GetForOrder(ctx context.Context, orderID string, xAPIVersion string, xRequestID *string, opts ...operations.Option) (*operations.GetSettlementsByOrderIDResponse, error)

GetForOrder - Get Settlements by Order ID Use this API to view all the settlements of a particular order.

type SoftPOS added in v0.9.0

type SoftPOS struct {
	// contains filtered or unexported fields
}

SoftPOS - softPOS' agent and order management system now supported by APIs

func (*SoftPOS) CreateTerminals added in v0.9.0

func (s *SoftPOS) CreateTerminals(ctx context.Context, xAPIVersion string, createTerminalRequest *shared.CreateTerminalRequest, xIdempotencyKey *string, xRequestID *string, opts ...operations.Option) (*operations.CreateTerminalsResponse, error)

CreateTerminals - Create Terminal Use this API to create new terminals to use softPOS.

func (*SoftPOS) TerminalStatus added in v0.9.0

func (s *SoftPOS) TerminalStatus(ctx context.Context, terminalPhoneNo string, xAPIVersion string, xRequestID *string, opts ...operations.Option) (*operations.GetTerminalByMobileNumberResponse, error)

TerminalStatus - Get terminal status using phone number Use this API to view all details of a terminal.

type TokenVault added in v0.9.0

type TokenVault struct {
	// contains filtered or unexported fields
}

TokenVault - Cashfree's token Vault helps you save cards and tokenize them in a PCI complaint manner. We support creation of network tokens which can be used across acquiring banks

func (*TokenVault) DeleteSavedInstrument added in v0.9.0

func (s *TokenVault) DeleteSavedInstrument(ctx context.Context, customerID string, instrumentID string, xAPIVersion string, xRequestID *string, opts ...operations.Option) (*operations.DeleteSpecificSavedInstrumentResponse, error)

DeleteSavedInstrument - Delete Saved Instrument To delete a saved instrument for a customer id and instrument id

func (*TokenVault) FetchSavedInstrument added in v0.9.0

func (s *TokenVault) FetchSavedInstrument(ctx context.Context, customerID string, instrumentID string, xAPIVersion string, xRequestID *string, opts ...operations.Option) (*operations.FetchSpecificSavedInstrumentResponse, error)

FetchSavedInstrument - Fetch Single Saved Instrument To get specific saved instrument for a customer id and instrument id

func (*TokenVault) FetchSavedInstrumentCryptogram added in v0.9.0

func (s *TokenVault) FetchSavedInstrumentCryptogram(ctx context.Context, customerID string, instrumentID string, xAPIVersion string, xRequestID *string, opts ...operations.Option) (*operations.FetchCryptogramResponse, error)

FetchSavedInstrumentCryptogram - Fetch cryptogram for saved instrument To get the card network token, token expiry and cryptogram for a saved instrument using instrument id

func (*TokenVault) GetAllSavedInstruments added in v0.9.0

func (s *TokenVault) GetAllSavedInstruments(ctx context.Context, customerID string, instrumentType operations.InstrumentType, xAPIVersion string, xRequestID *string, opts ...operations.Option) (*operations.FetchAllSavedInstrumentsResponse, error)

GetAllSavedInstruments - Fetch All Saved Instruments To get all saved instruments for a customer id

Directories

Path Synopsis
internal
pkg

Jump to

Keyboard shortcuts

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