chargebee

package module
v3.45.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 111 Imported by: 1

README

Chargebee Go Client Library

[!NOTE] Join Discord

We are trialing a Discord server for developers building with Chargebee. Limited spots are open on a first-come basis. Join here if interested.

This is the official Go library for integrating with Chargebee

  • 📘 For a complete reference of available APIs, check out our API Documentation.
  • 🧪 To explore and test API capabilities interactively, head over to our API Explorer.

Go version: v3 and v2 of the library require Go v1.3 or higher.

Library versions


The versioning scheme of this library is inspired by SemVer and the format is v{MAJOR}.{MINOR}.{PATCH}. For example, v3.0.0 and v2.5.1 are valid library versions.

The following table provides some details for each major version:

Library major version Status Compatible API versions Branch
v3 Active v2 and v1 master
v2 Inactive v2 and v1 chargebee-v2

A couple of terms used in the above table are explained below:

  • Status: The current development status for the library version. An Active major version is currently being maintained and continues to get backward-compatible changes.
  • Branch: The branch in this repository containing the source code for the latest release of the library version. Every version of the library has been tagged. You can check out the source code for any version using its tag.

🔴 Attention: The support for v2 will eventually be discontinued on December 31st 2023 and will no longer receive any further updates. We strongly recommend upgrading to v3 as soon as possible.

Note: See the changelog for a history of changes.

Install the library


Install the latest version of the library with the following commands:

Install v3
go get github.com/chargebee/chargebee-go/v3
Install v2
go get github.com/chargebee/chargebee-go

Use the library


Some examples for using the library are listed below.

Create a customer and subscription
import (
  "fmt"
  "github.com/chargebee/chargebee-go/v3"
  subscriptionAction "github.com/chargebee/chargebee-go/v3/actions/subscription"
  "github.com/chargebee/chargebee-go/v3/models/subscription"
)

func main() {
  chargebee.Configure("{site_api_key}", "{site}")
  res, err := subscriptionAction.Create(&subscription.CreateRequestParams{
    PlanId:         "cbdemo_grow",
    BillingCycles:  chargebee.Int32(3),
    AutoCollection: enum.AutoCollectionOff,
    Customer: &subscription.CreateCustomerParams{
      Email:          "john@user.com",
      FirstName:      "John",
      LastName:       "Doe",
      Locale:         "fr-CA",
      Phone:          "+1-949-999-9999",
      AutoCollection: enum.AutoCollectionOff,
    }}).Request()
  if err != nil {
    panic(err)
  }else{
     Subscription := res.Subscription
     Customer := res.Customer
     Invoice := res.Invoice
  }
}
Create a subscription with addons, metadata, and coupons
import (
  "fmt"
  "github.com/chargebee/chargebee-go/v3"
  subscriptionAction "github.com/chargebee/chargebee-go/v3/actions/subscription"
  "github.com/chargebee/chargebee-go/v3/models/subscription"
)

func main() {
  chargebee.Configure("{site_api_key}", "{site}")
  res, err := subscriptionAction.Create(&subscription.CreateRequestParams{
    PlanId:         "cbdemo_grow",
    BillingCycles:  chargebee.Int32(3),
    AutoCollection: enum.AutoCollectionOff,
    Customer: &subscription.CreateCustomerParams{
      Email:          "john@user.com",
      FirstName:      "John",
      LastName:       "Doe",
      Locale:         "fr-CA",
      Phone:          "+1-949-999-9999",
      AutoCollection: enum.AutoCollectionOff,
    },
    BillingAddress: &subscription.CreateBillingAddressParams{
      FirstName: "John",
      LastName:  "Doe",
      Line1:     "PO Box 9999",
      City:      "Walnut",
      State:     "California",
      Zip:       "91789",
      Country:   "US",
    },
    MetaData: map[string]interface{}{
      "features": map[string]interface{}{
        "usage-limit":        "5GB",
        "speed-within-quota": "2MBbps",
        "post-usage-quota":   "512kbps",
      },
    },
    Addons: []*subscription.CreateAddonParams{
      {
        Id: "cbdemo_conciergesupport",
      },
      {
        Id:       "cbdemo_additionaluser",
        Quantity: chargebee.Int32(2),
      },
    },
    CouponIds: []string{"cbdemo_earlybird"},
  }).Request()
  if err != nil {
    panic(err)
  }else{
  Subscription := res.Subscription
  Customer := res.Customer
  Card := res.Card
  Invoice := res.Invoice
  UnbilledCharges := res.UnbilledCharges
  }
}
Create a subscription with custom headers, custom fields and custom context
import (
  "fmt"
  "github.com/chargebee/chargebee-go/v3"
  subscriptionAction "github.com/chargebee/chargebee-go/v3/actions/subscription"
  "github.com/chargebee/chargebee-go/v3/models/subscription"
)

func main() {
  chargebee.Configure("{site_api_key}", "{site}")
  res, err := subscriptionAction.Create(&subscription.CreateRequestParams{
    PlanId: "cbdemo_grow",
  }).Headers("chargebee-request-origin-ip", "192.168.1.2").Contexts(ctx).AddParams("cf_gender","Female").Request() // Customer level custom field. 
  if err != nil {
    panic(err)
  }else{
  Subscription := res.Subscription
  Customer := res.Customer
  Card := res.Card
  Invoice := res.Invoice
  UnbilledCharges := res.UnbilledCharges
  }
}
Retrieve a filtered list of subscriptions
import (
  "fmt"
  "github.com/chargebee/chargebee-go/v3"
  subscriptionAction "github.com/chargebee/chargebee-go/v3/actions/subscription"
  "github.com/chargebee/chargebee-go/v3/filter"
  "github.com/chargebee/chargebee-go/v3/models/subscription"
)

func main() {
  chargebee.Configure("{site_api_key}", "{site}")
  res, err := subscriptionAction.List(&subscription.ListRequestParams{
    Limit: chargebee.Int32(5),
    Id: &filter.StringFilter{
      In: []string{"cbdemo_john-sub", "cbdemo_ricky-sub"},
    },
    PlanId: &filter.StringFilter{
      IsNot: "basic",
    },
    Status: &filter.EnumFilter{
      Is: subscriptionEnum.StatusActive,
    },
    SortBy: &filter.SortFilter{
      Asc: "created_at",
    },
  }).ListRequest()
  if err != nil {
    panic(err)
  }else{
  for i := range res.List {
    Subscription := res.List[i].Subscription
    Customer := res.List[i].Customer
    Card := res.List[i].Card
  }
  }
}
Create an idempotent request

Idempotency keys are passed along with request headers to allow a safe retry of POST requests.

import (
	"fmt"
	"github.com/chargebee/chargebee-go/v3"
	customerAction "github.com/chargebee/chargebee-go/v3/actions/customer"
	"github.com/chargebee/chargebee-go/v3/models/customer"
)

func main() {
    chargebee.Configure("{site_api_key}", "{site}")
	res, err := customerAction.Create(&customer.CreateRequestParams{
		FirstName: "John",
		LastName:  "Doe",
		Email:     "john@test.com",
	})
	.SetIdempotencyKey("ghggh") // Replace <<UUID>> with a unique string
	.Request()
	if err != nil {
		fmt.Println(err)
	} else {
		Customer := res.Customer
		fmt.Println(Customer)
	}
  headerValue := res.GetResponseHeaders() // Retrieves response headers
	fmt.Println(headerValue)
  idempotencyReplayedValue := res.IsIdempotencyReplayed()// Retrieves idempotency replayed header value 
  fmt.Println(idempotencyReplayedValue)
}

IsIdempotencyReplayed() method can be accessed to differentiate between original and replayed requests.

Handle webhooks

Use the webhook package to parse and route webhook payloads from Chargebee.

High-level: route events with callbacks using WebhookHandler:

package main

import (
	"log"
	"net/http"

	"github.com/chargebee/chargebee-go/v3/webhook"
)

func main() {
	handler := &webhook.WebhookHandler{
		// Optional: protect endpoint (e.g., Basic Auth)
		RequestValidator: webhook.BasicAuthValidator(func(user, pass string) bool {
			return user == "admin" && pass == "secret"
		}),
		OnError: webhook.BasicAuthErrorHandler, // Optional: standard auth error responses

		// Register only the events you care about
		OnSubscriptionCreated: func(e webhook.SubscriptionCreatedEvent) error {
			log.Printf("Subscription created event %s", e.Id)
			return nil
		},
		OnPaymentSucceeded: func(e webhook.PaymentSucceededEvent) error {
			log.Printf("Payment succeeded for customer: %v", e.Content.Customer)
			return nil
		},
	}

	http.Handle("/chargebee/webhooks", handler.HTTPHandler())
	log.Fatal(http.ListenAndServe(":8080", nil))
}

Low-level: parse just the event type and unmarshal yourself:

package main

import (
	"encoding/json"
	"io"
	"net/http"

	"github.com/chargebee/chargebee-go/v3/enum"
	"github.com/chargebee/chargebee-go/v3/webhook"
)

func cbWebhook(w http.ResponseWriter, r *http.Request) {
	defer r.Body.Close()
	body, err := io.ReadAll(r.Body)
	if err != nil {
		http.Error(w, err.Error(), http.StatusBadRequest)
		return
	}

	evtType, err := webhook.ParseEventType(body) // validates api_version too
	if err != nil {
		http.Error(w, err.Error(), http.StatusBadRequest)
		return
	}

	switch evtType {
	case enum.EventTypeSubscriptionCreated:
		var e webhook.SubscriptionCreatedEvent
		if err := json.Unmarshal(body, &e); err != nil {
			http.Error(w, err.Error(), http.StatusBadRequest)
			return
		}
		// handle e
	default:
		// ignore or log
	}
	w.WriteHeader(http.StatusOK)
}
Unhandled events

By default, if an incoming webhook’s event type is unknown or you have not registered a corresponding handler on WebhookHandler, the SDK treats it as an error. When using HTTPHandler(), this results in a 500 response unless you provide a custom OnError handler.

If you prefer to acknowledge unknown/unregistered events (return 200) and just log them, set OnUnhandledEvent to a function that returns nil:

import (
	"log"
	"github.com/chargebee/chargebee-go/v3/enum"
	"github.com/chargebee/chargebee-go/v3/webhook"
)

handler := &webhook.WebhookHandler{
	OnUnhandledEvent: func(t enum.EventType, body []byte) error {
		log.Printf("Ignoring unhandled event: %s", t)
		return nil // swallow as OK
	},
}

Use the test suite


Use Testify's require package to run the test suite

go get github.com/stretchr/testify/require

Handle errors


_,err := //Go Library call 

if err != nil {
  if goErr,ok := err.(*chargebee.Error); ok {

    //Identify the type of Error 
    switch goErr.Type {
      
    case chargebee.PaymentError:
      // First check for card parameters entered by the user.
        // We recommend you to validate the input at the client side itself to catch simple mistakes.
        if goErr.Param == "card[number]" {
          // Ask your user to recheck the card number. A better way is to use 
          // Stripe's https://github.com/stripe/jquery.payment for validating it in the client side itself.  
          //}else if(goErr.Param == &lt;other card params&gt;){ 
            //Similarly check for other card parameters entered by the user.
            //....
        } else {
            // Verfication or processing failures.
            // Provide a standard message to your user to recheck his card details or provide a different card.
            // Like  'Sorry,there was a problem when processing your card, please check the details and try again'. 
        }

      case chargebee.InvalidRequestError:
        // For coupons you could decide to provide specific messages by using 
        // the 'api_error_code' attribute in the ex.
        if goErr.Param == "coupon" {
          if goErr.APIErrorCode == "resource_not_found" {
            // Inform user to recheck his coupon code.
          } else if goErr.APIErrorCode == "resource_limit_exhausted" {
            // Inform user that the coupon code has expired.
          } else if goErr.APIErrorCode == "invalid_request" {
            // Inform user that the coupon code is not applicable for his plan(/addons).
          } else {
            // Inform user to recheck his coupon code.
          }
        } else {
          // Since you would have validated all other parameters on your side itself, 
          // this could probably be a bug in your code. Provide a generic message to your users.
        }

    case chargebee.OperationFailedError:
      // Indicates that the request parameters were right but the request couldn't be completed.
        // The reasons might be "api_request_limit_exceeded" or could be due to an issue in ChargeBee side.
        // These should occur very rarely and mostly be of temporary nature. 
        // You could ask your user to retry after some time.
      default :
        // These are unhandled exceptions (Could be due to a bug in your code or very rarely in client library).
          // The errors from ChargeBee such as authentication failures will come here.
            // You could ask users contact your support.     
    }
  }
}
Retry Handling

Chargebee's SDK includes built-in retry logic to handle temporary network issues and server-side errors. This feature is disabled by default but can be enabled when needed.

Key features include:
  • Automatic retries for specific HTTP status codes: Retries are automatically triggered for status codes 500, 502, 503, and 504.
  • Exponential backoff: Retry delays increase exponentially to prevent overwhelming the server.
  • Rate limit management: If a 429 Too Many Requests response is received with a Retry-After header, the SDK waits for the specified duration before retrying.

    Note: Exponential backoff and max retries do not apply in this case.

  • Customizable retry behavior: Retry logic can be configured using the retryConfig parameter in the environment configuration.
Example: Customizing Retry Logic

You can enable and configure the retry logic by passing a retryConfig object when initializing the Chargebee environment:

import (
"fmt"
"github.com/chargebee/chargebee-go/v3"
customerAction "github.com/chargebee/chargebee-go/v3/actions/customer"
"github.com/chargebee/chargebee-go/v3/models/customer"
)

func main() {
    chargebee.Configure("{site_api_key}", "{site}")
    retryConfig := &chargebee.RetryConfig{
        Enabled:       true,
        MaxRetries:    3,
		DelayMs:   500,
        RetryOn: map[int]struct{}{500: {}, 503: {}},
    }
    chargebee.WithRetryConfig(retryConfig)
}

// ... your Chargebee API operations below ...

Example: Rate Limit retry logic

You can enable and configure the retry logic for rate-limit by passing a retryConfig object when initializing the Chargebee environment:

import (
"fmt"
"github.com/chargebee/chargebee-go/v3"
customerAction "github.com/chargebee/chargebee-go/v3/actions/customer"
"github.com/chargebee/chargebee-go/v3/models/customer"
)

func main() {
    chargebee.Configure("{site_api_key}", "{site}")
    retryConfig := &chargebee.RetryConfig{
        Enabled:       true,
        MaxRetries:    3,
        DelayMs:   500,
        RetryOn: map[int]struct{}{429: {}},
    }
    chargebee.WithRetryConfig(retryConfig)
}

// ... your Chargebee API operations below ...

Contribution


You may contribute patches to any of the Active versions of this library. To do so, raise a PR against the respective branch.

If you find something amiss, you are welcome to create an issue.

API documentation


The API documentation for the Go library can be found in our API reference.

License


See the LICENSE.


Documentation

Index

Constants

View Source
const (
	APIVersion = "v2"
	Charset    = "UTF-8"
)
View Source
const (
	IdempotencyHeader       = "chargebee-idempotency-key"
	IdempotencyReplayHeader = "Chargebee-Idempotency-Replayed"
)
View Source
const Version string = "3.45.0"

Variables

View Source
var (
	TotalHTTPTimeout      = 80 * time.Second
	ExportWaitInSecs      = 3 * time.Second
	TimeMachineWaitInSecs = 3 * time.Second
	DefaultEnv            Environment
)

Functions

func Bool

func Bool(val bool) *bool

Bool returns a pointer to the bool value passed.

func BoolValue

func BoolValue(val *bool) bool

BoolValue returns the value of the bool pointer passed or false if the pointer is nil.

func Configure

func Configure(key string, siteName string)

func ErrorHandling

func ErrorHandling(resBody []byte) error

func Float64

func Float64(val float64) *float64

Float64 returns a pointer to the float64 value passed.

func Float64Value

func Float64Value(val *float64) float64

Float64Value returns the value of the float64 pointer passed or 0 if the pointer is nil.

func GetMap

func GetMap(rawMessage json.RawMessage) map[string]interface{}

GetMap is used to unmarshal the json.RawMessage to map[string]interface{}.

func Int32

func Int32(val int32) *int32

Int32 returns a pointer to the int32 value passed.

func Int32Value

func Int32Value(val *int32) int32

Int32Value returns the value of the int32 pointer passed or 0 if the pointer is nil.

func Int64

func Int64(val int64) *int64

Int64 returns a pointer to the int64 value passed.

func Int64Value

func Int64Value(val *int64) int64

Int64Value returns the value of the int64 pointer passed or 0 if the pointer is nil.

func NewDefaultHTTPClient

func NewDefaultHTTPClient() *http.Client

func SerializeListParams

func SerializeListParams(params interface{}) *url.Values

SerializeListParams is to used to serialize the inputParams of list request.

func SerializeParams

func SerializeParams(params interface{}) *url.Values

SerializeParams is to used to serialize the inputParams request . Eg : Customer : { FirstName : "John" } is serialized as "customer[first_name]" : "John".

func UnmarshalJSON

func UnmarshalJSON(response []byte, result interface{}) error

UnmarshalJSON is used to unmarshal the response to Result / ResultList struct.

func UpdateTotalHTTPTimeout

func UpdateTotalHTTPTimeout(timeout time.Duration)

func WithEnableDebugLogs added in v3.34.0

func WithEnableDebugLogs(enabled bool)

func WithEnvironment added in v3.38.1

func WithEnvironment(ctx context.Context, env Environment) context.Context

func WithHTTPClient

func WithHTTPClient(c *http.Client)

func WithRetryConfig added in v3.34.0

func WithRetryConfig(c *RetryConfig)

Types

type CBResponse added in v3.5.0

type CBResponse struct {
	Body []byte
	ResponseMeta
}

func Do

func Do(req *http.Request, isIdempotent bool) (*CBResponse, error)

type Environment

type Environment struct {
	Key             string
	SiteName        string
	ChargebeeDomain string
	Protocol        string
	RetryConfig     *RetryConfig
	EnableDebugLogs bool
}

func DefaultConfig

func DefaultConfig() Environment

type Error

type Error struct {
	HTTPStatusCode int           `json:"http_status_code"`
	Msg            string        `json:"message"`
	Param          string        `json:"param"`
	APIErrorCode   string        `json:"api_error_code"`
	Type           ErrorType     `json:"type"`
	ErrorCode      string        `json:"error_code"`
	Err            error         `json:"_"`
	ErrorCauseID   string        `json:"error_cause_id,omitempty"`
	BatchId        string        `json:"batch_id"`
	FailedEvents   []interface{} `json:"failed_events"`
}

Error is the Response returned when a call is unsuccessful

func (*Error) Error

func (e *Error) Error() string

Error Serializes the error object to JSON and return it as a string.

type ErrorType

type ErrorType string

ErrorType is the list of allowed values for error type.

const (
	PaymentError                         ErrorType = "payment"
	InvalidRequestError                  ErrorType = "invalid_request"
	OperationFailedError                 ErrorType = "operation_failed"
	UbbBatchIngestionInvalidRequestError ErrorType = "ubb_batch_ingestion_invalid_request"
)

type ListRequest added in v3.37.0

type ListRequest = ListRequestObj

func SendList

func SendList(method string, path string, params interface{}) ListRequest

SendList prepares a ListRequest for ListRequest operation.

func (ListRequest) AddParams added in v3.37.0

func (request ListRequest) AddParams(key string, value interface{}) ListRequest

AddParams add a new key-value pair to the ListRequest.Params. This is used to add extra/custom_field params in the request data.

func (ListRequest) Contexts added in v3.37.0

func (request ListRequest) Contexts(ctx context.Context) ListRequest

Context used for request. It may carry deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.

func (ListRequest) Headers added in v3.37.0

func (request ListRequest) Headers(key string, value string) ListRequest

Headers add a new key-value pair to the ListRequest.Header. This is used to add custom headers.

func (ListRequest) ListRequest added in v3.37.0

func (request ListRequest) ListRequest() (*ResultList, error)

func (ListRequest) ListRequestWithEnv added in v3.37.0

func (request ListRequest) ListRequestWithEnv(env Environment) (*ResultList, error)

func (ListRequest) SetIdempotency added in v3.37.0

func (request ListRequest) SetIdempotency(idempotent bool) ListRequest

func (ListRequest) SetIdempotencyKey added in v3.37.0

func (request ListRequest) SetIdempotencyKey(idempotencyKey string) ListRequest

SetIdempotencyKey is used to add idempotency key.

func (ListRequest) SetSubDomain added in v3.37.0

func (request ListRequest) SetSubDomain(subDomain string) ListRequest

type ListRequestObj added in v3.37.0

type ListRequestObj struct {
	Params  *url.Values
	Method  string
	Path    string
	Header  map[string]string
	Context context.Context `form:"-"`

	JsonBody string
	// contains filtered or unexported fields
}

ListRequestObj is the structure that contains the properties of list request data.

type Request added in v3.37.0

type Request = RequestObj

func Send

func Send(method string, path string, params interface{}) Request

Send prepares a RequestObj for Request operation.

func SendJsonRequest added in v3.29.0

func SendJsonRequest(method string, path string, params interface{}) Request

func (Request) AddParams added in v3.37.0

func (request Request) AddParams(key string, value interface{}) Request

AddParams add a new key-value pair to the RequestObj.Params. This is used to add extra/custom_field params in the request data.

func (Request) Contexts added in v3.37.0

func (request Request) Contexts(ctx context.Context) Request

Context used for request. It may carry deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.

func (Request) Headers added in v3.37.0

func (request Request) Headers(key string, value string) Request

Headers add a new key-value pair to the RequestObj.Header . This is used to add custom headers .

func (Request) Request added in v3.37.0

func (request Request) Request() (*Result, error)

func (Request) RequestWithEnv added in v3.37.0

func (request Request) RequestWithEnv(env Environment) (*Result, error)

func (Request) SetIdempotency added in v3.37.0

func (request Request) SetIdempotency(idempotent bool) Request

func (Request) SetIdempotencyKey added in v3.37.0

func (request Request) SetIdempotencyKey(idempotencyKey string) Request

This is used to add idempotency key .

func (Request) SetSubDomain added in v3.37.0

func (request Request) SetSubDomain(subDomain string) Request

type RequestObj

type RequestObj struct {
	Params  *url.Values
	Method  string
	Path    string
	Header  map[string]string
	Context context.Context `form:"-"`

	JsonBody string
	// contains filtered or unexported fields
}

RequestObj is the structure that contains the properties of regular request data.

type ResponseMeta added in v3.5.0

type ResponseMeta struct {
	Headers    http.Header
	Status     string
	StatusCode int
}

type Result

type Result struct {
	Subscription                               *subscription.Subscription                                                             `json:"subscription,omitempty"`
	ContractTerm                               *contractterm.ContractTerm                                                             `json:"contract_term,omitempty"`
	Discount                                   *discount.Discount                                                                     `json:"discount,omitempty"`
	AdvanceInvoiceSchedule                     *advanceinvoiceschedule.AdvanceInvoiceSchedule                                         `json:"advance_invoice_schedule,omitempty"`
	Customer                                   *customer.Customer                                                                     `json:"customer,omitempty"`
	Hierarchy                                  *hierarchy.Hierarchy                                                                   `json:"hierarchy,omitempty"`
	Contact                                    *contact.Contact                                                                       `json:"contact,omitempty"`
	BusinessEntityTransfer                     *businessentitytransfer.BusinessEntityTransfer                                         `json:"business_entity_transfer,omitempty"`
	Token                                      *token.Token                                                                           `json:"token,omitempty"`
	PaymentSource                              *paymentsource.PaymentSource                                                           `json:"payment_source,omitempty"`
	ThirdPartyPaymentMethod                    *thirdpartypaymentmethod.ThirdPartyPaymentMethod                                       `json:"third_party_payment_method,omitempty"`
	VirtualBankAccount                         *virtualbankaccount.VirtualBankAccount                                                 `json:"virtual_bank_account,omitempty"`
	Card                                       *card.Card                                                                             `json:"card,omitempty"`
	PromotionalCredit                          *promotionalcredit.PromotionalCredit                                                   `json:"promotional_credit,omitempty"`
	Invoice                                    *invoice.Invoice                                                                       `json:"invoice,omitempty"`
	PaymentReferenceNumber                     *paymentreferencenumber.PaymentReferenceNumber                                         `json:"payment_reference_number,omitempty"`
	PaymentSchedule                            *paymentschedule.PaymentSchedule                                                       `json:"payment_schedule,omitempty"`
	Einvoice                                   *einvoice.Einvoice                                                                     `json:"einvoice,omitempty"`
	TaxWithheld                                *taxwithheld.TaxWithheld                                                               `json:"tax_withheld,omitempty"`
	CreditNote                                 *creditnote.CreditNote                                                                 `json:"credit_note,omitempty"`
	UnbilledCharge                             *unbilledcharge.UnbilledCharge                                                         `json:"unbilled_charge,omitempty"`
	Order                                      *order.Order                                                                           `json:"order,omitempty"`
	Gift                                       *gift.Gift                                                                             `json:"gift,omitempty"`
	Transaction                                *transaction.Transaction                                                               `json:"transaction,omitempty"`
	HostedPage                                 *hostedpage.HostedPage                                                                 `json:"hosted_page,omitempty"`
	Estimate                                   *estimate.Estimate                                                                     `json:"estimate,omitempty"`
	Quote                                      *quote.Quote                                                                           `json:"quote,omitempty"`
	QuotedSubscription                         *quotedsubscription.QuotedSubscription                                                 `json:"quoted_subscription,omitempty"`
	QuotedCharge                               *quotedcharge.QuotedCharge                                                             `json:"quoted_charge,omitempty"`
	QuotedRamp                                 *quotedramp.QuotedRamp                                                                 `json:"quoted_ramp,omitempty"`
	QuotedDeltaRamp                            *quoteddeltaramp.QuotedDeltaRamp                                                       `json:"quoted_delta_ramp,omitempty"`
	BillingConfiguration                       *billingconfiguration.BillingConfiguration                                             `json:"billing_configuration,omitempty"`
	QuoteLineGroup                             *quotelinegroup.QuoteLineGroup                                                         `json:"quote_line_group,omitempty"`
	Plan                                       *plan.Plan                                                                             `json:"plan,omitempty"`
	Addon                                      *addon.Addon                                                                           `json:"addon,omitempty"`
	Coupon                                     *coupon.Coupon                                                                         `json:"coupon,omitempty"`
	CouponSet                                  *couponset.CouponSet                                                                   `json:"coupon_set,omitempty"`
	CouponCode                                 *couponcode.CouponCode                                                                 `json:"coupon_code,omitempty"`
	Address                                    *address.Address                                                                       `json:"address,omitempty"`
	Usage                                      *usage.Usage                                                                           `json:"usage,omitempty"`
	Event                                      *event.Event                                                                           `json:"event,omitempty"`
	Comment                                    *comment.Comment                                                                       `json:"comment,omitempty"`
	Download                                   *download.Download                                                                     `json:"download,omitempty"`
	PortalSession                              *portalsession.PortalSession                                                           `json:"portal_session,omitempty"`
	SiteMigrationDetail                        *sitemigrationdetail.SiteMigrationDetail                                               `json:"site_migration_detail,omitempty"`
	ResourceMigration                          *resourcemigration.ResourceMigration                                                   `json:"resource_migration,omitempty"`
	TimeMachine                                *timemachine.TimeMachine                                                               `json:"time_machine,omitempty"`
	Export                                     *export.Export                                                                         `json:"export,omitempty"`
	PaymentIntent                              *paymentintent.PaymentIntent                                                           `json:"payment_intent,omitempty"`
	GatewayErrorDetail                         *gatewayerrordetail.GatewayErrorDetail                                                 `json:"gateway_error_detail,omitempty"`
	ItemFamily                                 *itemfamily.ItemFamily                                                                 `json:"item_family,omitempty"`
	Item                                       *item.Item                                                                             `json:"item,omitempty"`
	PriceVariant                               *pricevariant.PriceVariant                                                             `json:"price_variant,omitempty"`
	Attribute                                  *attribute.Attribute                                                                   `json:"attribute,omitempty"`
	ItemPrice                                  *itemprice.ItemPrice                                                                   `json:"item_price,omitempty"`
	AttachedItem                               *attacheditem.AttachedItem                                                             `json:"attached_item,omitempty"`
	DifferentialPrice                          *differentialprice.DifferentialPrice                                                   `json:"differential_price,omitempty"`
	Configuration                              *configuration.Configuration                                                           `json:"configuration,omitempty"`
	Feature                                    *feature.Feature                                                                       `json:"feature,omitempty"`
	ImpactedSubscription                       *impactedsubscription.ImpactedSubscription                                             `json:"impacted_subscription,omitempty"`
	ImpactedItem                               *impacteditem.ImpactedItem                                                             `json:"impacted_item,omitempty"`
	ImpactedItemPrice                          *impacteditemprice.ImpactedItemPrice                                                   `json:"impacted_item_price,omitempty"`
	Metadata                                   *metadata.Metadata                                                                     `json:"metadata,omitempty"`
	SubscriptionEntitlement                    *subscriptionentitlement.SubscriptionEntitlement                                       `json:"subscription_entitlement,omitempty"`
	CustomerEntitlement                        *customerentitlement.CustomerEntitlement                                               `json:"customer_entitlement,omitempty"`
	ItemEntitlement                            *itementitlement.ItemEntitlement                                                       `json:"item_entitlement,omitempty"`
	Entitlement                                *entitlement.Entitlement                                                               `json:"entitlement,omitempty"`
	InAppSubscription                          *inappsubscription.InAppSubscription                                                   `json:"in_app_subscription,omitempty"`
	EntitlementOverride                        *entitlementoverride.EntitlementOverride                                               `json:"entitlement_override,omitempty"`
	BusinessEntity                             *businessentity.BusinessEntity                                                         `json:"business_entity,omitempty"`
	Purchase                                   *purchase.Purchase                                                                     `json:"purchase,omitempty"`
	PaymentVoucher                             *paymentvoucher.PaymentVoucher                                                         `json:"payment_voucher,omitempty"`
	Currency                                   *currency.Currency                                                                     `json:"currency,omitempty"`
	Ramp                                       *ramp.Ramp                                                                             `json:"ramp,omitempty"`
	PaymentScheduleScheme                      *paymentschedulescheme.PaymentScheduleScheme                                           `json:"payment_schedule_scheme,omitempty"`
	PricingPageSession                         *pricingpagesession.PricingPageSession                                                 `json:"pricing_page_session,omitempty"`
	OmnichannelSubscription                    *omnichannelsubscription.OmnichannelSubscription                                       `json:"omnichannel_subscription,omitempty"`
	OmnichannelTransaction                     *omnichanneltransaction.OmnichannelTransaction                                         `json:"omnichannel_transaction,omitempty"`
	OmnichannelSubscriptionItem                *omnichannelsubscriptionitem.OmnichannelSubscriptionItem                               `json:"omnichannel_subscription_item,omitempty"`
	RecordedPurchase                           *recordedpurchase.RecordedPurchase                                                     `json:"recorded_purchase,omitempty"`
	OmnichannelOneTimeOrder                    *omnichannelonetimeorder.OmnichannelOneTimeOrder                                       `json:"omnichannel_one_time_order,omitempty"`
	OmnichannelOneTimeOrderItem                *omnichannelonetimeorderitem.OmnichannelOneTimeOrderItem                               `json:"omnichannel_one_time_order_item,omitempty"`
	Rule                                       *rule.Rule                                                                             `json:"rule,omitempty"`
	UsageEvent                                 *usageevent.UsageEvent                                                                 `json:"usage_event,omitempty"`
	OmnichannelSubscriptionItemScheduledChange *omnichannelsubscriptionitemscheduledchange.OmnichannelSubscriptionItemScheduledChange `json:"omnichannel_subscription_item_scheduled_change,omitempty"`
	UsageFile                                  *usagefile.UsageFile                                                                   `json:"usage_file,omitempty"`
	PersonalizedOffer                          *personalizedoffer.PersonalizedOffer                                                   `json:"personalized_offer,omitempty"`
	Brand                                      *brand.Brand                                                                           `json:"brand,omitempty"`
	OfferFulfillment                           *offerfulfillment.OfferFulfillment                                                     `json:"offer_fulfillment,omitempty"`
	OfferEvent                                 *offerevent.OfferEvent                                                                 `json:"offer_event,omitempty"`
	WebhookEndpoint                            *webhookendpoint.WebhookEndpoint                                                       `json:"webhook_endpoint,omitempty"`
	ImpactedCustomer                           *impactedcustomer.ImpactedCustomer                                                     `json:"impacted_customer,omitempty"`
	SubscriptionEntitlementsUpdatedDetail      *subscriptionentitlementsupdateddetail.SubscriptionEntitlementsUpdatedDetail           `json:"subscription_entitlements_updated_detail,omitempty"`
	SubscriptionEntitlementsCreatedDetail      *subscriptionentitlementscreateddetail.SubscriptionEntitlementsCreatedDetail           `json:"subscription_entitlements_created_detail,omitempty"`
	AdvanceInvoiceSchedules                    []*advanceinvoiceschedule.AdvanceInvoiceSchedule                                       `json:"advance_invoice_schedules,omitempty"`
	Hierarchies                                []*hierarchy.Hierarchy                                                                 `json:"hierarchies,omitempty"`
	Invoices                                   []*invoice.Invoice                                                                     `json:"invoices,omitempty"`
	PaymentSchedules                           []*paymentschedule.PaymentSchedule                                                     `json:"payment_schedules,omitempty"`
	CreditNotes                                []*creditnote.CreditNote                                                               `json:"credit_notes,omitempty"`
	UnbilledCharges                            []*unbilledcharge.UnbilledCharge                                                       `json:"unbilled_charges,omitempty"`
	Downloads                                  []*download.Download                                                                   `json:"downloads,omitempty"`
	Configurations                             []*configuration.Configuration                                                         `json:"configurations,omitempty"`
	InAppSubscriptions                         []*inappsubscription.InAppSubscription                                                 `json:"in_app_subscriptions,omitempty"`
	PersonalizedOffers                         []*personalizedoffer.PersonalizedOffer                                                 `json:"personalized_offers,omitempty"`
	FailedEvents                               interface{}                                                                            `json:"failed_events,omitempty"`
	ExpiresAt                                  interface{}                                                                            `json:"expires_at,omitempty"`
	BatchId                                    interface{}                                                                            `json:"batch_id,omitempty"`
	Success                                    interface{}                                                                            `json:"success,omitempty"`
	ScheduledAt                                interface{}                                                                            `json:"scheduled_at,omitempty"`
	List                                       interface{}                                                                            `json:"list,omitempty"`
	// contains filtered or unexported fields
}

func (*Result) GetHttpStatusCode added in v3.29.0

func (r *Result) GetHttpStatusCode() int

func (*Result) GetResponseHeaders added in v3.5.0

func (r *Result) GetResponseHeaders() http.Header

func (*Result) IsIdempotencyReplayed added in v3.5.0

func (r *Result) IsIdempotencyReplayed() bool

type ResultList

type ResultList struct {
	List       []*Result `json:"list"`
	NextOffset string    `json:"next_offset"`
	// contains filtered or unexported fields
}

func (*ResultList) GetHttpStatusCode added in v3.29.0

func (rl *ResultList) GetHttpStatusCode() int

func (*ResultList) GetResponseHeaders added in v3.5.0

func (rl *ResultList) GetResponseHeaders() http.Header

type RetryConfig added in v3.34.0

type RetryConfig struct {
	Enabled    bool
	MaxRetries int
	DelayMs    int
	RetryOn    map[int]struct{}
}

Directories

Path Synopsis
actions
models

Jump to

Keyboard shortcuts

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