paddle

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

README

Paddle GO SDK

Paddle Billing is a complete digital product sales and subscription management platform, designed for modern software businesses. It helps you increase your revenue, retain customers, and scale your operations.

This is a Go SDK that you can use to integrate Paddle Billing with applications written in server-side Go.

For working with Paddle in your frontend, use Paddle.js. You can open checkouts, securely collect payment information, build pricing pages, and integrate with Paddle Retain.

Important: This package works with Paddle Billing. It does not support Paddle Classic. To work with Paddle Classic, see: Paddle Classic API reference

Learn more

Requirements

Go 1.21 or later

Before you begin

If you've used this SDK, we'd love to hear how you found it! Email us at team-dx@paddle.com with any thoughts.

Installation

Make sure your project is using Go Modules (it will have a go.mod file in its root if it already is):

go mod init

To install the Paddle Go SDK, use the following command:

go get github.com/PaddleHQ/paddle-go-sdk

Then, reference paddle-go-sdk in a Go program with import:

import (
    paddle "github.com/PaddleHQ/paddle-go-sdk"
)

Usage

To authenticate, you'll need an API key. You can create and manage API keys in Paddle > Developer tools > Authentication.

Pass your API key while initializing a new Paddle client.

import (
    paddle "github.com/PaddleHQ/paddle-go-sdk"
)

client, err := paddle.New(
    os.Getenv("PADDLE_API_KEY"),
    paddle.WithBaseURL(paddle.ProductionBaseURL),
)

You can now use the client to make requests to the Paddle API.

Examples

List all entities

You can list supported entities with the List* function. It returns an iterator to help when working with multiple pages.

products, err := client.ListProducts(ctx, &paddle.ListProductsRequest{IncludePrices: true})
if err != nil {
    panic(err)
}

err = products.Iter(ctx, func(p *paddle.Product) (bool, error) {
    // Do something with the product
    fmt.Printf("%+v\n", p)
    return true, nil
})
if err != nil {
    panic(err)
}
Create an entity

You can create a supported entity with the Create* function. It accepts the resource's corresponding Create*Request operation e.g. CreateProductRequest. The created entity is returned.

product, err := client.CreateProduct(ctx, &paddle.CreateProductRequest{
    Name:        "Test Product - GO SDK",
    TaxCategory: paddle.TaxCategoryStandard,
})
if err != nil {
    panic(err)
}
fmt.Printf("%+v\n", product)
Update an entity

You can update a supported entity with the Update* function. It accepts the ID of the entity to update and the corresponding Update*Request operation e.g. UpdateProductRequest. The updated entity is returned.

product, err := client.UpdateProduct(ctx, &paddle.UpdateProductRequest{
    ProductID: product.ID,
    Name:      paddle.NewPatchField("Test Product - GO SDK Updated"),
})
if err != nil {
    panic(err)
}
fmt.Printf("%+v\n", product)
Get an entity

You can get an entity with the Get* function. It accepts the ID of the entity to get and the corresponding Get*Request operation e.g. GetProductRequest. The entity is returned.

product, err := client.GetProduct(ctx, &paddle.GetProductRequest{
    ProductID: productID, 
    IncludePrices: true
})
if err != nil {
    panic(err)
}
fmt.Printf("%+v\n", product)

Resources

Webhook signature verification

The SDK includes a couple of helper functions to verify webhook signatures sent by Notifications from Paddle.

You could use a middleware to verify the signature of the incoming request before processing it.

verifier := paddle.NewWebhookVerifier(os.Getenv("WEBHOOK_SECRET_KEY"))
// Wrap your handler with the verifier.Middleware method
handler := verifier.Middleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
    // The request making it this far means the webhook was verified
    // Best practice here is to check if you have processed this webhook already using the event id
    // At this point you should store for async processing
    // For example a local queue or db entry

    // Respond as soon as possible with a 200 OK
    w.Header().Set("Content-Type", "application/json")
    w.WriteHeader(http.StatusOK)
    w.Write([]byte(`{"success": true}`))
}))

Alternatively you can verify the signature of the incoming request manually.

webhookVerifier := paddle.NewWebhookVerifier(os.Getenv("WEBHOOK_SECRET_KEY"))
// Note: the request (req *http.Request) should be pass exactly as it comes without altering it.
ok, err := webhookVerifier.Verify(req)

Learn more

Documentation

Overview

Code generated by the Paddle SDK Generator; DO NOT EDIT.

Package paddle provides the official SDK for using the Paddle Billing API.

Example (Create)

Demonstrates how to create a new entity.

// Create a mock HTTP server for this example - skip over this bit!
s := mockServerForExample(mockServerResponse{stub: &stub{paths: []stubPath{transaction}}})

// Create a new Paddle client.
client, err := paddle.New(
	os.Getenv("PADDLE_API_KEY"),
	paddle.WithBaseURL(s.URL), // Uses the mock server, you will not need this in your integration.
)

if err != nil {
	fmt.Println(err)
	return
}

ctx := context.Background()

// Optionally set a transit ID on the context. This is useful to link your
// own request IDs to Paddle API requests.
ctx = paddle.ContextWithTransitID(ctx, "sdk-testing-request-1")

// Create a transaction.
res, err := client.CreateTransaction(ctx, &paddle.CreateTransactionRequest{
	Items: []paddle.CreateTransactionItems{
		*paddle.NewCreateTransactionItemsCatalogItem(&paddle.CatalogItem{
			Quantity: 20,
			PriceID:  "pri_01gsz91wy9k1yn7kx82aafwvea",
		}),
		*paddle.NewCreateTransactionItemsCatalogItem(&paddle.CatalogItem{
			Quantity: 1,
			PriceID:  "pri_01gsz96z29d88jrmsf2ztbfgjg",
		}),
		*paddle.NewCreateTransactionItemsCatalogItem(&paddle.CatalogItem{
			Quantity: 1,
			PriceID:  "pri_01gsz98e27ak2tyhexptwc58yk",
		}),
	},
	CustomerID:     paddle.PtrTo("ctm_01hv6y1jedq4p1n0yqn5ba3ky4"),
	AddressID:      paddle.PtrTo("add_01hv8gq3318ktkfengj2r75gfx"),
	CurrencyCode:   paddle.PtrTo(paddle.CurrencyCodeUSD),
	CollectionMode: paddle.PtrTo(paddle.CollectionModeManual),
	BillingDetails: &paddle.BillingDetails{
		EnableCheckout:      false,
		PurchaseOrderNumber: "PO-123",
		PaymentTerms: paddle.Duration{
			Interval:  paddle.IntervalDay,
			Frequency: 14,
		},
	},
	BillingPeriod: &paddle.TimePeriod{
		StartsAt: time.Date(2024, 4, 12, 0, 0, 0, 0, time.UTC).Format(time.RFC3339),
		EndsAt:   time.Date(2024, 4, 12, 0, 0, 0, 0, time.UTC).Format(time.RFC3339),
	},
})

fmt.Println(res.ID, err)
Output:

txn_01hv8m0mnx3sj85e7gxc6kga03 <nil>
Example (Get)

Demonstrates how to get an existing entity.

// Create a mock HTTP server for this example - skip over this bit!
s := mockServerForExample(mockServerResponse{stub: &stub{paths: []stubPath{transaction}}})

// Create a new Paddle client.
client, err := paddle.New(
	os.Getenv("PADDLE_API_KEY"),
	paddle.WithBaseURL(s.URL), // Uses the mock server, you will not need this in your integration.
)

if err != nil {
	fmt.Println(err)
	return
}

ctx := context.Background()

// Optionally set a transit ID on the context. This is useful to link your
// own request IDs to Paddle API requests.
ctx = paddle.ContextWithTransitID(ctx, "sdk-testing-request-1")

// Get a transaction.
res, err := client.GetTransaction(ctx, &paddle.GetTransactionRequest{
	TransactionID: "txn_01hv8m0mnx3sj85e7gxc6kga03",
})

fmt.Println(res.ID, err)
Output:

txn_01hv8m0mnx3sj85e7gxc6kga03 <nil>
Example (List)

Demonstrates how to fetch a list and iterate over the provided results.

// Create a mock HTTP server for this example - skip over this bit!
s := mockServerForExample(mockServerResponse{stub: &stub{paths: []stubPath{transactions}}})

// Create a new Paddle client.
client, err := paddle.New(
	os.Getenv("PADDLE_API_KEY"),
	paddle.WithBaseURL(s.URL), // Uses the mock server, you will not need this in your integration.
)

if err != nil {
	fmt.Println(err)
	return
}

ctx := context.Background()

// Optionally set a transit ID on the context. This is useful to link your
// own request IDs to Paddle API requests.
ctx = paddle.ContextWithTransitID(ctx, "sdk-testing-request-1")

// Get a collection of transactions.
res, err := client.ListTransactions(ctx, &paddle.ListTransactionsRequest{})

// Iterate the transactions.
err = res.Iter(ctx, func(v *paddle.Transaction) (bool, error) {
	fmt.Println(v.ID)
	return true, nil
})
fmt.Println(err)
Output:

txn_01hv8xxw3etar07vaxsqbyqasy
txn_01hv8xbtmb6zc7c264ycteehth
txn_01hv8wptq8987qeep44cyrewp9
<nil>
Example (ListEvents)

Demonstrates how to fetch a list of events and iterate over the provided results.

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	paddle "github.com/PaddleHQ/paddle-go-sdk"
)

// Demonstrates how to fetch a list of events and iterate over the provided results.
func main() {
	// Create a mock HTTP server for this example - skip over this bit!
	s := mockServerForExample(mockServerResponse{stub: &stub{paths: []stubPath{events}}})

	// Create a new Paddle client.
	client, err := paddle.New(
		os.Getenv("PADDLE_API_KEY"),
		paddle.WithBaseURL(s.URL), // Uses the mock server, you will not need this in your integration.
	)

	if err != nil {
		fmt.Println(err)
		return
	}

	ctx := context.Background()

	// Optionally set a transit ID on the context. This is useful to link your
	// own request IDs to Paddle API requests.
	ctx = paddle.ContextWithTransitID(ctx, "sdk-testing-request-1")

	// Get a collection of events.
	res, err := client.ListEvents(ctx, &paddle.ListEventsRequest{})

	// Iterate the events.
	err = res.Iter(ctx, func(e paddle.Event) (bool, error) {
		switch v := e.(type) {
		case *paddle.TransactionCompletedEvent:
			// here v could be used as concrete type TransactionCompletedEvent
			fmt.Println(v.EventID)
			fmt.Println(v.Data.ID)
		case *paddle.TransactionUpdatedEvent:
			// here v could be used as concrete type TransactionUpdatedEvent
			fmt.Println(v.EventID)
			fmt.Println(v.Data.ID)
		default:
			// Unhandled event, we could log and error or covert to GenericEvent
			ge, err := toGenericEvent(v)
			if err != nil {
				return false, err
			}
			fmt.Println(ge.EventID)
		}

		return true, nil
	})
	fmt.Println(err)

}

func toGenericEvent(e paddle.Event) (ge *paddle.GenericEvent, err error) {
	t, err := json.Marshal(e)
	if err != nil {
		return nil, err
	}
	err = json.Unmarshal(t, &ge)
	if err != nil {
		return nil, err
	}

	return ge, nil
}
Output:

evt_01hywqk7y8qfzj69z3pdvz34qt
txn_01hywqfe6yxhxcsfb4ays8mqt3
evt_01hywqfn8b1na40vyarxaxqa9t
txn_01hywqfervkjg6hkk035wy24gt
evt_01hv9771tccgcm4y810d8zbceh
<nil>
Example (ListWithoutPagination)
s := mockServerForExample(mockServerResponse{stub: &stub{paths: []stubPath{
	event_types,
}}})

// Create a new Paddle client.
client, err := paddle.New(
	os.Getenv("PADDLE_API_KEY"),
	paddle.WithBaseURL(s.URL), // Uses the mock server, you will not need this in your integration.
)

if err != nil {
	fmt.Println(err)
	return
}

ctx := context.Background()
// Get a collection of transactions.
res, err := client.ListEventTypes(ctx, &paddle.ListEventTypesRequest{})

// Iterate the transactions which will internally paginate to the next page.
err = res.Iter(ctx, func(v *paddle.EventType) (bool, error) {
	fmt.Println(v.Name)
	return true, nil
})
fmt.Println(err)
Output:

transaction.billed
transaction.canceled
transaction.completed
transaction.created
transaction.paid
transaction.past_due
transaction.payment_failed
transaction.ready
transaction.updated
subscription.activated
subscription.canceled
subscription.created
subscription.imported
subscription.past_due
subscription.paused
subscription.resumed
subscription.trialing
subscription.updated
product.created
product.imported
product.updated
price.created
price.imported
price.updated
customer.created
customer.imported
customer.updated
address.created
address.imported
address.updated
business.created
business.imported
business.updated
adjustment.created
adjustment.updated
payout.created
payout.paid
discount.created
discount.imported
discount.updated
report.created
report.updated
<nil>
Example (Pagination)

Demonstrates how to fetch a list and iterate over the provided results, including the automatic pagination.

// Create a mock HTTP server for this example - skip over this bit!
s := mockServerForExample(mockServerResponse{stub: &stub{paths: []stubPath{
	transactionsPaginatedPg1,
	transactionsPaginatedPg2,
}}})

// Create a new Paddle client.
client, err := paddle.New(
	os.Getenv("PADDLE_API_KEY"),
	paddle.WithBaseURL(s.URL), // Uses the mock server, you will not need this in your integration.
)

if err != nil {
	fmt.Println(err)
	return
}

ctx := context.Background()

// Optionally set a transit ID on the context. This is useful to link your
// own request IDs to Paddle API requests.
ctx = paddle.ContextWithTransitID(ctx, "sdk-testing-request-1")

// Get a collection of transactions.
res, err := client.ListTransactions(ctx, &paddle.ListTransactionsRequest{})

// Iterate the transactions which will internally paginate to the next page.
err = res.Iter(ctx, func(v *paddle.Transaction) (bool, error) {
	fmt.Println(v.ID)
	return true, nil
})
fmt.Println(err)
Output:

txn_01hv8xxw3etar07vaxsqbyqasy
txn_01hv8xbtmb6zc7c264ycteehth
txn_01hv8wptq8987qeep44cyrewp9
txn_01hv8wnvvtedwjrhfhpr9vkq9w
txn_01hv8m0mnx3sj85e7gxc6kga03
txn_01hv8kxg3hxyxs9t471ms9kfsz
<nil>
Example (Update)

Demonstrates how to update an existing entity.

// Create a mock HTTP server for this example - skip over this bit!
s := mockServerForExample(mockServerResponse{stub: &stub{paths: []stubPath{transaction}}})

// Create a new Paddle client.
client, err := paddle.New(
	os.Getenv("PADDLE_API_KEY"),
	paddle.WithBaseURL(s.URL), // Uses the mock server, you will not need this in your integration.
)

if err != nil {
	fmt.Println(err)
	return
}

ctx := context.Background()

// Optionally set a transit ID on the context. This is useful to link your
// own request IDs to Paddle API requests.
ctx = paddle.ContextWithTransitID(ctx, "sdk-testing-request-1")

// Update a transaction.
res, err := client.UpdateTransaction(ctx, &paddle.UpdateTransactionRequest{
	DiscountID: paddle.NewPtrPatchField("dsc_01gtgztp8fpchantd5g1wrksa3"),
	Items: paddle.NewPatchField([]paddle.UpdateTransactionItems{
		*paddle.NewUpdateTransactionItemsCatalogItem(&paddle.CatalogItem{
			Quantity: 50,
			PriceID:  "pri_01gsz91wy9k1yn7kx82aafwvea",
		}),
		*paddle.NewUpdateTransactionItemsCatalogItem(&paddle.CatalogItem{
			Quantity: 1,
			PriceID:  "pri_01gsz96z29d88jrmsf2ztbfgjg",
		}),
		*paddle.NewUpdateTransactionItemsCatalogItem(&paddle.CatalogItem{
			Quantity: 1,
			PriceID:  "pri_01gsz98e27ak2tyhexptwc58yk",
		}),
	}),
})

fmt.Println(res.ID, err)
Output:

txn_01hv8m0mnx3sj85e7gxc6kga03 <nil>

Index

Examples

Constants

View Source
const (
	// ProductionBaseURL is the base URL for the production Paddle API.
	ProductionBaseURL = "https://api.paddle.com"

	// SandboxBaseURL is the base URL for the sandbox Paddle API.
	SandboxBaseURL = "https://sandbox-api.paddle.com"
)

Variables

View Source
var (
	// ErrMissingSignature is returned when the signature is missing.
	ErrMissingSignature = errors.New("missing signature")

	// ErrInvalidSignatureFormat is returned when the signature format is invalid.
	ErrInvalidSignatureFormat = errors.New("invalid signature format")
)
View Source
var ErrAddressLocationNotAllowed = &paddleerr.Error{
	Code: "address_location_not_allowed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAddressLocationNotAllowed represents a `address_location_not_allowed` error. See https://developer.paddle.com/errors/addresses/address_location_not_allowed for more information.

View Source
var ErrAdjustmentAmountAboveRemainingAllowed = &paddleerr.Error{
	Code: "adjustment_amount_above_remaining_allowed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentAmountAboveRemainingAllowed represents a `adjustment_amount_above_remaining_allowed` error. See https://developer.paddle.com/errors/adjustments/adjustment_amount_above_remaining_allowed for more information.

View Source
var ErrAdjustmentAmountCannotBeZero = &paddleerr.Error{
	Code: "adjustment_amount_cannot_be_zero",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentAmountCannotBeZero represents a `adjustment_amount_cannot_be_zero` error. See https://developer.paddle.com/errors/adjustments/adjustment_amount_cannot_be_zero for more information.

View Source
var ErrAdjustmentCannotAdjustImportedTransaction = &paddleerr.Error{
	Code: "adjustment_cannot_adjust_imported_transaction",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentCannotAdjustImportedTransaction represents a `adjustment_cannot_adjust_imported_transaction` error. See https://developer.paddle.com/errors/adjustments/adjustment_cannot_adjust_imported_transaction for more information.

View Source
var ErrAdjustmentInvalidCombinationOfTypes = &paddleerr.Error{
	Code: "adjustment_invalid_combination_of_types",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentInvalidCombinationOfTypes represents a `adjustment_invalid_combination_of_types` error. See https://developer.paddle.com/errors/adjustments/adjustment_invalid_combination_of_types for more information.

View Source
var ErrAdjustmentInvalidCreditAction = &paddleerr.Error{
	Code: "adjustment_invalid_credit_action",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentInvalidCreditAction represents a `adjustment_invalid_credit_action` error. See https://developer.paddle.com/errors/adjustments/adjustment_invalid_credit_action for more information.

View Source
var ErrAdjustmentNoTaxAvailableToAdjust = &paddleerr.Error{
	Code: "adjustment_no_tax_available_to_adjust",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentNoTaxAvailableToAdjust represents a `adjustment_no_tax_available_to_adjust` error. See https://developer.paddle.com/errors/adjustments/adjustment_no_tax_available_to_adjust for more information.

View Source
var ErrAdjustmentPendingRefundRequest = &paddleerr.Error{
	Code: "adjustment_pending_refund_request",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentPendingRefundRequest represents a `adjustment_pending_refund_request` error. See https://developer.paddle.com/errors/adjustments/adjustment_pending_refund_request for more information.

View Source
var ErrAdjustmentTotalAmountAboveRemainingAllowed = &paddleerr.Error{
	Code: "adjustment_total_amount_above_remaining_allowed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentTotalAmountAboveRemainingAllowed represents a `adjustment_total_amount_above_remaining_allowed` error. See https://developer.paddle.com/errors/adjustments/adjustment_total_amount_above_remaining_allowed for more information.

View Source
var ErrAdjustmentTransactionCustomerMismatch = &paddleerr.Error{
	Code: "adjustment_transaction_customer_mismatch",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentTransactionCustomerMismatch represents a `adjustment_transaction_customer_mismatch` error. See https://developer.paddle.com/errors/adjustments/adjustment_transaction_customer_mismatch for more information.

View Source
var ErrAdjustmentTransactionInvalidStatusForCredit = &paddleerr.Error{
	Code: "adjustment_transaction_invalid_status_for_credit",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentTransactionInvalidStatusForCredit represents a `adjustment_transaction_invalid_status_for_credit` error. See https://developer.paddle.com/errors/adjustments/adjustment_transaction_invalid_status_for_credit for more information.

View Source
var ErrAdjustmentTransactionInvalidStatusForRefund = &paddleerr.Error{
	Code: "adjustment_transaction_invalid_status_for_refund",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentTransactionInvalidStatusForRefund represents a `adjustment_transaction_invalid_status_for_refund` error. See https://developer.paddle.com/errors/adjustments/adjustment_transaction_invalid_status_for_refund for more information.

View Source
var ErrAdjustmentTransactionItemHasAlreadyBeenFullyAdjusted = &paddleerr.Error{
	Code: "adjustment_transaction_item_has_already_been_fully_adjusted",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentTransactionItemHasAlreadyBeenFullyAdjusted represents a `adjustment_transaction_item_has_already_been_fully_adjusted` error. See https://developer.paddle.com/errors/adjustments/adjustment_transaction_item_has_already_been_fully_adjusted for more information.

View Source
var ErrAdjustmentTransactionItemInvalid = &paddleerr.Error{
	Code: "adjustment_transaction_item_invalid",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentTransactionItemInvalid represents a `adjustment_transaction_item_invalid` error. See https://developer.paddle.com/errors/adjustments/adjustment_transaction_item_invalid for more information.

View Source
var ErrAdjustmentTransactionItemOverAdjustment = &paddleerr.Error{
	Code: "adjustment_transaction_item_over_adjustment",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentTransactionItemOverAdjustment represents a `adjustment_transaction_item_over_adjustment` error. See https://developer.paddle.com/errors/adjustments/adjustment_transaction_item_over_adjustment for more information.

View Source
var ErrAdjustmentTransactionMissingCustomerID = &paddleerr.Error{
	Code: "adjustment_transaction_missing_customer_id",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentTransactionMissingCustomerID represents a `adjustment_transaction_missing_customer_id` error. See https://developer.paddle.com/errors/adjustments/adjustment_transaction_missing_customer_id for more information.

View Source
var ErrAdjustmentTransactionSubscriptionMismatch = &paddleerr.Error{
	Code: "adjustment_transaction_subscription_mismatch",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAdjustmentTransactionSubscriptionMismatch represents a `adjustment_transaction_subscription_mismatch` error. See https://developer.paddle.com/errors/adjustments/adjustment_transaction_subscription_mismatch for more information.

View Source
var ErrAuthenticationMalformed = &paddleerr.Error{
	Code: "authentication_malformed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAuthenticationMalformed represents a `authentication_malformed` error. See https://developer.paddle.com/errors/shared/authentication_malformed for more information.

View Source
var ErrAuthenticationMissing = &paddleerr.Error{
	Code: "authentication_missing",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrAuthenticationMissing represents a `authentication_missing` error. See https://developer.paddle.com/errors/shared/authentication_missing for more information.

View Source
var ErrBadGateway = &paddleerr.Error{
	Code: "bad_gateway",
	Type: paddleerr.ErrorTypeAPIError,
}

ErrBadGateway represents a `bad_gateway` error. See https://developer.paddle.com/errors/shared/bad_gateway for more information.

View Source
var ErrBadRequest = &paddleerr.Error{
	Code: "bad_request",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrBadRequest represents a `bad_request` error. See https://developer.paddle.com/errors/shared/bad_request for more information.

View Source
var ErrBusinessContactEmailDomainNotAllowed = &paddleerr.Error{
	Code: "business_contact_email_domain_not_allowed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrBusinessContactEmailDomainNotAllowed represents a `business_contact_email_domain_not_allowed` error. See https://developer.paddle.com/errors/businesses/business_contact_email_domain_not_allowed for more information.

View Source
var ErrConcurrentModification = &paddleerr.Error{
	Code: "concurrent_modification",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrConcurrentModification represents a `concurrent_modification` error. See https://developer.paddle.com/errors/shared/concurrent_modification for more information.

View Source
var ErrConflict = &paddleerr.Error{
	Code: "conflict",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrConflict represents a `conflict` error. See https://developer.paddle.com/errors/shared/conflict for more information.

View Source
var ErrCurrencyCodeInvalid = &paddleerr.Error{
	Code: "currency_code_invalid",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrCurrencyCodeInvalid represents a `currency_code_invalid` error. See https://developer.paddle.com/errors/currencies/currency_code_invalid for more information.

View Source
var ErrCurrencyCodesInvalid = &paddleerr.Error{
	Code: "currency_codes_invalid",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrCurrencyCodesInvalid represents a `currency_codes_invalid` error. See https://developer.paddle.com/errors/currencies/currency_codes_invalid for more information.

View Source
var ErrCurrencyPrimaryBalanceInvalid = &paddleerr.Error{
	Code: "currency_primary_balance_invalid",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrCurrencyPrimaryBalanceInvalid represents a `currency_primary_balance_invalid` error. See https://developer.paddle.com/errors/currencies/currency_primary_balance_invalid for more information.

View Source
var ErrCustomerAlreadyExists = &paddleerr.Error{
	Code: "customer_already_exists",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrCustomerAlreadyExists represents a `customer_already_exists` error. See https://developer.paddle.com/errors/customers/customer_already_exists for more information.

View Source
var ErrCustomerEmailDomainNotAllowed = &paddleerr.Error{
	Code: "customer_email_domain_not_allowed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrCustomerEmailDomainNotAllowed represents a `customer_email_domain_not_allowed` error. See https://developer.paddle.com/errors/customers/customer_email_domain_not_allowed for more information.

View Source
var ErrCustomerEmailInvalid = &paddleerr.Error{
	Code: "customer_email_invalid",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrCustomerEmailInvalid represents a `customer_email_invalid` error. See https://developer.paddle.com/errors/customers/customer_email_invalid for more information.

View Source
var ErrDiscountCodeConflict = &paddleerr.Error{
	Code: "discount_code_conflict",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrDiscountCodeConflict represents a `discount_code_conflict` error. See https://developer.paddle.com/errors/discounts/discount_code_conflict for more information.

View Source
var ErrDiscountExpired = &paddleerr.Error{
	Code: "discount_expired",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrDiscountExpired represents a `discount_expired` error. See https://developer.paddle.com/errors/discounts/discount_expired for more information.

View Source
var ErrDiscountRestrictedProductNotActive = &paddleerr.Error{
	Code: "discount_restricted_product_not_active",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrDiscountRestrictedProductNotActive represents a `discount_restricted_product_not_active` error. See https://developer.paddle.com/errors/discounts/discount_restricted_product_not_active for more information.

View Source
var ErrDiscountRestrictedProductPriceNotActive = &paddleerr.Error{
	Code: "discount_restricted_product_price_not_active",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrDiscountRestrictedProductPriceNotActive represents a `discount_restricted_product_price_not_active` error. See https://developer.paddle.com/errors/discounts/discount_restricted_product_price_not_active for more information.

View Source
var ErrDiscountUsageLimitExceeded = &paddleerr.Error{
	Code: "discount_usage_limit_exceeded",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrDiscountUsageLimitExceeded represents a `discount_usage_limit_exceeded` error. See https://developer.paddle.com/errors/discounts/discount_usage_limit_exceeded for more information.

View Source
var ErrDiscountUsageLimitLessThanTimesUsed = &paddleerr.Error{
	Code: "discount_usage_limit_less_than_times_used",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrDiscountUsageLimitLessThanTimesUsed represents a `discount_usage_limit_less_than_times_used` error. See https://developer.paddle.com/errors/discounts/discount_usage_limit_less_than_times_used for more information.

View Source
var ErrEmailNotificationSettingIncorrect = &paddleerr.Error{
	Code: "email_notification_setting_incorrect",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrEmailNotificationSettingIncorrect represents a `email_notification_setting_incorrect` error. See https://developer.paddle.com/errors/notifications/email_notification_setting_incorrect for more information.

View Source
var ErrEntityArchived = &paddleerr.Error{
	Code: "entity_archived",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrEntityArchived represents a `entity_archived` error. See https://developer.paddle.com/errors/shared/entity_archived for more information.

View Source
var ErrForbidden = &paddleerr.Error{
	Code: "forbidden",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrForbidden represents a `forbidden` error. See https://developer.paddle.com/errors/shared/forbidden for more information.

View Source
var ErrInternalError = &paddleerr.Error{
	Code: "internal_error",
	Type: paddleerr.ErrorTypeAPIError,
}

ErrInternalError represents a `internal_error` error. See https://developer.paddle.com/errors/shared/internal_error for more information.

View Source
var ErrInvalidField = &paddleerr.Error{
	Code: "invalid_field",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrInvalidField represents a `invalid_field` error. See https://developer.paddle.com/errors/shared/invalid_field for more information.

View Source
var ErrInvalidJson = &paddleerr.Error{
	Code: "invalid_json",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrInvalidJson represents a `invalid_json` error. See https://developer.paddle.com/errors/shared/invalid_json for more information.

View Source
var ErrInvalidTimeQueryParameter = &paddleerr.Error{
	Code: "invalid_time_query_parameter",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrInvalidTimeQueryParameter represents a `invalid_time_query_parameter` error. See https://developer.paddle.com/errors/shared/invalid_time_query_parameter for more information.

View Source
var ErrInvalidToken = &paddleerr.Error{
	Code: "invalid_token",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrInvalidToken represents a `invalid_token` error. See https://developer.paddle.com/errors/shared/invalid_token for more information.

View Source
var ErrInvalidURL = &paddleerr.Error{
	Code: "invalid_url",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrInvalidURL represents a `invalid_url` error. See https://developer.paddle.com/errors/shared/invalid_url for more information.

View Source
var ErrMethodNotAllowed = &paddleerr.Error{
	Code: "method_not_allowed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrMethodNotAllowed represents a `method_not_allowed` error. See https://developer.paddle.com/errors/shared/method_not_allowed for more information.

View Source
var ErrNotFound = &paddleerr.Error{
	Code: "not_found",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrNotFound represents a `not_found` error. See https://developer.paddle.com/errors/shared/not_found for more information.

View Source
var ErrNotImplemented = &paddleerr.Error{
	Code: "not_implemented",
	Type: paddleerr.ErrorTypeAPIError,
}

ErrNotImplemented represents a `not_implemented` error. See https://developer.paddle.com/errors/shared/not_implemented for more information.

View Source
var ErrNotificationCannotReplay = &paddleerr.Error{
	Code: "notification_cannot_replay",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrNotificationCannotReplay represents a `notification_cannot_replay` error. See https://developer.paddle.com/errors/notifications/notification_cannot_replay for more information.

View Source
var ErrNotificationMaximumActiveSettingsReached = &paddleerr.Error{
	Code: "notification_maximum_active_settings_reached",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrNotificationMaximumActiveSettingsReached represents a `notification_maximum_active_settings_reached` error. See https://developer.paddle.com/errors/notifications/notification_maximum_active_settings_reached for more information.

View Source
var ErrNotificationReplayInvalidOriginType = &paddleerr.Error{
	Code: "notification_replay_invalid_origin_type",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrNotificationReplayInvalidOriginType represents a `notification_replay_invalid_origin_type` error. See https://developer.paddle.com/errors/notifications/notification_replay_invalid_origin_type for more information.

View Source
var ErrPaddleBillingNotEnabled = &paddleerr.Error{
	Code: "paddle_billing_not_enabled",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrPaddleBillingNotEnabled represents a `paddle_billing_not_enabled` error. See https://developer.paddle.com/errors/shared/paddle_billing_not_enabled for more information.

View Source
var ErrPriceBillingCycleFrequencyBelow1 = &paddleerr.Error{
	Code: "price_billing_cycle_frequency_below_1",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrPriceBillingCycleFrequencyBelow1 represents a `price_billing_cycle_frequency_below_1` error. See https://developer.paddle.com/errors/prices/price_billing_cycle_frequency_below_1 for more information.

View Source
var ErrPriceDuplicateCurrencyOverrideForCountry = &paddleerr.Error{
	Code: "price_duplicate_currency_override_for_country",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrPriceDuplicateCurrencyOverrideForCountry represents a `price_duplicate_currency_override_for_country` error. See https://developer.paddle.com/errors/prices/price_duplicate_currency_override_for_country for more information.

View Source
var ErrPriceTrialPeriodFrequencyBelow1 = &paddleerr.Error{
	Code: "price_trial_period_frequency_below_1",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrPriceTrialPeriodFrequencyBelow1 represents a `price_trial_period_frequency_below_1` error. See https://developer.paddle.com/errors/prices/price_trial_period_frequency_below_1 for more information.

View Source
var ErrPriceTrialPeriodMissingFields = &paddleerr.Error{
	Code: "price_trial_period_missing_fields",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrPriceTrialPeriodMissingFields represents a `price_trial_period_missing_fields` error. See https://developer.paddle.com/errors/prices/price_trial_period_missing_fields for more information.

View Source
var ErrPriceTrialPeriodRequiresBillingCycle = &paddleerr.Error{
	Code: "price_trial_period_requires_billing_cycle",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrPriceTrialPeriodRequiresBillingCycle represents a `price_trial_period_requires_billing_cycle` error. See https://developer.paddle.com/errors/prices/price_trial_period_requires_billing_cycle for more information.

View Source
var ErrProductTaxCategoryNotApproved = &paddleerr.Error{
	Code: "product_tax_category_not_approved",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrProductTaxCategoryNotApproved represents a `product_tax_category_not_approved` error. See https://developer.paddle.com/errors/products/product_tax_category_not_approved for more information.

View Source
var ErrReceiptDataNotEnabled = &paddleerr.Error{
	Code: "receipt_data_not_enabled",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrReceiptDataNotEnabled represents a `receipt_data_not_enabled` error. See https://developer.paddle.com/errors/shared/receipt_data_not_enabled for more information.

View Source
var ErrReportCreationLimitExceeded = &paddleerr.Error{
	Code: "report_creation_limit_exceeded",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrReportCreationLimitExceeded represents a `report_creation_limit_exceeded` error. See https://developer.paddle.com/errors/reports/report_creation_limit_exceeded for more information.

View Source
var ErrReportExpired = &paddleerr.Error{
	Code: "report_expired",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrReportExpired represents a `report_expired` error. See https://developer.paddle.com/errors/reports/report_expired for more information.

View Source
var ErrReportFailed = &paddleerr.Error{
	Code: "report_failed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrReportFailed represents a `report_failed` error. See https://developer.paddle.com/errors/reports/report_failed for more information.

View Source
var ErrReportNotReady = &paddleerr.Error{
	Code: "report_not_ready",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrReportNotReady represents a `report_not_ready` error. See https://developer.paddle.com/errors/reports/report_not_ready for more information.

View Source
var ErrServiceUnavailable = &paddleerr.Error{
	Code: "service_unavailable",
	Type: paddleerr.ErrorTypeAPIError,
}

ErrServiceUnavailable represents a `service_unavailable` error. See https://developer.paddle.com/errors/shared/service_unavailable for more information.

View Source
var ErrStopIteration = errors.New("stop iteration")

ErrStopIteration is used as a return from the iteration function to stop the iteration from proceeding. It will ensure that IterErr returns nil.

View Source
var ErrSubscriptionAddressNotSuitableForCollectionMode = &paddleerr.Error{
	Code: "subscription_address_not_suitable_for_collection_mode",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionAddressNotSuitableForCollectionMode represents a `subscription_address_not_suitable_for_collection_mode` error. See https://developer.paddle.com/errors/subscriptions/subscription_address_not_suitable_for_collection_mode for more information.

View Source
var ErrSubscriptionAllItemsRemoved = &paddleerr.Error{
	Code: "subscription_all_items_removed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionAllItemsRemoved represents a `subscription_all_items_removed` error. See https://developer.paddle.com/errors/subscriptions/subscription_all_items_removed for more information.

View Source
var ErrSubscriptionBillingDetailsRequired = &paddleerr.Error{
	Code: "subscription_billing_details_required",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionBillingDetailsRequired represents a `subscription_billing_details_required` error. See https://developer.paddle.com/errors/subscriptions/subscription_billing_details_required for more information.

View Source
var ErrSubscriptionCannotActivate = &paddleerr.Error{
	Code: "subscription_cannot_activate",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionCannotActivate represents a `subscription_cannot_activate` error. See https://developer.paddle.com/errors/subscriptions/subscription_cannot_activate for more information.

View Source
var ErrSubscriptionCannotBePaused = &paddleerr.Error{
	Code: "subscription_cannot_be_paused",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionCannotBePaused represents a `subscription_cannot_be_paused` error. See https://developer.paddle.com/errors/subscriptions/subscription_cannot_be_paused for more information.

View Source
var ErrSubscriptionChargeDuplicatePriceIDs = &paddleerr.Error{
	Code: "subscription_charge_duplicate_price_ids",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionChargeDuplicatePriceIDs represents a `subscription_charge_duplicate_price_ids` error. See https://developer.paddle.com/errors/subscriptions/subscription_charge_duplicate_price_ids for more information.

View Source
var ErrSubscriptionCreditCreationAgainstProcessingTransaction = &paddleerr.Error{
	Code: "subscription_credit_creation_against_processing_transaction",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionCreditCreationAgainstProcessingTransaction represents a `subscription_credit_creation_against_processing_transaction` error. See https://developer.paddle.com/errors/subscriptions/subscription_credit_creation_against_processing_transaction for more information.

View Source
var ErrSubscriptionCreditCreationAgainstUncompletedTransactionNotAllowed = &paddleerr.Error{
	Code: "subscription_credit_creation_against_uncompleted_transaction_not_allowed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionCreditCreationAgainstUncompletedTransactionNotAllowed represents a `subscription_credit_creation_against_uncompleted_transaction_not_allowed` error. See https://developer.paddle.com/errors/subscriptions/subscription_credit_creation_against_uncompleted_transaction_not_allowed for more information.

View Source
var ErrSubscriptionCurrencyCodeIncompatibleWithPaymentMethodProvider = &paddleerr.Error{
	Code: "subscription_currency_code_incompatible_with_payment_method_provider",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionCurrencyCodeIncompatibleWithPaymentMethodProvider represents a `subscription_currency_code_incompatible_with_payment_method_provider` error. See https://developer.paddle.com/errors/subscriptions/subscription_currency_code_incompatible_with_payment_method_provider for more information.

View Source
var ErrSubscriptionCurrencyCodeNotValidForManual = &paddleerr.Error{
	Code: "subscription_currency_code_not_valid_for_manual",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionCurrencyCodeNotValidForManual represents a `subscription_currency_code_not_valid_for_manual` error. See https://developer.paddle.com/errors/subscriptions/subscription_currency_code_not_valid_for_manual for more information.

View Source
var ErrSubscriptionCurrencyUpdateAndActionsCreatingCreditsNotAllowed = &paddleerr.Error{
	Code: "subscription_currency_update_and_actions_creating_credits_not_allowed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionCurrencyUpdateAndActionsCreatingCreditsNotAllowed represents a `subscription_currency_update_and_actions_creating_credits_not_allowed` error. See https://developer.paddle.com/errors/subscriptions/subscription_currency_update_and_actions_creating_credits_not_allowed for more information.

View Source
var ErrSubscriptionCurrencyUpdateNotAllowed = &paddleerr.Error{
	Code: "subscription_currency_update_not_allowed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionCurrencyUpdateNotAllowed represents a `subscription_currency_update_not_allowed` error. See https://developer.paddle.com/errors/subscriptions/subscription_currency_update_not_allowed for more information.

View Source
var ErrSubscriptionCustomerEmailDomainNotAllowed = &paddleerr.Error{
	Code: "subscription_customer_email_domain_not_allowed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionCustomerEmailDomainNotAllowed represents a `subscription_customer_email_domain_not_allowed` error. See https://developer.paddle.com/errors/subscriptions/subscription_customer_email_domain_not_allowed for more information.

View Source
var ErrSubscriptionCustomerNotSuitableForCollectionMode = &paddleerr.Error{
	Code: "subscription_customer_not_suitable_for_collection_mode",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionCustomerNotSuitableForCollectionMode represents a `subscription_customer_not_suitable_for_collection_mode` error. See https://developer.paddle.com/errors/subscriptions/subscription_customer_not_suitable_for_collection_mode for more information.

View Source
var ErrSubscriptionDiscountNotValidForItems = &paddleerr.Error{
	Code: "subscription_discount_not_valid_for_items",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionDiscountNotValidForItems represents a `subscription_discount_not_valid_for_items` error. See https://developer.paddle.com/errors/subscriptions/subscription_discount_not_valid_for_items for more information.

View Source
var ErrSubscriptionDuplicatePriceIDs = &paddleerr.Error{
	Code: "subscription_duplicate_price_ids",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionDuplicatePriceIDs represents a `subscription_duplicate_price_ids` error. See https://developer.paddle.com/errors/subscriptions/subscription_duplicate_price_ids for more information.

View Source
var ErrSubscriptionIncorrectProrationOnPausedSubscription = &paddleerr.Error{
	Code: "subscription_incorrect_proration_on_paused_subscription",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionIncorrectProrationOnPausedSubscription represents a `subscription_incorrect_proration_on_paused_subscription` error. See https://developer.paddle.com/errors/subscriptions/subscription_incorrect_proration_on_paused_subscription for more information.

View Source
var ErrSubscriptionInvalidDiscountCurrency = &paddleerr.Error{
	Code: "subscription_invalid_discount_currency",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionInvalidDiscountCurrency represents a `subscription_invalid_discount_currency` error. See https://developer.paddle.com/errors/subscriptions/subscription_invalid_discount_currency for more information.

View Source
var ErrSubscriptionIsCanceledActionInvalid = &paddleerr.Error{
	Code: "subscription_is_canceled_action_invalid",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionIsCanceledActionInvalid represents a `subscription_is_canceled_action_invalid` error. See https://developer.paddle.com/errors/subscriptions/subscription_is_canceled_action_invalid for more information.

View Source
var ErrSubscriptionIsInactiveActionInvalid = &paddleerr.Error{
	Code: "subscription_is_inactive_action_invalid",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionIsInactiveActionInvalid represents a `subscription_is_inactive_action_invalid` error. See https://developer.paddle.com/errors/subscriptions/subscription_is_inactive_action_invalid for more information.

View Source
var ErrSubscriptionItemsUpdateMissingProrationBillingMode = &paddleerr.Error{
	Code: "subscription_items_update_missing_proration_billing_mode",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionItemsUpdateMissingProrationBillingMode represents a `subscription_items_update_missing_proration_billing_mode` error. See https://developer.paddle.com/errors/subscriptions/subscription_items_update_missing_proration_billing_mode for more information.

View Source
var ErrSubscriptionLockedPendingChanges = &paddleerr.Error{
	Code: "subscription_locked_pending_changes",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionLockedPendingChanges represents a `subscription_locked_pending_changes` error. See https://developer.paddle.com/errors/subscriptions/subscription_locked_pending_changes for more information.

View Source
var ErrSubscriptionLockedProcessing = &paddleerr.Error{
	Code: "subscription_locked_processing",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionLockedProcessing represents a `subscription_locked_processing` error. See https://developer.paddle.com/errors/subscriptions/subscription_locked_processing for more information.

View Source
var ErrSubscriptionLockedRenewal = &paddleerr.Error{
	Code: "subscription_locked_renewal",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionLockedRenewal represents a `subscription_locked_renewal` error. See https://developer.paddle.com/errors/subscriptions/subscription_locked_renewal for more information.

View Source
var ErrSubscriptionManualCollectionModeActivationNotAllowed = &paddleerr.Error{
	Code: "subscription_manual_collection_mode_activation_not_allowed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionManualCollectionModeActivationNotAllowed represents a `subscription_manual_collection_mode_activation_not_allowed` error. See https://developer.paddle.com/errors/subscriptions/subscription_manual_collection_mode_activation_not_allowed for more information.

View Source
var ErrSubscriptionManualRetryPaymentNotAllowed = &paddleerr.Error{
	Code: "subscription_manual_retry_payment_not_allowed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionManualRetryPaymentNotAllowed represents a `subscription_manual_retry_payment_not_allowed` error. See https://developer.paddle.com/errors/subscriptions/subscription_manual_retry_payment_not_allowed for more information.

View Source
var ErrSubscriptionMustBePaused = &paddleerr.Error{
	Code: "subscription_must_be_paused",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionMustBePaused represents a `subscription_must_be_paused` error. See https://developer.paddle.com/errors/subscriptions/subscription_must_be_paused for more information.

View Source
var ErrSubscriptionNewItemsNotValid = &paddleerr.Error{
	Code: "subscription_new_items_not_valid",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionNewItemsNotValid represents a `subscription_new_items_not_valid` error. See https://developer.paddle.com/errors/subscriptions/subscription_new_items_not_valid for more information.

View Source
var ErrSubscriptionNextBilledAtTooSoon = &paddleerr.Error{
	Code: "subscription_next_billed_at_too_soon",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionNextBilledAtTooSoon represents a `subscription_next_billed_at_too_soon` error. See https://developer.paddle.com/errors/subscriptions/subscription_next_billed_at_too_soon for more information.

View Source
var ErrSubscriptionNoRecurringItemsRemain = &paddleerr.Error{
	Code: "subscription_no_recurring_items_remain",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionNoRecurringItemsRemain represents a `subscription_no_recurring_items_remain` error. See https://developer.paddle.com/errors/subscriptions/subscription_no_recurring_items_remain for more information.

View Source
var ErrSubscriptionNotActive = &paddleerr.Error{
	Code: "subscription_not_active",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionNotActive represents a `subscription_not_active` error. See https://developer.paddle.com/errors/subscriptions/subscription_not_active for more information.

View Source
var ErrSubscriptionNotAutomaticCollection = &paddleerr.Error{
	Code: "subscription_not_automatic_collection",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionNotAutomaticCollection represents a `subscription_not_automatic_collection` error. See https://developer.paddle.com/errors/subscriptions/subscription_not_automatic_collection for more information.

View Source
var ErrSubscriptionOneOffDiscountNotValid = &paddleerr.Error{
	Code: "subscription_one_off_discount_not_valid",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionOneOffDiscountNotValid represents a `subscription_one_off_discount_not_valid` error. See https://developer.paddle.com/errors/subscriptions/subscription_one_off_discount_not_valid for more information.

View Source
var ErrSubscriptionOnlyUpdateItemsOnPausedSubscription = &paddleerr.Error{
	Code: "subscription_only_update_items_on_paused_subscription",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionOnlyUpdateItemsOnPausedSubscription represents a `subscription_only_update_items_on_paused_subscription` error. See https://developer.paddle.com/errors/subscriptions/subscription_only_update_items_on_paused_subscription for more information.

View Source
var ErrSubscriptionOutstandingPendingRefund = &paddleerr.Error{
	Code: "subscription_outstanding_pending_refund",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionOutstandingPendingRefund represents a `subscription_outstanding_pending_refund` error. See https://developer.paddle.com/errors/subscriptions/subscription_outstanding_pending_refund for more information.

View Source
var ErrSubscriptionOutstandingTransaction = &paddleerr.Error{
	Code: "subscription_outstanding_transaction",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionOutstandingTransaction represents a `subscription_outstanding_transaction` error. See https://developer.paddle.com/errors/subscriptions/subscription_outstanding_transaction for more information.

View Source
var ErrSubscriptionPaymentDeclined = &paddleerr.Error{
	Code: "subscription_payment_declined",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionPaymentDeclined represents a `subscription_payment_declined` error. See https://developer.paddle.com/errors/subscriptions/subscription_payment_declined for more information.

View Source
var ErrSubscriptionPaymentRetryAttemptsExceeded = &paddleerr.Error{
	Code: "subscription_payment_retry_attempts_exceeded",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionPaymentRetryAttemptsExceeded represents a `subscription_payment_retry_attempts_exceeded` error. See https://developer.paddle.com/errors/subscriptions/subscription_payment_retry_attempts_exceeded for more information.

View Source
var ErrSubscriptionProductTaxCategoryNotApproved = &paddleerr.Error{
	Code: "subscription_product_tax_category_not_approved",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionProductTaxCategoryNotApproved represents a `subscription_product_tax_category_not_approved` error. See https://developer.paddle.com/errors/subscriptions/subscription_product_tax_category_not_approved for more information.

View Source
var ErrSubscriptionQuantityMissingForNewItems = &paddleerr.Error{
	Code: "subscription_quantity_missing_for_new_items",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionQuantityMissingForNewItems represents a `subscription_quantity_missing_for_new_items` error. See https://developer.paddle.com/errors/subscriptions/subscription_quantity_missing_for_new_items for more information.

View Source
var ErrSubscriptionQuantityNotValid = &paddleerr.Error{
	Code: "subscription_quantity_not_valid",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionQuantityNotValid represents a `subscription_quantity_not_valid` error. See https://developer.paddle.com/errors/subscriptions/subscription_quantity_not_valid for more information.

View Source
var ErrSubscriptionScheduledChangeInvalidUpdate = &paddleerr.Error{
	Code: "subscription_scheduled_change_invalid_update",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionScheduledChangeInvalidUpdate represents a `subscription_scheduled_change_invalid_update` error. See https://developer.paddle.com/errors/subscriptions/subscription_scheduled_change_invalid_update for more information.

View Source
var ErrSubscriptionTrialingDiscountUpdateInvalidOptions = &paddleerr.Error{
	Code: "subscription_trialing_discount_update_invalid_options",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionTrialingDiscountUpdateInvalidOptions represents a `subscription_trialing_discount_update_invalid_options` error. See https://developer.paddle.com/errors/subscriptions/subscription_trialing_discount_update_invalid_options for more information.

View Source
var ErrSubscriptionTrialingItemsUpdateInvalidOptions = &paddleerr.Error{
	Code: "subscription_trialing_items_update_invalid_options",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionTrialingItemsUpdateInvalidOptions represents a `subscription_trialing_items_update_invalid_options` error. See https://developer.paddle.com/errors/subscriptions/subscription_trialing_items_update_invalid_options for more information.

View Source
var ErrSubscriptionUpdateCausingCustomerMismatchNotAllowed = &paddleerr.Error{
	Code: "subscription_update_causing_customer_mismatch_not_allowed",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionUpdateCausingCustomerMismatchNotAllowed represents a `subscription_update_causing_customer_mismatch_not_allowed` error. See https://developer.paddle.com/errors/subscriptions/subscription_update_causing_customer_mismatch_not_allowed for more information.

View Source
var ErrSubscriptionUpdateDifferentCurrencyCredits = &paddleerr.Error{
	Code: "subscription_update_different_currency_credits",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionUpdateDifferentCurrencyCredits represents a `subscription_update_different_currency_credits` error. See https://developer.paddle.com/errors/subscriptions/subscription_update_different_currency_credits for more information.

View Source
var ErrSubscriptionUpdateTransactionBalanceLessThanChargeLimit = &paddleerr.Error{
	Code: "subscription_update_transaction_balance_less_than_charge_limit",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionUpdateTransactionBalanceLessThanChargeLimit represents a `subscription_update_transaction_balance_less_than_charge_limit` error. See https://developer.paddle.com/errors/subscriptions/subscription_update_transaction_balance_less_than_charge_limit for more information.

View Source
var ErrSubscriptionUpdateWhenCanceled = &paddleerr.Error{
	Code: "subscription_update_when_canceled",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionUpdateWhenCanceled represents a `subscription_update_when_canceled` error. See https://developer.paddle.com/errors/subscriptions/subscription_update_when_canceled for more information.

View Source
var ErrSubscriptionUpdateWhenPastDue = &paddleerr.Error{
	Code: "subscription_update_when_past_due",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionUpdateWhenPastDue represents a `subscription_update_when_past_due` error. See https://developer.paddle.com/errors/subscriptions/subscription_update_when_past_due for more information.

View Source
var ErrSubscriptionUpdateWhenTrialing = &paddleerr.Error{
	Code: "subscription_update_when_trialing",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrSubscriptionUpdateWhenTrialing represents a `subscription_update_when_trialing` error. See https://developer.paddle.com/errors/subscriptions/subscription_update_when_trialing for more information.

View Source
var ErrTooManyRequests = &paddleerr.Error{
	Code: "too_many_requests",
	Type: paddleerr.ErrorTypeAPIError,
}

ErrTooManyRequests represents a `too_many_requests` error. See https://developer.paddle.com/errors/shared/too_many_requests for more information.

View Source
var ErrTransactionAddressNotSuitableForCollectionMode = &paddleerr.Error{
	Code: "transaction_address_not_suitable_for_collection_mode",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionAddressNotSuitableForCollectionMode represents a `transaction_address_not_suitable_for_collection_mode` error. See https://developer.paddle.com/errors/transactions/transaction_address_not_suitable_for_collection_mode for more information.

View Source
var ErrTransactionBalanceLessThanChargeLimit = &paddleerr.Error{
	Code: "transaction_balance_less_than_charge_limit",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionBalanceLessThanChargeLimit represents a `transaction_balance_less_than_charge_limit` error. See https://developer.paddle.com/errors/transactions/transaction_balance_less_than_charge_limit for more information.

View Source
var ErrTransactionBillingDetailsMustBeNull = &paddleerr.Error{
	Code: "transaction_billing_details_must_be_null",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionBillingDetailsMustBeNull represents a `transaction_billing_details_must_be_null` error. See https://developer.paddle.com/errors/transactions/transaction_billing_details_must_be_null for more information.

View Source
var ErrTransactionBillingDetailsObjectRequired = &paddleerr.Error{
	Code: "transaction_billing_details_object_required",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionBillingDetailsObjectRequired represents a `transaction_billing_details_object_required` error. See https://developer.paddle.com/errors/transactions/transaction_billing_details_object_required for more information.

View Source
var ErrTransactionBillingPeriodStartsAtGreaterThanNow = &paddleerr.Error{
	Code: "transaction_billing_period_starts_at_greater_than_now",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionBillingPeriodStartsAtGreaterThanNow represents a `transaction_billing_period_starts_at_greater_than_now` error. See https://developer.paddle.com/errors/transactions/transaction_billing_period_starts_at_greater_than_now for more information.

View Source
var ErrTransactionBothPriceIDAndObjectFound = &paddleerr.Error{
	Code: "transaction_both_price_id_and_object_found",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionBothPriceIDAndObjectFound represents a `transaction_both_price_id_and_object_found` error. See https://developer.paddle.com/errors/transactions/transaction_both_price_id_and_object_found for more information.

View Source
var ErrTransactionCannotBeModifiedAndCanceled = &paddleerr.Error{
	Code: "transaction_cannot_be_modified_and_canceled",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionCannotBeModifiedAndCanceled represents a `transaction_cannot_be_modified_and_canceled` error. See https://developer.paddle.com/errors/transactions/transaction_cannot_be_modified_and_canceled for more information.

View Source
var ErrTransactionCannotProvideBothDiscountCodeAndID = &paddleerr.Error{
	Code: "transaction_cannot_provide_both_discount_code_and_id",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionCannotProvideBothDiscountCodeAndID represents a `transaction_cannot_provide_both_discount_code_and_id` error. See https://developer.paddle.com/errors/transactions/transaction_cannot_provide_both_discount_code_and_id for more information.

View Source
var ErrTransactionCheckoutNotEnabled = &paddleerr.Error{
	Code: "transaction_checkout_not_enabled",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionCheckoutNotEnabled represents a `transaction_checkout_not_enabled` error. See https://developer.paddle.com/errors/transactions/transaction_checkout_not_enabled for more information.

View Source
var ErrTransactionCheckoutURLDomainIsNotApproved = &paddleerr.Error{
	Code: "transaction_checkout_url_domain_is_not_approved",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionCheckoutURLDomainIsNotApproved represents a `transaction_checkout_url_domain_is_not_approved` error. See https://developer.paddle.com/errors/transactions/transaction_checkout_url_domain_is_not_approved for more information.

View Source
var ErrTransactionCurrencyCodeNotValidForManual = &paddleerr.Error{
	Code: "transaction_currency_code_not_valid_for_manual",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionCurrencyCodeNotValidForManual represents a `transaction_currency_code_not_valid_for_manual` error. See https://developer.paddle.com/errors/transactions/transaction_currency_code_not_valid_for_manual for more information.

View Source
var ErrTransactionCustomerIsRequiredForBusinessValidation = &paddleerr.Error{
	Code: "transaction_customer_is_required_for_business_validation",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionCustomerIsRequiredForBusinessValidation represents a `transaction_customer_is_required_for_business_validation` error. See https://developer.paddle.com/errors/transactions/transaction_customer_is_required_for_business_validation for more information.

View Source
var ErrTransactionCustomerIsRequiredWithAddress = &paddleerr.Error{
	Code: "transaction_customer_is_required_with_address",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionCustomerIsRequiredWithAddress represents a `transaction_customer_is_required_with_address` error. See https://developer.paddle.com/errors/transactions/transaction_customer_is_required_with_address for more information.

View Source
var ErrTransactionCustomerNotSuitableForCollectionMode = &paddleerr.Error{
	Code: "transaction_customer_not_suitable_for_collection_mode",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionCustomerNotSuitableForCollectionMode represents a `transaction_customer_not_suitable_for_collection_mode` error. See https://developer.paddle.com/errors/transactions/transaction_customer_not_suitable_for_collection_mode for more information.

View Source
var ErrTransactionDefaultCheckoutURLNotSet = &paddleerr.Error{
	Code: "transaction_default_checkout_url_not_set",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionDefaultCheckoutURLNotSet represents a `transaction_default_checkout_url_not_set` error. See https://developer.paddle.com/errors/transactions/transaction_default_checkout_url_not_set for more information.

View Source
var ErrTransactionDiscountNotEligible = &paddleerr.Error{
	Code: "transaction_discount_not_eligible",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionDiscountNotEligible represents a `transaction_discount_not_eligible` error. See https://developer.paddle.com/errors/transactions/transaction_discount_not_eligible for more information.

View Source
var ErrTransactionDiscountNotFound = &paddleerr.Error{
	Code: "transaction_discount_not_found",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionDiscountNotFound represents a `transaction_discount_not_found` error. See https://developer.paddle.com/errors/transactions/transaction_discount_not_found for more information.

View Source
var ErrTransactionDuplicatePriceIDs = &paddleerr.Error{
	Code: "transaction_duplicate_price_ids",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionDuplicatePriceIDs represents a `transaction_duplicate_price_ids` error. See https://developer.paddle.com/errors/transactions/transaction_duplicate_price_ids for more information.

View Source
var ErrTransactionImmutable = &paddleerr.Error{
	Code: "transaction_immutable",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionImmutable represents a `transaction_immutable` error. See https://developer.paddle.com/errors/transactions/transaction_immutable for more information.

View Source
var ErrTransactionInvalidDiscountCurrency = &paddleerr.Error{
	Code: "transaction_invalid_discount_currency",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionInvalidDiscountCurrency represents a `transaction_invalid_discount_currency` error. See https://developer.paddle.com/errors/transactions/transaction_invalid_discount_currency for more information.

View Source
var ErrTransactionInvalidStatusChange = &paddleerr.Error{
	Code: "transaction_invalid_status_change",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionInvalidStatusChange represents a `transaction_invalid_status_change` error. See https://developer.paddle.com/errors/transactions/transaction_invalid_status_change for more information.

View Source
var ErrTransactionItemQuantityOutOfRange = &paddleerr.Error{
	Code: "transaction_item_quantity_out_of_range",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionItemQuantityOutOfRange represents a `transaction_item_quantity_out_of_range` error. See https://developer.paddle.com/errors/transactions/transaction_item_quantity_out_of_range for more information.

View Source
var ErrTransactionNotReadyCannotProcessPayment = &paddleerr.Error{
	Code: "transaction_not_ready_cannot_process_payment",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionNotReadyCannotProcessPayment represents a `transaction_not_ready_cannot_process_payment` error. See https://developer.paddle.com/errors/transactions/transaction_not_ready_cannot_process_payment for more information.

View Source
var ErrTransactionPaymentMethodChangeFieldImmutable = &paddleerr.Error{
	Code: "transaction_payment_method_change_field_immutable",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionPaymentMethodChangeFieldImmutable represents a `transaction_payment_method_change_field_immutable` error. See https://developer.paddle.com/errors/transactions/transaction_payment_method_change_field_immutable for more information.

View Source
var ErrTransactionPaymentTermsObjectRequired = &paddleerr.Error{
	Code: "transaction_payment_terms_object_required",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionPaymentTermsObjectRequired represents a `transaction_payment_terms_object_required` error. See https://developer.paddle.com/errors/transactions/transaction_payment_terms_object_required for more information.

View Source
var ErrTransactionPayoutAccountRequired = &paddleerr.Error{
	Code: "transaction_payout_account_required",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionPayoutAccountRequired represents a `transaction_payout_account_required` error. See https://developer.paddle.com/errors/transactions/transaction_payout_account_required for more information.

View Source
var ErrTransactionPreviewAdjustmentSubscriptionConflict = &paddleerr.Error{
	Code: "transaction_preview_adjustment_subscription_conflict",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionPreviewAdjustmentSubscriptionConflict represents a `transaction_preview_adjustment_subscription_conflict` error. See https://developer.paddle.com/errors/transactions/transaction_preview_adjustment_subscription_conflict for more information.

View Source
var ErrTransactionPriceDifferentBillingCycle = &paddleerr.Error{
	Code: "transaction_price_different_billing_cycle",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionPriceDifferentBillingCycle represents a `transaction_price_different_billing_cycle` error. See https://developer.paddle.com/errors/transactions/transaction_price_different_billing_cycle for more information.

View Source
var ErrTransactionPriceDifferentTrialPeriod = &paddleerr.Error{
	Code: "transaction_price_different_trial_period",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionPriceDifferentTrialPeriod represents a `transaction_price_different_trial_period` error. See https://developer.paddle.com/errors/transactions/transaction_price_different_trial_period for more information.

View Source
var ErrTransactionPriceNotFound = &paddleerr.Error{
	Code: "transaction_price_not_found",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionPriceNotFound represents a `transaction_price_not_found` error. See https://developer.paddle.com/errors/transactions/transaction_price_not_found for more information.

View Source
var ErrTransactionProductNotFound = &paddleerr.Error{
	Code: "transaction_product_not_found",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionProductNotFound represents a `transaction_product_not_found` error. See https://developer.paddle.com/errors/transactions/transaction_product_not_found for more information.

View Source
var ErrTransactionRecurringBalanceLessThanChargeLimit = &paddleerr.Error{
	Code: "transaction_recurring_balance_less_than_charge_limit",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionRecurringBalanceLessThanChargeLimit represents a `transaction_recurring_balance_less_than_charge_limit` error. See https://developer.paddle.com/errors/transactions/transaction_recurring_balance_less_than_charge_limit for more information.

View Source
var ErrTransactionStatusMustBeReady = &paddleerr.Error{
	Code: "transaction_status_must_be_ready",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrTransactionStatusMustBeReady represents a `transaction_status_must_be_ready` error. See https://developer.paddle.com/errors/transactions/transaction_status_must_be_ready for more information.

View Source
var ErrURLNotificationSettingIncorrect = &paddleerr.Error{
	Code: "url_notification_setting_incorrect",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrURLNotificationSettingIncorrect represents a `url_notification_setting_incorrect` error. See https://developer.paddle.com/errors/notifications/url_notification_setting_incorrect for more information.

View Source
var ErrUnsupportedMediaType = &paddleerr.Error{
	Code: "unsupported_media_type",
	Type: paddleerr.ErrorTypeRequestError,
}

ErrUnsupportedMediaType represents a `unsupported_media_type` error. See https://developer.paddle.com/errors/shared/unsupported_media_type for more information.

Functions

func ContextWithTransitID

func ContextWithTransitID(ctx context.Context, transitID string) context.Context

ContextWithTransitID returns a new context with the provided transitID. This transit ID will then be present in requests to the Paddle API where this context is used. These can be used by Paddle support to aid in debugging your integration.

func PtrTo

func PtrTo[V any](v V) *V

PtrTo creates a pointer from a given value.

Types

type ActivateSubscriptionRequest

type ActivateSubscriptionRequest struct {
	// URL path parameters.
	SubscriptionID string `in:"path=subscription_id" json:"-"`
}

ActivateSubscriptionRequest is given as an input to ActivateSubscription.

type Address

type Address struct {
	// ID: Unique Paddle ID for this address entity, prefixed with `add_`.
	ID string `json:"id,omitempty"`
	// CustomerID: Paddle ID for the customer related to this address, prefixed with `cus_`.
	CustomerID string `json:"customer_id,omitempty"`
	// Description: Memorable description for this address.
	Description *string `json:"description,omitempty"`
	// FirstLine: First line of this address.
	FirstLine *string `json:"first_line,omitempty"`
	// SecondLine: Second line of this address.
	SecondLine *string `json:"second_line,omitempty"`
	// City: City of this address.
	City *string `json:"city,omitempty"`
	// PostalCode: ZIP or postal code of this address. Required for some countries.
	PostalCode *string `json:"postal_code,omitempty"`
	// Region: State, county, or region of this address.
	Region *string `json:"region,omitempty"`
	// CountryCode: Supported two-letter ISO 3166-1 alpha-2 country code for this address.
	CountryCode CountryCode `json:"country_code,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
	// Status: Whether this entity can be used in Paddle.
	Status Status `json:"status,omitempty"`
	// CreatedAt: RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
	CreatedAt string `json:"created_at,omitempty"`
	// UpdatedAt: RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
	UpdatedAt string `json:"updated_at,omitempty"`
	// ImportMeta: Import information for this entity. `null` if this entity is not imported.
	ImportMeta *ImportMeta `json:"import_meta,omitempty"`
}

Address: Address for this transaction. Returned when the `include` parameter is used with the `address` value and the transaction has an `address_id`.

type AddressCreatedEvent added in v0.2.1

type AddressCreatedEvent struct {
	GenericEvent
	Data paddlenotification.AddressNotification `json:"data"`
}

AddressCreatedEvent represents an Event implementation for address.created event.

type AddressImportedEvent added in v0.2.1

type AddressImportedEvent struct {
	GenericEvent
	Data paddlenotification.AddressNotification `json:"data"`
}

AddressImportedEvent represents an Event implementation for address.imported event.

type AddressPreview

type AddressPreview struct {
	// PostalCode: ZIP or postal code of this address. Include for more accurate tax calculations.
	PostalCode *string `json:"postal_code,omitempty"`
	// CountryCode: Supported two-letter ISO 3166-1 alpha-2 country code for this address.
	CountryCode CountryCode `json:"country_code,omitempty"`
}

AddressPreview: Address for this preview. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.

type AddressUpdatedEvent added in v0.2.1

type AddressUpdatedEvent struct {
	GenericEvent
	Data paddlenotification.AddressNotification `json:"data"`
}

AddressUpdatedEvent represents an Event implementation for address.updated event.

type AddressesClient

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

AddressesClient is a client for the Addresses resource.

func (*AddressesClient) CreateAddress

func (c *AddressesClient) CreateAddress(ctx context.Context, req *CreateAddressRequest) (res *Address, err error)

CreateAddress performs the POST operation on a Addresses resource.

func (*AddressesClient) GetAddress

func (c *AddressesClient) GetAddress(ctx context.Context, req *GetAddressRequest) (res *Address, err error)

GetAddress performs the GET operation on a Addresses resource.

func (*AddressesClient) ListAddresses

func (c *AddressesClient) ListAddresses(ctx context.Context, req *ListAddressesRequest) (res *Collection[*Address], err error)

ListAddresses performs the GET operation on a Addresses resource.

func (*AddressesClient) UpdateAddress

func (c *AddressesClient) UpdateAddress(ctx context.Context, req *UpdateAddressRequest) (res *Address, err error)

UpdateAddress performs the PATCH operation on a Addresses resource.

type Adjustment

type Adjustment struct {
	// ID: Unique Paddle ID for this adjustment entity, prefixed with `adj_`.
	ID string `json:"id,omitempty"`
	// Action: How this adjustment impacts the related transaction.
	Action AdjustmentAction `json:"action,omitempty"`
	// TransactionID: Paddle ID of the transaction that this adjustment is for, prefixed with `txn_`.
	TransactionID string `json:"transaction_id,omitempty"`
	/*
	   SubscriptionID: Paddle ID for the subscription related to this adjustment, prefixed with `sub_`.
	   Set automatically by Paddle based on the `subscription_id` of the related transaction.
	*/
	SubscriptionID *string `json:"subscription_id,omitempty"`
	/*
	   CustomerID: Paddle ID for the customer related to this adjustment, prefixed with `ctm_`.
	   Set automatically by Paddle based on the `customer_id` of the related transaction.
	*/
	CustomerID string `json:"customer_id,omitempty"`
	// Reason: Why this adjustment was created. Appears in the Paddle dashboard. Retained for record-keeping purposes.
	Reason string `json:"reason,omitempty"`
	/*
	   CreditAppliedToBalance: Whether this adjustment was applied to the related customer's credit balance. Only returned for `credit` adjustments.

	   `false` where the related transaction is `billed`. The adjustment reduces the amount due on the transaction.

	   `true` where the related transaction is `completed`. The amount is added the customer's credit balance and used to pay future transactions.
	*/
	CreditAppliedToBalance *bool `json:"credit_applied_to_balance,omitempty"`
	// CurrencyCode: Three-letter ISO 4217 currency code for this adjustment. Set automatically by Paddle based on the `currency_code` of the related transaction.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
	/*
	   Status: Status of this adjustment. Set automatically by Paddle.

	   Most refunds for live accounts are created with the status of `pending_approval` until reviewed by Paddle, but some are automatically approved. For sandbox accounts, Paddle automatically approves refunds every ten minutes.

	   Credit adjustments don't require approval from Paddle, so they're created as `approved`.
	*/
	Status AdjustmentStatus `json:"status,omitempty"`
	// Items: List of items on this adjustment.
	Items []AdjustmentItem `json:"items,omitempty"`
	// Totals: Breakdown of the total for an adjustment.
	Totals AdjustmentTotals `json:"totals,omitempty"`
	// PayoutTotals: Breakdown of how this adjustment affects your payout balance.
	PayoutTotals *PayoutTotalsAdjustment `json:"payout_totals,omitempty"`
	// TaxRatesUsed: List of tax rates applied for this adjustment.
	TaxRatesUsed []AdjustmentTaxRateUsed `json:"tax_rates_used,omitempty"`
	// CreatedAt: RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
	CreatedAt string `json:"created_at,omitempty"`
	// UpdatedAt: RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
	UpdatedAt string `json:"updated_at,omitempty"`
}

Adjustment: Represents an adjustment entity.

type AdjustmentAction added in v0.5.0

type AdjustmentAction string

AdjustmentAction: How this adjustment impacts the related transaction..

const (
	AdjustmentActionCredit            AdjustmentAction = "credit"
	AdjustmentActionRefund            AdjustmentAction = "refund"
	AdjustmentActionChargeback        AdjustmentAction = "chargeback"
	AdjustmentActionChargebackReverse AdjustmentAction = "chargeback_reverse"
	AdjustmentActionChargebackWarning AdjustmentAction = "chargeback_warning"
	AdjustmentActionCreditReverse     AdjustmentAction = "credit_reverse"
)

type AdjustmentActionQuery added in v0.5.0

type AdjustmentActionQuery string

AdjustmentActionQuery: Return entities for the specified action..

const (
	AdjustmentActionQueryChargeback        AdjustmentActionQuery = "chargeback"
	AdjustmentActionQueryChargebackReverse AdjustmentActionQuery = "chargeback_reverse"
	AdjustmentActionQueryChargebackWarning AdjustmentActionQuery = "chargeback_warning"
	AdjustmentActionQueryCredit            AdjustmentActionQuery = "credit"
	AdjustmentActionQueryCreditReverse     AdjustmentActionQuery = "credit_reverse"
	AdjustmentActionQueryRefund            AdjustmentActionQuery = "refund"
)

type AdjustmentCreatedEvent added in v0.2.1

type AdjustmentCreatedEvent struct {
	GenericEvent
	Data paddlenotification.AdjustmentNotification `json:"data"`
}

AdjustmentCreatedEvent represents an Event implementation for adjustment.created event.

type AdjustmentItem

type AdjustmentItem struct {
	// ID: Unique Paddle ID for this adjustment item, prefixed with `adjitm_`.
	ID string `json:"id,omitempty"`
	// ItemID: Paddle ID for the transaction item that this adjustment item relates to, prefixed with `txnitm_`.
	ItemID string `json:"item_id,omitempty"`
	/*
	   Type: Type of adjustment for this transaction item. `tax` adjustments are automatically created by Paddle.
	   Include `amount` when creating a `partial` adjustment.
	*/
	Type AdjustmentType `json:"type,omitempty"`
	// Amount: Amount adjusted for this transaction item. Required when adjustment type is `partial`.
	Amount *string `json:"amount,omitempty"`
	// Proration: How proration was calculated for this adjustment item.
	Proration *Proration `json:"proration,omitempty"`
	// Totals: Breakdown of the total for an adjustment item.
	Totals AdjustmentItemTotals `json:"totals,omitempty"`
}

AdjustmentItem: List of items on this adjustment.

type AdjustmentItemTotals

type AdjustmentItemTotals struct {
	// Subtotal: Amount multiplied by quantity.
	Subtotal string `json:"subtotal,omitempty"`
	// Tax: Total tax on the subtotal.
	Tax string `json:"tax,omitempty"`
	// Total: Total after tax.
	Total string `json:"total,omitempty"`
}

AdjustmentItemTotals: Breakdown of the total for an adjustment item.

type AdjustmentPreview

type AdjustmentPreview struct {
	// TransactionID: Paddle ID for this transaction entity that this adjustment relates to, prefixed with `txn_`.
	TransactionID string `json:"transaction_id,omitempty"`
	// Items: List of transaction items that this adjustment is for.
	Items []SubscriptionAdjustmentItem `json:"items,omitempty"`
	// Totals: Calculated totals for this adjustment.
	Totals AdjustmentTotals `json:"totals,omitempty"`
}

AdjustmentPreview: Represents an adjustment entity when previewing adjustments.

type AdjustmentStatus

type AdjustmentStatus string

AdjustmentStatus: Status of this adjustment. Set automatically by Paddle.

Most refunds for live accounts are created with the status of `pending_approval` until reviewed by Paddle, but some are automatically approved. For sandbox accounts, Paddle automatically approves refunds every ten minutes.

Credit adjustments don't require approval from Paddle, so they're created as `approved`..

const (
	AdjustmentStatusPendingApproval AdjustmentStatus = "pending_approval"
	AdjustmentStatusApproved        AdjustmentStatus = "approved"
	AdjustmentStatusRejected        AdjustmentStatus = "rejected"
	AdjustmentStatusReversed        AdjustmentStatus = "reversed"
)

type AdjustmentTaxRateUsed added in v0.5.0

type AdjustmentTaxRateUsed struct {
	// TaxRate: Rate used to calculate tax for this adjustment.
	TaxRate string `json:"tax_rate,omitempty"`
	// Totals: Calculated totals for the tax applied to this adjustment.
	Totals AdjustmentTaxRateUsedTotals `json:"totals,omitempty"`
}

AdjustmentTaxRateUsed: List of tax rates applied for this adjustment.

type AdjustmentTaxRateUsedTotals added in v0.5.0

type AdjustmentTaxRateUsedTotals struct {
	// Subtotal: Total before tax. For tax adjustments, the value is 0.
	Subtotal string `json:"subtotal,omitempty"`
	// Tax: Total tax on the subtotal.
	Tax string `json:"tax,omitempty"`
	// Total: Total after tax.
	Total string `json:"total,omitempty"`
}

AdjustmentTaxRateUsedTotals: Calculated totals for the tax applied to this adjustment.

type AdjustmentTotals

type AdjustmentTotals struct {
	// Subtotal: Total before tax. For tax adjustments, the value is 0.
	Subtotal string `json:"subtotal,omitempty"`
	// Tax: Total tax on the subtotal.
	Tax string `json:"tax,omitempty"`
	// Total: Total after tax.
	Total string `json:"total,omitempty"`
	// Fee: Total fee taken by Paddle for this adjustment.
	Fee string `json:"fee,omitempty"`
	/*
	   Earnings: Total earnings. This is the subtotal minus the Paddle fee.
	   For tax adjustments, this value is negative, which means a positive effect in the transaction earnings.
	   This is because the fee is originally calculated from the transaction total, so if a tax adjustment is made,
	   then the fee portion of it is returned.
	*/
	Earnings string `json:"earnings,omitempty"`
	// CurrencyCode: Three-letter ISO 4217 currency code used for this adjustment.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
}

AdjustmentTotals: Breakdown of the total for an adjustment.

type AdjustmentTotalsBreakdown added in v0.7.0

type AdjustmentTotalsBreakdown struct {
	// Credit: Total amount of credit adjustments.
	Credit string `json:"credit,omitempty"`
	// Refund: Total amount of refund adjustments.
	Refund string `json:"refund,omitempty"`
	// Chargeback: Total amount of chargeback adjustments.
	Chargeback string `json:"chargeback,omitempty"`
}

AdjustmentTotalsBreakdown: Breakdown of the total adjustments by adjustment action.

type AdjustmentType

type AdjustmentType string

AdjustmentType: Type of adjustment for this transaction item. `tax` adjustments are automatically created by Paddle. Include `amount` when creating a `partial` adjustment..

const (
	AdjustmentTypeFull      AdjustmentType = "full"
	AdjustmentTypePartial   AdjustmentType = "partial"
	AdjustmentTypeTax       AdjustmentType = "tax"
	AdjustmentTypeProration AdjustmentType = "proration"
)

type AdjustmentUpdatedEvent added in v0.2.1

type AdjustmentUpdatedEvent struct {
	GenericEvent
	Data paddlenotification.AdjustmentNotification `json:"data"`
}

AdjustmentUpdatedEvent represents an Event implementation for adjustment.updated event.

type AdjustmentsClient

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

AdjustmentsClient is a client for the Adjustments resource.

func (*AdjustmentsClient) CreateAdjustment

func (c *AdjustmentsClient) CreateAdjustment(ctx context.Context, req *CreateAdjustmentRequest) (res *Adjustment, err error)

CreateAdjustment performs the POST operation on a Adjustments resource.

func (*AdjustmentsClient) ListAdjustments

func (c *AdjustmentsClient) ListAdjustments(ctx context.Context, req *ListAdjustmentsRequest) (res *Collection[*Adjustment], err error)

ListAdjustments performs the GET operation on a Adjustments resource.

func (*AdjustmentsClient) ListCreditBalances

func (c *AdjustmentsClient) ListCreditBalances(ctx context.Context, req *ListCreditBalancesRequest) (res *Collection[*CreditBalance], err error)

ListCreditBalances performs the GET operation on a Adjustments resource.

type AdjustmentsReportFilterName added in v0.7.0

type AdjustmentsReportFilterName string

AdjustmentsReportFilterName: Field name to filter by..

const (
	AdjustmentsReportFilterNameAction       AdjustmentsReportFilterName = "action"
	AdjustmentsReportFilterNameCurrencyCode AdjustmentsReportFilterName = "currency_code"
	AdjustmentsReportFilterNameStatus       AdjustmentsReportFilterName = "status"
	AdjustmentsReportFilterNameUpdatedAt    AdjustmentsReportFilterName = "updated_at"
)

type AdjustmentsReportFilters added in v0.7.0

type AdjustmentsReportFilters struct {
	// Name: Field name to filter by.
	Name AdjustmentsReportFilterName `json:"name,omitempty"`
	// Operator: Operator to use when filtering. Valid when filtering by `updated_at`, `null` otherwise.
	Operator *FilterOperator `json:"operator,omitempty"`
	// Value: Value to filter by. Check the allowed values descriptions for the `name` field to see valid values for a field.
	Value any `json:"value,omitempty"`
}

AdjustmentsReportFilters: Filter criteria for this report. If omitted when creating, reports are filtered to include data updated in the last 30 days. This means `updated_at` is greater than or equal to (`gte`) the date 30 days ago from the time the report was generated.

type AdjustmentsReportType added in v0.7.0

type AdjustmentsReportType string

AdjustmentsReportType: Type of report to create..

const (
	AdjustmentsReportTypeAdjustments         AdjustmentsReportType = "adjustments"
	AdjustmentsReportTypeAdjustmentLineItems AdjustmentsReportType = "adjustment_line_items"
)

type AdjustmentsReports

type AdjustmentsReports struct {
	// Type: Type of report to create.
	Type AdjustmentsReportType `json:"type,omitempty"`
	// Filters: Filter criteria for this report. If omitted when creating, reports are filtered to include data updated in the last 30 days. This means `updated_at` is greater than or equal to (`gte`) the date 30 days ago from the time the report was generated.
	Filters []AdjustmentsReportFilters `json:"filters,omitempty"`
}

AdjustmentsReports: Entity when working with reports for adjustments or adjustment line items.

type BillingDetails

type BillingDetails struct {
	// EnableCheckout: Whether the related transaction may be paid using a Paddle Checkout. If omitted when creating a transaction, defaults to `false`.
	EnableCheckout bool `json:"enable_checkout,omitempty"`
	// PurchaseOrderNumber: Customer purchase order number. Appears on invoice documents.
	PurchaseOrderNumber string `json:"purchase_order_number,omitempty"`
	// AdditionalInformation: Notes or other information to include on this invoice. Appears on invoice documents.
	AdditionalInformation *string `json:"additional_information,omitempty"`
	// PaymentTerms: How long a customer has to pay this invoice once issued.
	PaymentTerms Duration `json:"payment_terms,omitempty"`
}

BillingDetails: Details for invoicing. Required if `collection_mode` is `manual`.

type BillingDetailsUpdate

type BillingDetailsUpdate struct {
	// EnableCheckout: Whether the related transaction may be paid using a Paddle Checkout.
	EnableCheckout bool `json:"enable_checkout,omitempty"`
	// PurchaseOrderNumber: Customer purchase order number. Appears on invoice documents.
	PurchaseOrderNumber string `json:"purchase_order_number,omitempty"`
	// AdditionalInformation: Notes or other information to include on this invoice. Appears on invoice documents.
	AdditionalInformation *string `json:"additional_information,omitempty"`
	// PaymentTerms: How long a customer has to pay this invoice once issued.
	PaymentTerms Duration `json:"payment_terms,omitempty"`
}

BillingDetailsUpdate: Details for invoicing. Required if `collection_mode` is `manual`.

type Business

type Business struct {
	// ID: Unique Paddle ID for this business entity, prefixed with `biz_`.
	ID string `json:"id,omitempty"`
	// CustomerID: Paddle ID for the customer related to this business, prefixed with `cus_`.
	CustomerID string `json:"customer_id,omitempty"`
	// Name: Name of this business.
	Name string `json:"name,omitempty"`
	// CompanyNumber: Company number for this business.
	CompanyNumber *string `json:"company_number,omitempty"`
	// TaxIdentifier: Tax or VAT Number for this business.
	TaxIdentifier *string `json:"tax_identifier,omitempty"`
	// Status: Whether this entity can be used in Paddle.
	Status Status `json:"status,omitempty"`
	// Contacts: List of contacts related to this business, typically used for sending invoices.
	Contacts []Contacts `json:"contacts,omitempty"`
	// CreatedAt: RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
	CreatedAt string `json:"created_at,omitempty"`
	// UpdatedAt: RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
	UpdatedAt string `json:"updated_at,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
	// ImportMeta: Import information for this entity. `null` if this entity is not imported.
	ImportMeta *ImportMeta `json:"import_meta,omitempty"`
}

Business: Business for this transaction. Returned when the `include` parameter is used with the `business` value and the transaction has a `business_id`.

type BusinessContacts added in v0.7.0

type BusinessContacts struct {
	// Name: Full name of this contact.
	Name string `json:"name,omitempty"`
	// Email: Email address for this contact.
	Email string `json:"email,omitempty"`
}

BusinessContacts: List of contacts related to this business, typically used for sending invoices.

type BusinessCreatedEvent added in v0.2.1

type BusinessCreatedEvent struct {
	GenericEvent
	Data paddlenotification.BusinessNotification `json:"data"`
}

BusinessCreatedEvent represents an Event implementation for business.created event.

type BusinessImportedEvent added in v0.2.1

type BusinessImportedEvent struct {
	GenericEvent
	Data paddlenotification.BusinessNotification `json:"data"`
}

BusinessImportedEvent represents an Event implementation for business.imported event.

type BusinessUpdatedEvent added in v0.2.1

type BusinessUpdatedEvent struct {
	GenericEvent
	Data paddlenotification.BusinessNotification `json:"data"`
}

BusinessUpdatedEvent represents an Event implementation for business.updated event.

type BusinessesClient

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

BusinessesClient is a client for the Businesses resource.

func (*BusinessesClient) CreateBusiness

func (c *BusinessesClient) CreateBusiness(ctx context.Context, req *CreateBusinessRequest) (res *Business, err error)

CreateBusiness performs the POST operation on a Businesses resource.

func (*BusinessesClient) GetBusiness

func (c *BusinessesClient) GetBusiness(ctx context.Context, req *GetBusinessRequest) (res *Business, err error)

GetBusiness performs the GET operation on a Businesses resource.

func (*BusinessesClient) ListBusinesses

func (c *BusinessesClient) ListBusinesses(ctx context.Context, req *ListBusinessesRequest) (res *Collection[*Business], err error)

ListBusinesses performs the GET operation on a Businesses resource.

func (*BusinessesClient) UpdateBusiness

func (c *BusinessesClient) UpdateBusiness(ctx context.Context, req *UpdateBusinessRequest) (res *Business, err error)

UpdateBusiness performs the PATCH operation on a Businesses resource.

type CancelSubscriptionRequest

type CancelSubscriptionRequest struct {
	// URL path parameters.
	SubscriptionID string `in:"path=subscription_id" json:"-"`

	/*
	   EffectiveFrom: When this subscription change should take effect from. Defaults to `next_billing_period` for active subscriptions,
	   which creates a `scheduled_change` to apply the subscription change at the end of the billing period.
	*/
	EffectiveFrom *EffectiveFrom `json:"effective_from,omitempty"`
}

CancelSubscriptionRequest is given as an input to CancelSubscription.

type Card

type Card struct {
	// Type: Type of credit or debit card used to pay.
	Type CardType `json:"type,omitempty"`
	// Last4: Last four digits of the card used to pay.
	Last4 string `json:"last4,omitempty"`
	// ExpiryMonth: Month of the expiry date of the card used to pay.
	ExpiryMonth int `json:"expiry_month,omitempty"`
	// ExpiryYear: Year of the expiry date of the card used to pay.
	ExpiryYear int `json:"expiry_year,omitempty"`
	// CardholderName: The name on the card used to pay.
	CardholderName string `json:"cardholder_name,omitempty"`
}

Card: Information about the credit or debit card used to pay. `null` unless `type` is `card`.

type CardType

type CardType string

CardType: Type of credit or debit card used to pay..

const (
	CardTypeAmericanExpress CardType = "american_express"
	CardTypeDinersClub      CardType = "diners_club"
	CardTypeDiscover        CardType = "discover"
	CardTypeJcb             CardType = "jcb"
	CardTypeMada            CardType = "mada"
	CardTypeMaestro         CardType = "maestro"
	CardTypeMastercard      CardType = "mastercard"
	CardTypeUnionPay        CardType = "union_pay"
	CardTypeUnknown         CardType = "unknown"
	CardTypeVisa            CardType = "visa"
)

type CatalogItem

type CatalogItem struct {
	// Quantity: Quantity of this item on the transaction.
	Quantity int `json:"quantity,omitempty"`
	// Proration: How proration was calculated for this item. Populated when a transaction is created from a subscription change, where `proration_billing_mode` was `prorated_immediately` or `prorated_next_billing_period`. Set automatically by Paddle.
	Proration *Proration `json:"proration,omitempty"`
	// PriceID: Paddle ID of an existing catalog price to add to this transaction, prefixed with `pri_`.
	PriceID string `json:"price_id,omitempty"`
}

CatalogItem: Add a catalog item to a transaction. In this case, the product and price that you're billing for exist in your product catalog in Paddle.

type CatalogType

type CatalogType string

CatalogType: Return items that match the specified type..

const (
	CatalogTypeCustom   CatalogType = "custom"
	CatalogTypeStandard CatalogType = "standard"
)

type ChargebackFee

type ChargebackFee struct {
	// Amount: Chargeback fee converted into the payout currency.
	Amount string `json:"amount,omitempty"`
	// Original: Chargeback fee before conversion to the payout currency. `null` when the chargeback fee is the same as the payout currency.
	Original *Original `json:"original,omitempty"`
}

ChargebackFee: Details of any chargeback fees incurred for this transaction.

type Collection

type Collection[T any] struct {
	// contains filtered or unexported fields
}

Collection is the response from a listing endpoint in the Paddle API. It is used as a container to iterate over many pages of results.

func (*Collection[T]) EstimatedTotal

func (c *Collection[T]) EstimatedTotal() int

EstimatedTotal returns the estimated number of items in the collection.

func (*Collection[T]) HasMore

func (c *Collection[T]) HasMore() bool

HasMore returns true if there are more pages of results to be fetched.

func (*Collection[T]) Iter

func (c *Collection[T]) Iter(ctx context.Context, fn func(v T) (bool, error)) error

Iter iterates over the collection, calling the given function for each result. If the function returns false, the iteration will stop. You should check the error given to your callback function on each iteration.

func (*Collection[T]) IterErr

func (c *Collection[T]) IterErr(ctx context.Context, fn func(v T) error) error

IterErr iterates over the collection, calling the given function for each result. If the function returns false, the iteration will stop. You should check the error given to the function on each iteration.

func (*Collection[T]) Next

func (c *Collection[T]) Next(ctx context.Context) *Res[T]

Next returns the next result from the collection. If there are no more results, the result will response to Ok() with false.

func (*Collection[T]) PerPage

func (c *Collection[T]) PerPage() int

PerPage returns the number of items per page in the collection.

func (*Collection[T]) UnmarshalJSON

func (c *Collection[T]) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the collection from a JSON response.

func (*Collection[T]) Wants

func (c *Collection[T]) Wants(d client.Doer)

Wants sets the client to be used for making requests.

type CollectionMode

type CollectionMode string

CollectionMode: Return entities that match the specified collection mode..

const (
	CollectionModeAutomatic CollectionMode = "automatic"
	CollectionModeManual    CollectionMode = "manual"
)

type Contacts

type Contacts struct {
	// Name: Full name of this contact.
	Name string `json:"name,omitempty"`
	// Email: Email address for this contact.
	Email string `json:"email,omitempty"`
}

Contacts: List of contacts related to this business, typically used for sending invoices.

type CountryCode

type CountryCode string

CountryCode: Supported two-letter ISO 3166-1 alpha-2 country code..

const (
	CountryCodeAD CountryCode = "AD"
	CountryCodeAE CountryCode = "AE"
	CountryCodeAG CountryCode = "AG"
	CountryCodeAI CountryCode = "AI"
	CountryCodeAL CountryCode = "AL"
	CountryCodeAM CountryCode = "AM"
	CountryCodeAO CountryCode = "AO"
	CountryCodeAR CountryCode = "AR"
	CountryCodeAS CountryCode = "AS"
	CountryCodeAT CountryCode = "AT"
	CountryCodeAU CountryCode = "AU"
	CountryCodeAW CountryCode = "AW"
	CountryCodeAX CountryCode = "AX"
	CountryCodeAZ CountryCode = "AZ"
	CountryCodeBA CountryCode = "BA"
	CountryCodeBB CountryCode = "BB"
	CountryCodeBD CountryCode = "BD"
	CountryCodeBE CountryCode = "BE"
	CountryCodeBF CountryCode = "BF"
	CountryCodeBG CountryCode = "BG"
	CountryCodeBH CountryCode = "BH"
	CountryCodeBI CountryCode = "BI"
	CountryCodeBJ CountryCode = "BJ"
	CountryCodeBL CountryCode = "BL"
	CountryCodeBM CountryCode = "BM"
	CountryCodeBN CountryCode = "BN"
	CountryCodeBO CountryCode = "BO"
	CountryCodeBQ CountryCode = "BQ"
	CountryCodeBR CountryCode = "BR"
	CountryCodeBS CountryCode = "BS"
	CountryCodeBT CountryCode = "BT"
	CountryCodeBV CountryCode = "BV"
	CountryCodeBW CountryCode = "BW"
	CountryCodeBZ CountryCode = "BZ"
	CountryCodeCA CountryCode = "CA"
	CountryCodeCC CountryCode = "CC"
	CountryCodeCG CountryCode = "CG"
	CountryCodeCH CountryCode = "CH"
	CountryCodeCI CountryCode = "CI"
	CountryCodeCK CountryCode = "CK"
	CountryCodeCL CountryCode = "CL"
	CountryCodeCM CountryCode = "CM"
	CountryCodeCN CountryCode = "CN"
	CountryCodeCO CountryCode = "CO"
	CountryCodeCR CountryCode = "CR"
	CountryCodeCV CountryCode = "CV"
	CountryCodeCW CountryCode = "CW"
	CountryCodeCX CountryCode = "CX"
	CountryCodeCY CountryCode = "CY"
	CountryCodeCZ CountryCode = "CZ"
	CountryCodeDE CountryCode = "DE"
	CountryCodeDJ CountryCode = "DJ"
	CountryCodeDK CountryCode = "DK"
	CountryCodeDM CountryCode = "DM"
	CountryCodeDO CountryCode = "DO"
	CountryCodeDZ CountryCode = "DZ"
	CountryCodeEC CountryCode = "EC"
	CountryCodeEE CountryCode = "EE"
	CountryCodeEG CountryCode = "EG"
	CountryCodeEH CountryCode = "EH"
	CountryCodeER CountryCode = "ER"
	CountryCodeES CountryCode = "ES"
	CountryCodeET CountryCode = "ET"
	CountryCodeFI CountryCode = "FI"
	CountryCodeFJ CountryCode = "FJ"
	CountryCodeFK CountryCode = "FK"
	CountryCodeFM CountryCode = "FM"
	CountryCodeFO CountryCode = "FO"
	CountryCodeFR CountryCode = "FR"
	CountryCodeGA CountryCode = "GA"
	CountryCodeGB CountryCode = "GB"
	CountryCodeGD CountryCode = "GD"
	CountryCodeGE CountryCode = "GE"
	CountryCodeGF CountryCode = "GF"
	CountryCodeGG CountryCode = "GG"
	CountryCodeGH CountryCode = "GH"
	CountryCodeGI CountryCode = "GI"
	CountryCodeGL CountryCode = "GL"
	CountryCodeGM CountryCode = "GM"
	CountryCodeGN CountryCode = "GN"
	CountryCodeGP CountryCode = "GP"
	CountryCodeGQ CountryCode = "GQ"
	CountryCodeGR CountryCode = "GR"
	CountryCodeGS CountryCode = "GS"
	CountryCodeGT CountryCode = "GT"
	CountryCodeGU CountryCode = "GU"
	CountryCodeGW CountryCode = "GW"
	CountryCodeGY CountryCode = "GY"
	CountryCodeHK CountryCode = "HK"
	CountryCodeHM CountryCode = "HM"
	CountryCodeHN CountryCode = "HN"
	CountryCodeHR CountryCode = "HR"
	CountryCodeHU CountryCode = "HU"
	CountryCodeID CountryCode = "ID"
	CountryCodeIE CountryCode = "IE"
	CountryCodeIL CountryCode = "IL"
	CountryCodeIM CountryCode = "IM"
	CountryCodeIN CountryCode = "IN"
	CountryCodeIO CountryCode = "IO"
	CountryCodeIQ CountryCode = "IQ"
	CountryCodeIS CountryCode = "IS"
	CountryCodeIT CountryCode = "IT"
	CountryCodeJE CountryCode = "JE"
	CountryCodeJM CountryCode = "JM"
	CountryCodeJO CountryCode = "JO"
	CountryCodeJP CountryCode = "JP"
	CountryCodeKE CountryCode = "KE"
	CountryCodeKG CountryCode = "KG"
	CountryCodeKH CountryCode = "KH"
	CountryCodeKI CountryCode = "KI"
	CountryCodeKM CountryCode = "KM"
	CountryCodeKN CountryCode = "KN"
	CountryCodeKR CountryCode = "KR"
	CountryCodeKW CountryCode = "KW"
	CountryCodeKY CountryCode = "KY"
	CountryCodeKZ CountryCode = "KZ"
	CountryCodeLA CountryCode = "LA"
	CountryCodeLB CountryCode = "LB"
	CountryCodeLC CountryCode = "LC"
	CountryCodeLI CountryCode = "LI"
	CountryCodeLK CountryCode = "LK"
	CountryCodeLR CountryCode = "LR"
	CountryCodeLS CountryCode = "LS"
	CountryCodeLT CountryCode = "LT"
	CountryCodeLU CountryCode = "LU"
	CountryCodeLV CountryCode = "LV"
	CountryCodeMA CountryCode = "MA"
	CountryCodeMC CountryCode = "MC"
	CountryCodeMD CountryCode = "MD"
	CountryCodeME CountryCode = "ME"
	CountryCodeMF CountryCode = "MF"
	CountryCodeMG CountryCode = "MG"
	CountryCodeMH CountryCode = "MH"
	CountryCodeMK CountryCode = "MK"
	CountryCodeMN CountryCode = "MN"
	CountryCodeMO CountryCode = "MO"
	CountryCodeMP CountryCode = "MP"
	CountryCodeMQ CountryCode = "MQ"
	CountryCodeMR CountryCode = "MR"
	CountryCodeMS CountryCode = "MS"
	CountryCodeMT CountryCode = "MT"
	CountryCodeMU CountryCode = "MU"
	CountryCodeMV CountryCode = "MV"
	CountryCodeMW CountryCode = "MW"
	CountryCodeMX CountryCode = "MX"
	CountryCodeMY CountryCode = "MY"
	CountryCodeMZ CountryCode = "MZ"
	CountryCodeNA CountryCode = "NA"
	CountryCodeNC CountryCode = "NC"
	CountryCodeNE CountryCode = "NE"
	CountryCodeNF CountryCode = "NF"
	CountryCodeNG CountryCode = "NG"
	CountryCodeNL CountryCode = "NL"
	CountryCodeNO CountryCode = "NO"
	CountryCodeNP CountryCode = "NP"
	CountryCodeNR CountryCode = "NR"
	CountryCodeNU CountryCode = "NU"
	CountryCodeNZ CountryCode = "NZ"
	CountryCodeOM CountryCode = "OM"
	CountryCodePA CountryCode = "PA"
	CountryCodePE CountryCode = "PE"
	CountryCodePF CountryCode = "PF"
	CountryCodePG CountryCode = "PG"
	CountryCodePH CountryCode = "PH"
	CountryCodePK CountryCode = "PK"
	CountryCodePL CountryCode = "PL"
	CountryCodePM CountryCode = "PM"
	CountryCodePN CountryCode = "PN"
	CountryCodePR CountryCode = "PR"
	CountryCodePS CountryCode = "PS"
	CountryCodePT CountryCode = "PT"
	CountryCodePW CountryCode = "PW"
	CountryCodePY CountryCode = "PY"
	CountryCodeQA CountryCode = "QA"
	CountryCodeRE CountryCode = "RE"
	CountryCodeRO CountryCode = "RO"
	CountryCodeRS CountryCode = "RS"
	CountryCodeRW CountryCode = "RW"
	CountryCodeSA CountryCode = "SA"
	CountryCodeSB CountryCode = "SB"
	CountryCodeSC CountryCode = "SC"
	CountryCodeSE CountryCode = "SE"
	CountryCodeSG CountryCode = "SG"
	CountryCodeSH CountryCode = "SH"
	CountryCodeSI CountryCode = "SI"
	CountryCodeSJ CountryCode = "SJ"
	CountryCodeSK CountryCode = "SK"
	CountryCodeSL CountryCode = "SL"
	CountryCodeSM CountryCode = "SM"
	CountryCodeSN CountryCode = "SN"
	CountryCodeSR CountryCode = "SR"
	CountryCodeST CountryCode = "ST"
	CountryCodeSV CountryCode = "SV"
	CountryCodeSX CountryCode = "SX"
	CountryCodeSZ CountryCode = "SZ"
	CountryCodeTC CountryCode = "TC"
	CountryCodeTD CountryCode = "TD"
	CountryCodeTF CountryCode = "TF"
	CountryCodeTG CountryCode = "TG"
	CountryCodeTH CountryCode = "TH"
	CountryCodeTJ CountryCode = "TJ"
	CountryCodeTK CountryCode = "TK"
	CountryCodeTL CountryCode = "TL"
	CountryCodeTM CountryCode = "TM"
	CountryCodeTN CountryCode = "TN"
	CountryCodeTO CountryCode = "TO"
	CountryCodeTR CountryCode = "TR"
	CountryCodeTT CountryCode = "TT"
	CountryCodeTV CountryCode = "TV"
	CountryCodeTW CountryCode = "TW"
	CountryCodeTZ CountryCode = "TZ"
	CountryCodeUA CountryCode = "UA"
	CountryCodeUG CountryCode = "UG"
	CountryCodeUM CountryCode = "UM"
	CountryCodeUS CountryCode = "US"
	CountryCodeUY CountryCode = "UY"
	CountryCodeUZ CountryCode = "UZ"
	CountryCodeVA CountryCode = "VA"
	CountryCodeVC CountryCode = "VC"
	CountryCodeVG CountryCode = "VG"
	CountryCodeVI CountryCode = "VI"
	CountryCodeVN CountryCode = "VN"
	CountryCodeVU CountryCode = "VU"
	CountryCodeWF CountryCode = "WF"
	CountryCodeWS CountryCode = "WS"
	CountryCodeXK CountryCode = "XK"
	CountryCodeYT CountryCode = "YT"
	CountryCodeZA CountryCode = "ZA"
	CountryCodeZM CountryCode = "ZM"
)

type CreateAddressRequest

type CreateAddressRequest struct {
	// URL path parameters.
	CustomerID string `in:"path=customer_id" json:"-"`

	// CountryCode: Supported two-letter ISO 3166-1 alpha-2 country code for this address.
	CountryCode CountryCode `json:"country_code,omitempty"`
	// Description: Memorable description for this address.
	Description *string `json:"description,omitempty"`
	// FirstLine: First line of this address.
	FirstLine *string `json:"first_line,omitempty"`
	// SecondLine: Second line of this address.
	SecondLine *string `json:"second_line,omitempty"`
	// City: City of this address.
	City *string `json:"city,omitempty"`
	// PostalCode: ZIP or postal code of this address. Required for some countries.
	PostalCode *string `json:"postal_code,omitempty"`
	// Region: State, county, or region of this address.
	Region *string `json:"region,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
}

CreateAddressRequest is given as an input to CreateAddress.

type CreateAdjustmentRequest

type CreateAdjustmentRequest struct {
	// Action: How this adjustment impacts the related transaction.
	Action AdjustmentAction `json:"action,omitempty"`
	// Items: List of transaction items to adjust.
	Items []AdjustmentItem `json:"items,omitempty"`
	// Reason: Why this adjustment was created. Appears in the Paddle dashboard. Retained for record-keeping purposes.
	Reason string `json:"reason,omitempty"`
	/*
	   TransactionID: Paddle ID of the transaction that this adjustment is for, prefixed with `txn_`.
	   Transactions must be manually-collected, and have a status of `billed` or `completed`.

	   You can't create an adjustment for a transaction that has a refund that's pending approval.
	*/
	TransactionID string `json:"transaction_id,omitempty"`
}

CreateAdjustmentRequest is given as an input to CreateAdjustment.

type CreateBusinessRequest

type CreateBusinessRequest struct {
	// URL path parameters.
	CustomerID string `in:"path=customer_id" json:"-"`

	// Name: Name of this business.
	Name string `json:"name,omitempty"`
	// CompanyNumber: Company number for this business.
	CompanyNumber *string `json:"company_number,omitempty"`
	// TaxIdentifier: Tax or VAT Number for this business.
	TaxIdentifier *string `json:"tax_identifier,omitempty"`
	// Contacts: List of contacts related to this business, typically used for sending invoices.
	Contacts []BusinessContacts `json:"contacts,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
}

CreateBusinessRequest is given as an input to CreateBusiness.

type CreateCustomerRequest

type CreateCustomerRequest struct {
	// Email: Email address for this customer.
	Email string `json:"email,omitempty"`
	// Name: Full name of this customer. Required when creating transactions where `collection_mode` is `manual` (invoices).
	Name *string `json:"name,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
	// Locale: Valid IETF BCP 47 short form locale tag. If omitted, defaults to `en`.
	Locale *string `json:"locale,omitempty"`
}

CreateCustomerRequest is given as an input to CreateCustomer.

type CreateDiscountRequest

type CreateDiscountRequest struct {
	// Amount: Amount to discount by. For `percentage` discounts, must be an amount between `0.01` and `100`. For `flat` and `flat_per_seat` discounts, amount in the lowest denomination for a currency.
	Amount string `json:"amount,omitempty"`
	// Description: Short description for this discount for your reference. Not shown to customers.
	Description string `json:"description,omitempty"`
	// Type: Type of discount. Determines how this discount impacts the transaction total.
	Type DiscountType `json:"type,omitempty"`
	// EnabledForCheckout: Whether this discount can be applied by customers at checkout. If omitted, defaults to `false`.
	EnabledForCheckout *bool `json:"enabled_for_checkout,omitempty"`
	// Code: Unique code that customers can use to apply this discount at checkout. Use letters and numbers only, up to 16 characters. If omitted and `enabled_for_checkout` is `true`, Paddle generates a random 10-character code.
	Code *string `json:"code,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code. Required where discount type is `flat` or `flat_per_seat`.
	CurrencyCode *CurrencyCode `json:"currency_code,omitempty"`
	// Recur: Whether this discount applies for multiple subscription billing periods. If omitted, defaults to `false`.
	Recur *bool `json:"recur,omitempty"`
	// MaximumRecurringIntervals: Amount of subscription billing periods that this discount recurs for. Requires `recur`. `null` if this discount recurs forever.
	MaximumRecurringIntervals *int `json:"maximum_recurring_intervals,omitempty"`
	// UsageLimit: Maximum amount of times this discount can be used. This is an overall limit, rather than a per-customer limit. `null` if this discount can be used an unlimited amount of times.
	UsageLimit *int `json:"usage_limit,omitempty"`
	// RestrictTo: Product or price IDs that this discount is for. When including a product ID, all prices for that product can be discounted. `null` if this discount applies to all products and prices.
	RestrictTo []string `json:"restrict_to,omitempty"`
	// ExpiresAt: RFC 3339 datetime string of when this discount expires. Discount can no longer be applied after this date has elapsed. `null` if this discount can be applied forever. If omitted, defaults to `null`.
	ExpiresAt *string `json:"expires_at,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
}

CreateDiscountRequest is given as an input to CreateDiscount.

type CreateNotificationSettingRequest

type CreateNotificationSettingRequest struct {
	// Description: Short description for this notification destination. Shown in the Paddle Dashboard.
	Description string `json:"description,omitempty"`
	// Destination: Webhook endpoint URL or email address.
	Destination string `json:"destination,omitempty"`
	// SubscribedEvents: Type of event sent by Paddle, in the format `entity.event_type`.
	SubscribedEvents []EventTypeName `json:"subscribed_events,omitempty"`
	// Type: Where notifications should be sent for this destination.
	Type NotificationSettingType `json:"type,omitempty"`
	// APIVersion: API version that returned objects for events should conform to. Must be a valid version of the Paddle API. Cannot be a version older than your account default. If omitted, defaults to your account default version.
	APIVersion *int `json:"api_version,omitempty"`
	// IncludeSensitiveFields: Whether potentially sensitive fields should be sent to this notification destination. If omitted, defaults to `false`.
	IncludeSensitiveFields *bool `json:"include_sensitive_fields,omitempty"`
}

CreateNotificationSettingRequest is given as an input to CreateNotificationSetting.

type CreatePriceRequest

type CreatePriceRequest struct {
	// Description: Internal description for this price, not shown to customers. Typically notes for your team.
	Description string `json:"description,omitempty"`
	// ProductID: Paddle ID for the product that this price is for, prefixed with `pro_`.
	ProductID string `json:"product_id,omitempty"`
	// UnitPrice: Base price. This price applies to all customers, except for customers located in countries where you have `unit_price_overrides`.
	UnitPrice Money `json:"unit_price,omitempty"`
	// Type: Type of item. Standard items are considered part of your catalog and are shown on the Paddle web app. If omitted, defaults to `standard`.
	Type *CatalogType `json:"type,omitempty"`
	// Name: Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
	Name *string `json:"name,omitempty"`
	// BillingCycle: How often this price should be charged. `null` if price is non-recurring (one-time). If omitted, defaults to `null`.
	BillingCycle *Duration `json:"billing_cycle,omitempty"`
	/*
	   TrialPeriod: Trial period for the product related to this price. The billing cycle begins once the trial period is over.
	   `null` for no trial period. Requires `billing_cycle`. If omitted, defaults to `null`.
	*/
	TrialPeriod *Duration `json:"trial_period,omitempty"`
	// TaxMode: How tax is calculated for this price. If omitted, defaults to `account_setting`.
	TaxMode *TaxMode `json:"tax_mode,omitempty"`
	// UnitPriceOverrides: List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
	UnitPriceOverrides []UnitPriceOverride `json:"unit_price_overrides,omitempty"`
	// Quantity: Limits on how many times the related product can be purchased at this price. Useful for discount campaigns. If omitted, defaults to 1-100.
	Quantity *PriceQuantity `json:"quantity,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
}

CreatePriceRequest is given as an input to CreatePrice.

type CreateProductRequest

type CreateProductRequest struct {
	// Name: Name of this product.
	Name string `json:"name,omitempty"`
	// TaxCategory: Tax category for this product. Used for charging the correct rate of tax. Selected tax category must be enabled on your Paddle account.
	TaxCategory TaxCategory `json:"tax_category,omitempty"`
	// Description: Short description for this product.
	Description *string `json:"description,omitempty"`
	// Type: Type of item. Standard items are considered part of your catalog and are shown on the Paddle web app. If omitted, defaults to `standard`.
	Type *CatalogType `json:"type,omitempty"`
	// ImageURL: Image for this product. Included in the checkout and on some customer documents.
	ImageURL *string `json:"image_url,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
}

CreateProductRequest is given as an input to CreateProduct.

type CreateReportRequest

CreateReportRequest represents a union request type of the following types:

  • `AdjustmentsReports`
  • `TransactionsReports`
  • `ProductsAndPricesReport`
  • `DiscountsReport`

The following constructor functions can be used to create a new instance of this type.

  • `NewCreateReportRequestAdjustmentsReports()`
  • `NewCreateReportRequestTransactionsReports()`
  • `NewCreateReportRequestProductsAndPricesReport()`
  • `NewCreateReportRequestDiscountsReport()`

Only one of the values can be set at a time, the first non-nil value will be used in the request.

func NewCreateReportRequestAdjustmentsReports

func NewCreateReportRequestAdjustmentsReports(r *AdjustmentsReports) *CreateReportRequest

NewCreateReportRequestAdjustmentsReports takes a AdjustmentsReports type and creates a CreateReportRequest for use in a request.

func NewCreateReportRequestDiscountsReport

func NewCreateReportRequestDiscountsReport(r *DiscountsReport) *CreateReportRequest

NewCreateReportRequestDiscountsReport takes a DiscountsReport type and creates a CreateReportRequest for use in a request.

func NewCreateReportRequestProductsAndPricesReport

func NewCreateReportRequestProductsAndPricesReport(r *ProductsAndPricesReport) *CreateReportRequest

NewCreateReportRequestProductsAndPricesReport takes a ProductsAndPricesReport type and creates a CreateReportRequest for use in a request.

func NewCreateReportRequestTransactionsReports

func NewCreateReportRequestTransactionsReports(r *TransactionsReports) *CreateReportRequest

NewCreateReportRequestTransactionsReports takes a TransactionsReports type and creates a CreateReportRequest for use in a request.

func (CreateReportRequest) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface.

type CreateSubscriptionChargeItems

CreateSubscriptionChargeItems represents a union request type of the following types:

  • `SubscriptionCatalogItem`
  • `SubscriptionNonCatalogPriceForAnExistingProduct`
  • `SubscriptionNonCatalogPriceAndProduct`

The following constructor functions can be used to create a new instance of this type.

  • `NewCreateSubscriptionChargeItemsSubscriptionCatalogItem()`
  • `NewCreateSubscriptionChargeItemsSubscriptionNonCatalogPriceForAnExistingProduct()`
  • `NewCreateSubscriptionChargeItemsSubscriptionNonCatalogPriceAndProduct()`

Only one of the values can be set at a time, the first non-nil value will be used in the request. Items: Add a non-catalog price for a non-catalog product in your catalog to a subscription. In this case, the product and price that you're billing for are specific to this transaction.

func NewCreateSubscriptionChargeItemsSubscriptionCatalogItem added in v0.7.0

func NewCreateSubscriptionChargeItemsSubscriptionCatalogItem(r *SubscriptionCatalogItem) *CreateSubscriptionChargeItems

NewCreateSubscriptionChargeItemsSubscriptionCatalogItem takes a SubscriptionCatalogItem type and creates a CreateSubscriptionChargeItems for use in a request.

func NewCreateSubscriptionChargeItemsSubscriptionNonCatalogPriceAndProduct added in v0.7.0

func NewCreateSubscriptionChargeItemsSubscriptionNonCatalogPriceAndProduct(r *SubscriptionNonCatalogPriceAndProduct) *CreateSubscriptionChargeItems

NewCreateSubscriptionChargeItemsSubscriptionNonCatalogPriceAndProduct takes a SubscriptionNonCatalogPriceAndProduct type and creates a CreateSubscriptionChargeItems for use in a request.

func NewCreateSubscriptionChargeItemsSubscriptionNonCatalogPriceForAnExistingProduct added in v0.7.0

func NewCreateSubscriptionChargeItemsSubscriptionNonCatalogPriceForAnExistingProduct(r *SubscriptionNonCatalogPriceForAnExistingProduct) *CreateSubscriptionChargeItems

NewCreateSubscriptionChargeItemsSubscriptionNonCatalogPriceForAnExistingProduct takes a SubscriptionNonCatalogPriceForAnExistingProduct type and creates a CreateSubscriptionChargeItems for use in a request.

func (CreateSubscriptionChargeItems) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface.

type CreateSubscriptionChargeRequest

type CreateSubscriptionChargeRequest struct {
	// URL path parameters.
	SubscriptionID string `in:"path=subscription_id" json:"-"`

	// EffectiveFrom: When one-time charges should be billed.
	EffectiveFrom EffectiveFrom `json:"effective_from,omitempty"`
	// Items: Add a non-catalog price for a non-catalog product in your catalog to a subscription. In this case, the product and price that you're billing for are specific to this transaction.
	Items []CreateSubscriptionChargeItems `json:"items,omitempty"`
	// OnPaymentFailure: How Paddle should handle changes made to a subscription or its items if the payment fails during update. If omitted, defaults to `prevent_change`.
	OnPaymentFailure *SubscriptionOnPaymentFailure `json:"on_payment_failure,omitempty"`
}

CreateSubscriptionChargeRequest is given as an input to CreateSubscriptionCharge.

type CreateTransactionItems

CreateTransactionItems represents a union request type of the following types:

  • `CatalogItem`
  • `NonCatalogPriceForAnExistingProduct`
  • `NonCatalogPriceAndProduct`

The following constructor functions can be used to create a new instance of this type.

  • `NewCreateTransactionItemsCatalogItem()`
  • `NewCreateTransactionItemsNonCatalogPriceForAnExistingProduct()`
  • `NewCreateTransactionItemsNonCatalogPriceAndProduct()`

Only one of the values can be set at a time, the first non-nil value will be used in the request. Items: Add a non-catalog price for a non-catalog product in your catalog to a transaction. In this case, the product and price that you're billing for are specific to this transaction.

func NewCreateTransactionItemsCatalogItem

func NewCreateTransactionItemsCatalogItem(r *CatalogItem) *CreateTransactionItems

NewCreateTransactionItemsCatalogItem takes a CatalogItem type and creates a CreateTransactionItems for use in a request.

func NewCreateTransactionItemsNonCatalogPriceAndProduct

func NewCreateTransactionItemsNonCatalogPriceAndProduct(r *NonCatalogPriceAndProduct) *CreateTransactionItems

NewCreateTransactionItemsNonCatalogPriceAndProduct takes a NonCatalogPriceAndProduct type and creates a CreateTransactionItems for use in a request.

func NewCreateTransactionItemsNonCatalogPriceForAnExistingProduct

func NewCreateTransactionItemsNonCatalogPriceForAnExistingProduct(r *NonCatalogPriceForAnExistingProduct) *CreateTransactionItems

NewCreateTransactionItemsNonCatalogPriceForAnExistingProduct takes a NonCatalogPriceForAnExistingProduct type and creates a CreateTransactionItems for use in a request.

func (CreateTransactionItems) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface.

type CreateTransactionRequest

type CreateTransactionRequest struct {

	// Items: Add a non-catalog price for a non-catalog product in your catalog to a transaction. In this case, the product and price that you're billing for are specific to this transaction.
	Items []CreateTransactionItems `json:"items,omitempty"`
	/*
	   Status: Status of this transaction. You may set a transaction to `billed` when creating,
	   or omit to let Paddle set the status. Transactions are created as `ready` if they have
	   an `address_id`, `customer_id`, and `items`, otherwise they are created as `draft`.

	   Marking as `billed` when creating is typically used when working with manually-collected
	   transactions as part of an invoicing workflow. Billed transactions cannot be updated, only canceled.
	*/
	Status *TransactionStatus `json:"status,omitempty"`
	// CustomerID: Paddle ID of the customer that this transaction is for, prefixed with `ctm_`. If omitted, transaction status is `draft`.
	CustomerID *string `json:"customer_id,omitempty"`
	// AddressID: Paddle ID of the address that this transaction is for, prefixed with `add_`. Requires `customer_id`. If omitted, transaction status is `draft`.
	AddressID *string `json:"address_id,omitempty"`
	// BusinessID: Paddle ID of the business that this transaction is for, prefixed with `biz_`. Requires `customer_id`.
	BusinessID *string `json:"business_id,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code. Must be `USD`, `EUR`, or `GBP` if `collection_mode` is `manual`.
	CurrencyCode *CurrencyCode `json:"currency_code,omitempty"`
	// CollectionMode: How payment is collected for this transaction. `automatic` for checkout, `manual` for invoices. If omitted, defaults to `automatic`.
	CollectionMode *CollectionMode `json:"collection_mode,omitempty"`
	// DiscountID: Paddle ID of the discount applied to this transaction, prefixed with `dsc_`.
	DiscountID *string `json:"discount_id,omitempty"`
	// BillingDetails: Details for invoicing. Required if `collection_mode` is `manual`.
	BillingDetails *BillingDetails `json:"billing_details,omitempty"`
	// BillingPeriod: Time period that this transaction is for. Set automatically by Paddle for subscription renewals to describe the period that charges are for.
	BillingPeriod *TimePeriod `json:"billing_period,omitempty"`
	// Checkout: Paddle Checkout details for this transaction. You may pass a URL when creating or updating an automatically-collected transaction, or when creating or updating a manually-collected transaction where `billing_details.enable_checkout` is `true`.
	Checkout *TransactionCheckout `json:"checkout,omitempty"`

	// IncludeAddress allows requesting the address sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAddress bool `in:"paddle_include=address" json:"-"`

	// IncludeAdjustments allows requesting the adjustment sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAdjustments bool `in:"paddle_include=adjustment" json:"-"`

	// IncludeAdjustmentsTotals allows requesting the adjustments_totals sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAdjustmentsTotals bool `in:"paddle_include=adjustments_totals" json:"-"`

	// IncludeAvailablePaymentMethods allows requesting the available_payment_methods sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAvailablePaymentMethods bool `in:"paddle_include=available_payment_methods" json:"-"`

	// IncludeBusiness allows requesting the business sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeBusiness bool `in:"paddle_include=business" json:"-"`

	// IncludeCustomer allows requesting the customer sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeCustomer bool `in:"paddle_include=customer" json:"-"`

	// IncludeDiscount allows requesting the discount sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeDiscount bool `in:"paddle_include=discount" json:"-"`
}

CreateTransactionRequest is given as an input to CreateTransaction.

type CreditBalance

type CreditBalance struct {
	// CustomerID: Paddle ID of the customer that this credit balance is for, prefixed with `ctm_`.
	CustomerID string `json:"customer_id,omitempty"`
	// CurrencyCode: Three-letter ISO 4217 currency code for this credit balance.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
	// Balance: Totals for this credit balance. Where a customer has more than one subscription in this currency with a credit balance, includes totals for all subscriptions.
	Balance CustomerBalance `json:"balance,omitempty"`
}

CreditBalance: Represents a credit balance for a customer.

type CurrencyCode

type CurrencyCode string

CurrencyCode: Supported three-letter ISO 4217 currency code..

const (
	CurrencyCodeUSD CurrencyCode = "USD"
	CurrencyCodeEUR CurrencyCode = "EUR"
	CurrencyCodeGBP CurrencyCode = "GBP"
	CurrencyCodeJPY CurrencyCode = "JPY"
	CurrencyCodeAUD CurrencyCode = "AUD"
	CurrencyCodeCAD CurrencyCode = "CAD"
	CurrencyCodeCHF CurrencyCode = "CHF"
	CurrencyCodeHKD CurrencyCode = "HKD"
	CurrencyCodeSGD CurrencyCode = "SGD"
	CurrencyCodeSEK CurrencyCode = "SEK"
	CurrencyCodeARS CurrencyCode = "ARS"
	CurrencyCodeBRL CurrencyCode = "BRL"
	CurrencyCodeCNY CurrencyCode = "CNY"
	CurrencyCodeCOP CurrencyCode = "COP"
	CurrencyCodeCZK CurrencyCode = "CZK"
	CurrencyCodeDKK CurrencyCode = "DKK"
	CurrencyCodeHUF CurrencyCode = "HUF"
	CurrencyCodeILS CurrencyCode = "ILS"
	CurrencyCodeINR CurrencyCode = "INR"
	CurrencyCodeKRW CurrencyCode = "KRW"
	CurrencyCodeMXN CurrencyCode = "MXN"
	CurrencyCodeNOK CurrencyCode = "NOK"
	CurrencyCodeNZD CurrencyCode = "NZD"
	CurrencyCodePLN CurrencyCode = "PLN"
	CurrencyCodeRUB CurrencyCode = "RUB"
	CurrencyCodeTHB CurrencyCode = "THB"
	CurrencyCodeTRY CurrencyCode = "TRY"
	CurrencyCodeTWD CurrencyCode = "TWD"
	CurrencyCodeUAH CurrencyCode = "UAH"
	CurrencyCodeZAR CurrencyCode = "ZAR"
)

type CurrencyCodeChargebacks

type CurrencyCodeChargebacks string

CurrencyCodeChargebacks: Three-letter ISO 4217 currency code for the original chargeback fee..

const (
	CurrencyCodeChargebacksAUD CurrencyCodeChargebacks = "AUD"
	CurrencyCodeChargebacksCAD CurrencyCodeChargebacks = "CAD"
	CurrencyCodeChargebacksEUR CurrencyCodeChargebacks = "EUR"
	CurrencyCodeChargebacksGBP CurrencyCodeChargebacks = "GBP"
	CurrencyCodeChargebacksUSD CurrencyCodeChargebacks = "USD"
)

type CurrencyCodePayouts

type CurrencyCodePayouts string

CurrencyCodePayouts: Three-letter ISO 4217 currency code used for the payout for this transaction. If your primary currency has changed, this reflects the primary currency at the time the transaction was billed..

const (
	CurrencyCodePayoutsAUD CurrencyCodePayouts = "AUD"
	CurrencyCodePayoutsCAD CurrencyCodePayouts = "CAD"
	CurrencyCodePayoutsCHF CurrencyCodePayouts = "CHF"
	CurrencyCodePayoutsCNY CurrencyCodePayouts = "CNY"
	CurrencyCodePayoutsCZK CurrencyCodePayouts = "CZK"
	CurrencyCodePayoutsDKK CurrencyCodePayouts = "DKK"
	CurrencyCodePayoutsEUR CurrencyCodePayouts = "EUR"
	CurrencyCodePayoutsGBP CurrencyCodePayouts = "GBP"
	CurrencyCodePayoutsHUF CurrencyCodePayouts = "HUF"
	CurrencyCodePayoutsPLN CurrencyCodePayouts = "PLN"
	CurrencyCodePayoutsSEK CurrencyCodePayouts = "SEK"
	CurrencyCodePayoutsUSD CurrencyCodePayouts = "USD"
	CurrencyCodePayoutsZAR CurrencyCodePayouts = "ZAR"
)

type CustomData

type CustomData map[string]any

type Customer

type Customer struct {
	// ID: Unique Paddle ID for this customer entity, prefixed with `ctm_`.
	ID string `json:"id,omitempty"`
	// Name: Full name of this customer. Required when creating transactions where `collection_mode` is `manual` (invoices).
	Name *string `json:"name,omitempty"`
	// Email: Email address for this customer.
	Email string `json:"email,omitempty"`
	/*
	   MarketingConsent: Whether this customer opted into marketing from you. `false` unless customers check the marketing consent box
	   when using Paddle Checkout. Set automatically by Paddle.
	*/
	MarketingConsent bool `json:"marketing_consent,omitempty"`
	// Status: Whether this entity can be used in Paddle.
	Status Status `json:"status,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
	// Locale: Valid IETF BCP 47 short form locale tag. If omitted, defaults to `en`.
	Locale string `json:"locale,omitempty"`
	// CreatedAt: RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
	CreatedAt string `json:"created_at,omitempty"`
	// UpdatedAt: RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
	UpdatedAt string `json:"updated_at,omitempty"`
	// ImportMeta: Import information for this entity. `null` if this entity is not imported.
	ImportMeta *ImportMeta `json:"import_meta,omitempty"`
}

Customer: Represents a customer entity with included entities.

type CustomerBalance

type CustomerBalance struct {
	// Available: Total amount of credit available to use.
	Available string `json:"available,omitempty"`
	// Reserved: Total amount of credit temporarily reserved for `billed` transactions.
	Reserved string `json:"reserved,omitempty"`
	// Used: Total amount of credit used.
	Used string `json:"used,omitempty"`
}

CustomerBalance: Totals for this credit balance. Where a customer has more than one subscription in this currency with a credit balance, includes totals for all subscriptions.

type CustomerCreatedEvent added in v0.2.1

type CustomerCreatedEvent struct {
	GenericEvent
	Data paddlenotification.CustomerNotification `json:"data"`
}

CustomerCreatedEvent represents an Event implementation for customer.created event.

type CustomerImportedEvent added in v0.2.1

type CustomerImportedEvent struct {
	GenericEvent
	Data paddlenotification.CustomerNotification `json:"data"`
}

CustomerImportedEvent represents an Event implementation for customer.imported event.

type CustomerUpdatedEvent added in v0.2.1

type CustomerUpdatedEvent struct {
	GenericEvent
	Data paddlenotification.CustomerNotification `json:"data"`
}

CustomerUpdatedEvent represents an Event implementation for customer.updated event.

type CustomersClient

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

CustomersClient is a client for the Customers resource.

func (*CustomersClient) CreateCustomer

func (c *CustomersClient) CreateCustomer(ctx context.Context, req *CreateCustomerRequest) (res *Customer, err error)

CreateCustomer performs the POST operation on a Customers resource.

func (*CustomersClient) GetCustomer

func (c *CustomersClient) GetCustomer(ctx context.Context, req *GetCustomerRequest) (res *Customer, err error)

GetCustomer performs the GET operation on a Customers resource.

func (*CustomersClient) ListCustomers

func (c *CustomersClient) ListCustomers(ctx context.Context, req *ListCustomersRequest) (res *Collection[*Customer], err error)

ListCustomers performs the GET operation on a Customers resource.

func (*CustomersClient) UpdateCustomer

func (c *CustomersClient) UpdateCustomer(ctx context.Context, req *UpdateCustomerRequest) (res *Customer, err error)

UpdateCustomer performs the PATCH operation on a Customers resource.

type DeleteNotificationSettingRequest

type DeleteNotificationSettingRequest struct {
	// URL path parameters.
	NotificationSettingID string `in:"path=notification_setting_id" json:"-"`
}

DeleteNotificationSettingRequest is given as an input to DeleteNotificationSetting.

type Discount

type Discount struct {
	// ID: Unique Paddle ID for this discount, prefixed with `dsc_`.
	ID string `json:"id,omitempty"`
	// Status: Whether this entity can be used in Paddle. `expired` and `used` are set automatically by Paddle.
	Status DiscountStatus `json:"status,omitempty"`
	// Description: Short description for this discount for your reference. Not shown to customers.
	Description string `json:"description,omitempty"`
	// EnabledForCheckout: Whether this discount can be applied by customers at checkout.
	EnabledForCheckout bool `json:"enabled_for_checkout,omitempty"`
	// Code: Unique code that customers can use to apply this discount at checkout.
	Code *string `json:"code,omitempty"`
	// Type: Type of discount. Determines how this discount impacts the transaction total.
	Type DiscountType `json:"type,omitempty"`
	// Amount: Amount to discount by. For `percentage` discounts, must be an amount between `0.01` and `100`. For `flat` and `flat_per_seat` discounts, amount in the lowest denomination for a currency.
	Amount string `json:"amount,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code. Required where discount type is `flat` or `flat_per_seat`.
	CurrencyCode *CurrencyCode `json:"currency_code,omitempty"`
	// Recur: Whether this discount applies for multiple subscription billing periods.
	Recur bool `json:"recur,omitempty"`
	// MaximumRecurringIntervals: Amount of subscription billing periods that this discount recurs for. Requires `recur`. `null` if this discount recurs forever.
	MaximumRecurringIntervals *int `json:"maximum_recurring_intervals,omitempty"`
	// UsageLimit: Maximum amount of times this discount can be used. This is an overall limit, rather than a per-customer limit. `null` if this discount can be used an unlimited amount of times.
	UsageLimit *int `json:"usage_limit,omitempty"`
	// RestrictTo: Product or price IDs that this discount is for. When including a product ID, all prices for that product can be discounted. `null` if this discount applies to all products and prices.
	RestrictTo []string `json:"restrict_to,omitempty"`
	// ExpiresAt: RFC 3339 datetime string of when this discount expires. Discount can no longer be applied after this date has elapsed. `null` if this discount can be applied forever.
	ExpiresAt *string `json:"expires_at,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
	// TimesUsed: How many times this discount has been redeemed. Automatically incremented by Paddle when an order completes.
	TimesUsed int `json:"times_used,omitempty"`
	// CreatedAt: RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
	CreatedAt string `json:"created_at,omitempty"`
	// UpdatedAt: RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
	UpdatedAt string `json:"updated_at,omitempty"`
	// ImportMeta: Import information for this entity. `null` if this entity is not imported.
	ImportMeta *ImportMeta `json:"import_meta,omitempty"`
}

Discount: Discount for this transaction. Returned when the `include` parameter is used with the `discount` value and the transaction has a `discount_id`.

type DiscountCreatedEvent added in v0.2.1

type DiscountCreatedEvent struct {
	GenericEvent
	Data paddlenotification.DiscountNotification `json:"data"`
}

DiscountCreatedEvent represents an Event implementation for discount.created event.

type DiscountImportedEvent added in v0.2.1

type DiscountImportedEvent struct {
	GenericEvent
	Data paddlenotification.DiscountNotification `json:"data"`
}

DiscountImportedEvent represents an Event implementation for discount.imported event.

type DiscountStatus

type DiscountStatus string

DiscountStatus: Whether this entity can be used in Paddle. `expired` and `used` are set automatically by Paddle..

const (
	DiscountStatusActive   DiscountStatus = "active"
	DiscountStatusArchived DiscountStatus = "archived"
	DiscountStatusExpired  DiscountStatus = "expired"
	DiscountStatusUsed     DiscountStatus = "used"
)

type DiscountType

type DiscountType string

DiscountType: Type of discount. Determines how this discount impacts the transaction total..

const (
	DiscountTypeFlat        DiscountType = "flat"
	DiscountTypeFlatPerSeat DiscountType = "flat_per_seat"
	DiscountTypePercentage  DiscountType = "percentage"
)

type DiscountUpdatedEvent added in v0.2.1

type DiscountUpdatedEvent struct {
	GenericEvent
	Data paddlenotification.DiscountNotification `json:"data"`
}

DiscountUpdatedEvent represents an Event implementation for discount.updated event.

type DiscountsClient

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

DiscountsClient is a client for the Discounts resource.

func (*DiscountsClient) CreateDiscount

func (c *DiscountsClient) CreateDiscount(ctx context.Context, req *CreateDiscountRequest) (res *Discount, err error)

CreateDiscount performs the POST operation on a Discounts resource.

func (*DiscountsClient) GetDiscount

func (c *DiscountsClient) GetDiscount(ctx context.Context, req *GetDiscountRequest) (res *Discount, err error)

GetDiscount performs the GET operation on a Discounts resource.

func (*DiscountsClient) ListDiscounts

func (c *DiscountsClient) ListDiscounts(ctx context.Context, req *ListDiscountsRequest) (res *Collection[*Discount], err error)

ListDiscounts performs the GET operation on a Discounts resource.

func (*DiscountsClient) UpdateDiscount

func (c *DiscountsClient) UpdateDiscount(ctx context.Context, req *UpdateDiscountRequest) (res *Discount, err error)

UpdateDiscount performs the PATCH operation on a Discounts resource.

type DiscountsReport

type DiscountsReport struct {
	// Type: Type of report to create.
	Type DiscountsReportType `json:"type,omitempty"`
	// Filters: Filter criteria for this report. If omitted when creating, reports are filtered to include data updated in the last 30 days. This means `updated_at` is greater than or equal to (`gte`) the date 30 days ago from the time the report was generated.
	Filters []DiscountsReportFilters `json:"filters,omitempty"`
}

DiscountsReport: Entity when working with a discounts report.

type DiscountsReportFilterName added in v0.7.0

type DiscountsReportFilterName string

DiscountsReportFilterName: Field name to filter by..

const (
	DiscountsReportFilterNameType      DiscountsReportFilterName = "type"
	DiscountsReportFilterNameStatus    DiscountsReportFilterName = "status"
	DiscountsReportFilterNameUpdatedAt DiscountsReportFilterName = "updated_at"
)

type DiscountsReportFilters added in v0.7.0

type DiscountsReportFilters struct {
	// Name: Field name to filter by.
	Name DiscountsReportFilterName `json:"name,omitempty"`
	// Operator: Operator to use when filtering. Valid when filtering by `updated_at`, `null` otherwise.
	Operator *FilterOperator `json:"operator,omitempty"`
	// Value: Value to filter by. Check the allowed values descriptions for the `name` field to see valid values for a field.
	Value any `json:"value,omitempty"`
}

DiscountsReportFilters: Filter criteria for this report. If omitted when creating, reports are filtered to include data updated in the last 30 days. This means `updated_at` is greater than or equal to (`gte`) the date 30 days ago from the time the report was generated.

type DiscountsReportType added in v0.7.0

type DiscountsReportType string

DiscountsReportType: Type of report to create..

const DiscountsReportTypeDiscounts DiscountsReportType = "discounts"

type Doer

type Doer interface {
	Do(ctx context.Context, method, path string, src, dst any) error
}

Doer is an interface that is used to make requests to the Paddle API. This is of the custom client used by the SDK, instead of the standard http.Client Do method.

type Duration

type Duration struct {
	// Interval: Unit of time.
	Interval Interval `json:"interval,omitempty"`
	// Frequency: Amount of time.
	Frequency int `json:"frequency,omitempty"`
}

Duration: How often this price should be charged. `null` if price is non-recurring (one-time).

type EffectiveFrom

type EffectiveFrom string

EffectiveFrom: When this discount should take effect from..

const (
	EffectiveFromNextBillingPeriod EffectiveFrom = "next_billing_period"
	EffectiveFromImmediately       EffectiveFrom = "immediately"
)

type ErrorCode

type ErrorCode string

ErrorCode: Reason why a payment attempt failed. Returns `null` if payment captured successfully..

const (
	ErrorCodeAlreadyCanceled         ErrorCode = "already_canceled"
	ErrorCodeAlreadyRefunded         ErrorCode = "already_refunded"
	ErrorCodeAuthenticationFailed    ErrorCode = "authentication_failed"
	ErrorCodeBlockedCard             ErrorCode = "blocked_card"
	ErrorCodeCanceled                ErrorCode = "canceled"
	ErrorCodeDeclined                ErrorCode = "declined"
	ErrorCodeDeclinedNotRetryable    ErrorCode = "declined_not_retryable"
	ErrorCodeExpiredCard             ErrorCode = "expired_card"
	ErrorCodeFraud                   ErrorCode = "fraud"
	ErrorCodeInvalidAmount           ErrorCode = "invalid_amount"
	ErrorCodeInvalidPaymentDetails   ErrorCode = "invalid_payment_details"
	ErrorCodeIssuerUnavailable       ErrorCode = "issuer_unavailable"
	ErrorCodeNotEnoughBalance        ErrorCode = "not_enough_balance"
	ErrorCodePspError                ErrorCode = "psp_error"
	ErrorCodeRedactedPaymentMethod   ErrorCode = "redacted_payment_method"
	ErrorCodeSystemError             ErrorCode = "system_error"
	ErrorCodeTransactionNotPermitted ErrorCode = "transaction_not_permitted"
	ErrorCodeUnknown                 ErrorCode = "unknown"
)

type Event

type Event interface{}

Event: Represents an event entity.

type EventType

type EventType struct {
	// Name: Type of event sent by Paddle, in the format `entity.event_type`.
	Name EventTypeName `json:"name,omitempty"`
	// Description: Short description of this event type.
	Description string `json:"description,omitempty"`
	// Group: Group for this event type. Typically the entity that this event relates to.
	Group string `json:"group,omitempty"`
	// AvailableVersions: List of API versions that this event type supports.
	AvailableVersions []int `json:"available_versions,omitempty"`
}

EventType: Represents an event type.

type EventTypeName added in v0.5.0

type EventTypeName string

EventTypeName: Type of event sent by Paddle, in the format `entity.event_type`..

const (
	EventTypeNameAddressCreated           EventTypeName = "address.created"
	EventTypeNameAddressImported          EventTypeName = "address.imported"
	EventTypeNameAddressUpdated           EventTypeName = "address.updated"
	EventTypeNameAdjustmentCreated        EventTypeName = "adjustment.created"
	EventTypeNameAdjustmentUpdated        EventTypeName = "adjustment.updated"
	EventTypeNameBusinessCreated          EventTypeName = "business.created"
	EventTypeNameBusinessImported         EventTypeName = "business.imported"
	EventTypeNameBusinessUpdated          EventTypeName = "business.updated"
	EventTypeNameCustomerCreated          EventTypeName = "customer.created"
	EventTypeNameCustomerImported         EventTypeName = "customer.imported"
	EventTypeNameCustomerUpdated          EventTypeName = "customer.updated"
	EventTypeNameDiscountCreated          EventTypeName = "discount.created"
	EventTypeNameDiscountImported         EventTypeName = "discount.imported"
	EventTypeNameDiscountUpdated          EventTypeName = "discount.updated"
	EventTypeNamePayoutCreated            EventTypeName = "payout.created"
	EventTypeNamePayoutPaid               EventTypeName = "payout.paid"
	EventTypeNamePriceCreated             EventTypeName = "price.created"
	EventTypeNamePriceImported            EventTypeName = "price.imported"
	EventTypeNamePriceUpdated             EventTypeName = "price.updated"
	EventTypeNameProductCreated           EventTypeName = "product.created"
	EventTypeNameProductImported          EventTypeName = "product.imported"
	EventTypeNameProductUpdated           EventTypeName = "product.updated"
	EventTypeNameReportCreated            EventTypeName = "report.created"
	EventTypeNameReportUpdated            EventTypeName = "report.updated"
	EventTypeNameSubscriptionActivated    EventTypeName = "subscription.activated"
	EventTypeNameSubscriptionCanceled     EventTypeName = "subscription.canceled"
	EventTypeNameSubscriptionCreated      EventTypeName = "subscription.created"
	EventTypeNameSubscriptionImported     EventTypeName = "subscription.imported"
	EventTypeNameSubscriptionPastDue      EventTypeName = "subscription.past_due"
	EventTypeNameSubscriptionPaused       EventTypeName = "subscription.paused"
	EventTypeNameSubscriptionResumed      EventTypeName = "subscription.resumed"
	EventTypeNameSubscriptionTrialing     EventTypeName = "subscription.trialing"
	EventTypeNameSubscriptionUpdated      EventTypeName = "subscription.updated"
	EventTypeNameTransactionBilled        EventTypeName = "transaction.billed"
	EventTypeNameTransactionCanceled      EventTypeName = "transaction.canceled"
	EventTypeNameTransactionCompleted     EventTypeName = "transaction.completed"
	EventTypeNameTransactionCreated       EventTypeName = "transaction.created"
	EventTypeNameTransactionPaid          EventTypeName = "transaction.paid"
	EventTypeNameTransactionPastDue       EventTypeName = "transaction.past_due"
	EventTypeNameTransactionPaymentFailed EventTypeName = "transaction.payment_failed"
	EventTypeNameTransactionReady         EventTypeName = "transaction.ready"
	EventTypeNameTransactionUpdated       EventTypeName = "transaction.updated"
)

type EventsClient

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

EventsClient is a client for the Events resource.

func (*EventsClient) ListEvents

func (c *EventsClient) ListEvents(ctx context.Context, req *ListEventsRequest) (res *Collection[Event], err error)

ListEvents performs the GET operation on a Events resource.

type EventsTypesClient

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

EventsTypesClient is a client for the Events types resource.

func (*EventsTypesClient) ListEventTypes

func (c *EventsTypesClient) ListEventTypes(ctx context.Context, req *ListEventTypesRequest) (res *Collection[*EventType], err error)

ListEventTypes performs the GET operation on a Events types resource.

type FilterOperator added in v0.6.0

type FilterOperator string

FilterOperator: Operator to use when filtering. Valid when filtering by `updated_at`, `null` otherwise..

const (
	FilterOperatorLt  FilterOperator = "lt"
	FilterOperatorGte FilterOperator = "gte"
)

type GenericEvent added in v0.2.1

type GenericEvent struct {
	Event
	// EventID: Unique Paddle ID for this event, prefixed with `evt_`.
	EventID string `json:"event_id,omitempty"`
	// EventType: Type of event sent by Paddle, in the format `entity.event_type`.
	EventType EventTypeName `json:"event_type,omitempty"`
	// OccurredAt: RFC 3339 datetime string of when this event occurred.
	OccurredAt string `json:"occurred_at,omitempty"`
	// Data: New or changed entity.
	Data any `json:"data,omitempty"`
}

GenericEvent is an generic implementation for Event

type GetAddressRequest

type GetAddressRequest struct {
	// URL path parameters.
	CustomerID string `in:"path=customer_id" json:"-"`
	AddressID  string `in:"path=address_id" json:"-"`
}

GetAddressRequest is given as an input to GetAddress.

type GetBusinessRequest

type GetBusinessRequest struct {
	// URL path parameters.
	CustomerID string `in:"path=customer_id" json:"-"`
	BusinessID string `in:"path=business_id" json:"-"`
}

GetBusinessRequest is given as an input to GetBusiness.

type GetCustomerRequest

type GetCustomerRequest struct {
	// URL path parameters.
	CustomerID string `in:"path=customer_id" json:"-"`
}

GetCustomerRequest is given as an input to GetCustomer.

type GetDiscountRequest

type GetDiscountRequest struct {
	// URL path parameters.
	DiscountID string `in:"path=discount_id" json:"-"`
}

GetDiscountRequest is given as an input to GetDiscount.

type GetIPAddressesRequest

type GetIPAddressesRequest struct{}

GetIPAddressesRequest is given as an input to GetIPAddresses.

type GetNotificationRequest

type GetNotificationRequest struct {
	// URL path parameters.
	NotificationID string `in:"path=notification_id" json:"-"`
}

GetNotificationRequest is given as an input to GetNotification.

type GetNotificationSettingRequest

type GetNotificationSettingRequest struct {
	// URL path parameters.
	NotificationSettingID string `in:"path=notification_setting_id" json:"-"`
}

GetNotificationSettingRequest is given as an input to GetNotificationSetting.

type GetPriceRequest

type GetPriceRequest struct {
	// URL path parameters.
	PriceID string `in:"path=price_id" json:"-"`

	// IncludeProduct allows requesting the product sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeProduct bool `in:"paddle_include=product" json:"-"`
}

GetPriceRequest is given as an input to GetPrice.

type GetProductRequest

type GetProductRequest struct {
	// URL path parameters.
	ProductID string `in:"path=product_id" json:"-"`

	// IncludePrices allows requesting the prices sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludePrices bool `in:"paddle_include=prices" json:"-"`
}

GetProductRequest is given as an input to GetProduct.

type GetReportCSVRequest

type GetReportCSVRequest struct {
	// URL path parameters.
	ReportID string `in:"path=report_id" json:"-"`
}

GetReportCSVRequest is given as an input to GetReportCSV.

type GetReportRequest

type GetReportRequest struct {
	// URL path parameters.
	ReportID string `in:"path=report_id" json:"-"`
}

GetReportRequest is given as an input to GetReport.

type GetSubscriptionRequest

type GetSubscriptionRequest struct {
	// URL path parameters.
	SubscriptionID string `in:"path=subscription_id" json:"-"`

	// IncludeNextTransaction allows requesting the next_transaction sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeNextTransaction bool `in:"paddle_include=next_transaction" json:"-"`

	// IncludeRecurringTransactionDetails allows requesting the recurring_transaction_details sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeRecurringTransactionDetails bool `in:"paddle_include=recurring_transaction_details" json:"-"`
}

GetSubscriptionRequest is given as an input to GetSubscription.

type GetSubscriptionUpdatePaymentMethodTransactionRequest

type GetSubscriptionUpdatePaymentMethodTransactionRequest struct {
	// URL path parameters.
	SubscriptionID string `in:"path=subscription_id" json:"-"`
}

GetSubscriptionUpdatePaymentMethodTransactionRequest is given as an input to GetSubscriptionUpdatePaymentMethodTransaction.

type GetTransactionInvoiceRequest

type GetTransactionInvoiceRequest struct {
	// URL path parameters.
	TransactionID string `in:"path=transaction_id" json:"-"`
}

GetTransactionInvoiceRequest is given as an input to GetTransactionInvoice.

type GetTransactionRequest

type GetTransactionRequest struct {
	// URL path parameters.
	TransactionID string `in:"path=transaction_id" json:"-"`

	// IncludeAddress allows requesting the address sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAddress bool `in:"paddle_include=address" json:"-"`

	// IncludeAdjustments allows requesting the adjustment sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAdjustments bool `in:"paddle_include=adjustment" json:"-"`

	// IncludeAdjustmentsTotals allows requesting the adjustments_totals sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAdjustmentsTotals bool `in:"paddle_include=adjustments_totals" json:"-"`

	// IncludeAvailablePaymentMethods allows requesting the available_payment_methods sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAvailablePaymentMethods bool `in:"paddle_include=available_payment_methods" json:"-"`

	// IncludeBusiness allows requesting the business sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeBusiness bool `in:"paddle_include=business" json:"-"`

	// IncludeCustomer allows requesting the customer sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeCustomer bool `in:"paddle_include=customer" json:"-"`

	// IncludeDiscount allows requesting the discount sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeDiscount bool `in:"paddle_include=discount" json:"-"`
}

GetTransactionRequest is given as an input to GetTransaction.

type IPAddress

type IPAddress struct {
	// IPv4CIDRs: List of Paddle IPv4 CIDRs.
	IPv4CIDRs []string `json:"ipv4_cidrs,omitempty"`
}

type IPAddressesClient

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

IPAddressesClient is a client for the IP addresses resource.

func (*IPAddressesClient) GetIPAddresses

func (c *IPAddressesClient) GetIPAddresses(ctx context.Context, req *GetIPAddressesRequest) (res *IPAddress, err error)

GetIPAddresses performs the GET operation on a IP addresses resource.

type ImportMeta

type ImportMeta struct {
	// ExternalID: Reference or identifier for this entity from the solution where it was imported from.
	ExternalID *string `json:"external_id,omitempty"`
	// ImportedFrom: Name of the platform where this entity was imported from.
	ImportedFrom string `json:"imported_from,omitempty"`
}

ImportMeta: Import information for this entity. `null` if this entity is not imported.

type Interval

type Interval string

Interval: Unit of time..

const (
	IntervalDay   Interval = "day"
	IntervalWeek  Interval = "week"
	IntervalMonth Interval = "month"
	IntervalYear  Interval = "year"
)

type ListAddressesRequest

type ListAddressesRequest struct {
	// URL path parameters.
	CustomerID string `in:"path=customer_id" json:"-"`

	// After is a query parameter.
	// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
	After *string `in:"query=after;omitempty" json:"-"`
	// ID is a query parameter.
	// Return only the IDs specified. Use a comma-separated list to get multiple entities.
	ID []string `in:"query=id;omitempty" json:"-"`
	// OrderBy is a query parameter.
	/*
	   Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.

	   Valid fields for ordering: `id`.
	*/
	OrderBy *string `in:"query=order_by;omitempty" json:"-"`
	// PerPage is a query parameter.
	/*
	   Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.

	   Default: `50`; Maximum: `200`.
	*/
	PerPage *int `in:"query=per_page;omitempty" json:"-"`
	// Search is a query parameter.
	// Return entities that match a search query. Searches all fields except `status`, `created_at`, and `updated_at`.
	Search *string `in:"query=search;omitempty" json:"-"`
	// Status is a query parameter.
	// Return entities that match the specified status. Use a comma-separated list to specify multiple status values.
	Status []string `in:"query=status;omitempty" json:"-"`
}

ListAddressesRequest is given as an input to ListAddresses.

type ListAdjustmentsRequest

type ListAdjustmentsRequest struct {
	// Action is a query parameter.
	// Return entities for the specified action.
	Action *string `in:"query=action;omitempty" json:"-"`
	// After is a query parameter.
	// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
	After *string `in:"query=after;omitempty" json:"-"`
	// CustomerID is a query parameter.
	// Return entities related to the specified customer. Use a comma-separated list to specify multiple customer IDs.
	CustomerID []string `in:"query=customer_id;omitempty" json:"-"`
	// OrderBy is a query parameter.
	/*
	   Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.

	   Valid fields for ordering: `id`.
	*/
	OrderBy *string `in:"query=order_by;omitempty" json:"-"`
	// PerPage is a query parameter.
	/*
	   Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.

	   Default: `10`; Maximum: `50`.
	*/
	PerPage *int `in:"query=per_page;omitempty" json:"-"`
	// Status is a query parameter.
	// Return entities that match the specified status. Use a comma-separated list to specify multiple status values.
	Status []string `in:"query=status;omitempty" json:"-"`
	// SubscriptionID is a query parameter.
	// Return entities related to the specified subscription. Use a comma-separated list to specify multiple subscription IDs.
	SubscriptionID []string `in:"query=subscription_id;omitempty" json:"-"`
	// TransactionID is a query parameter.
	// Return entities related to the specified transaction. Use a comma-separated list to specify multiple transaction IDs.
	TransactionID []string `in:"query=transaction_id;omitempty" json:"-"`
	// ID is a query parameter.
	// Return only the IDs specified. Use a comma-separated list to get multiple entities.
	ID []string `in:"query=id;omitempty" json:"-"`
}

ListAdjustmentsRequest is given as an input to ListAdjustments.

type ListBusinessesRequest

type ListBusinessesRequest struct {
	// URL path parameters.
	CustomerID string `in:"path=customer_id" json:"-"`

	// After is a query parameter.
	// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
	After *string `in:"query=after;omitempty" json:"-"`
	// ID is a query parameter.
	// Return only the IDs specified. Use a comma-separated list to get multiple entities.
	ID []string `in:"query=id;omitempty" json:"-"`
	// OrderBy is a query parameter.
	/*
	   Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.

	   Valid fields for ordering: `id`.
	*/
	OrderBy *string `in:"query=order_by;omitempty" json:"-"`
	// PerPage is a query parameter.
	/*
	   Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.

	   Default: `50`; Maximum: `200`.
	*/
	PerPage *int `in:"query=per_page;omitempty" json:"-"`
	// Search is a query parameter.
	// Return entities that match a search query. Searches all fields, including contacts, except `status`, `created_at`, and `updated_at`.
	Search *string `in:"query=search;omitempty" json:"-"`
	// Status is a query parameter.
	// Return entities that match the specified status. Use a comma-separated list to specify multiple status values.
	Status []string `in:"query=status;omitempty" json:"-"`
}

ListBusinessesRequest is given as an input to ListBusinesses.

type ListCreditBalancesRequest

type ListCreditBalancesRequest struct {
	// URL path parameters.
	CustomerID string `in:"path=customer_id" json:"-"`
}

ListCreditBalancesRequest is given as an input to ListCreditBalances.

type ListCustomersRequest

type ListCustomersRequest struct {
	// After is a query parameter.
	// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
	After *string `in:"query=after;omitempty" json:"-"`
	// Email is a query parameter.
	// Return entities that exactly match the specified email address. Use a comma-separated list to specify multiple email addresses. Recommended for precise matching of email addresses.
	Email []string `in:"query=email;omitempty" json:"-"`
	// ID is a query parameter.
	// Return only the IDs specified. Use a comma-separated list to get multiple entities.
	ID []string `in:"query=id;omitempty" json:"-"`
	// OrderBy is a query parameter.
	/*
	   Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.

	   Valid fields for ordering: `id`.
	*/
	OrderBy *string `in:"query=order_by;omitempty" json:"-"`
	// PerPage is a query parameter.
	/*
	   Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.

	   Default: `50`; Maximum: `200`.
	*/
	PerPage *int `in:"query=per_page;omitempty" json:"-"`
	// Search is a query parameter.
	// Return entities that match a search query. Searches `id`, `name`, and `email` fields. Use the `email` query parameter for precise matching of email addresses.
	Search *string `in:"query=search;omitempty" json:"-"`
	// Status is a query parameter.
	// Return entities that match the specified status. Use a comma-separated list to specify multiple status values.
	Status []string `in:"query=status;omitempty" json:"-"`
}

ListCustomersRequest is given as an input to ListCustomers.

type ListDiscountsRequest

type ListDiscountsRequest struct {
	// After is a query parameter.
	// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
	After *string `in:"query=after;omitempty" json:"-"`
	// Code is a query parameter.
	// Return entities that match the discount code. Use a comma-separated list to specify multiple discount codes.
	Code []string `in:"query=code;omitempty" json:"-"`
	// ID is a query parameter.
	// Return only the IDs specified. Use a comma-separated list to get multiple entities.
	ID []string `in:"query=id;omitempty" json:"-"`
	// OrderBy is a query parameter.
	/*
	   Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.

	   Valid fields for ordering: `created_at` and `id`.
	*/
	OrderBy *string `in:"query=order_by;omitempty" json:"-"`
	// PerPage is a query parameter.
	/*
	   Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.

	   Default: `50`; Maximum: `200`.
	*/
	PerPage *int `in:"query=per_page;omitempty" json:"-"`
	// Status is a query parameter.
	// Return entities that match the specified status. Use a comma-separated list to specify multiple status values.
	Status []string `in:"query=status;omitempty" json:"-"`
}

ListDiscountsRequest is given as an input to ListDiscounts.

type ListEventTypesRequest

type ListEventTypesRequest struct{}

ListEventTypesRequest is given as an input to ListEventTypes.

type ListEventsRequest

type ListEventsRequest struct {
	// After is a query parameter.
	// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
	After *string `in:"query=after;omitempty" json:"-"`
	// OrderBy is a query parameter.
	/*
	   Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.

	   Valid fields for ordering: `id` (for `event_id`).
	*/
	OrderBy *string `in:"query=order_by;omitempty" json:"-"`
	// PerPage is a query parameter.
	/*
	   Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.

	   Default: `50`; Maximum: `200`.
	*/
	PerPage *int `in:"query=per_page;omitempty" json:"-"`
}

ListEventsRequest is given as an input to ListEvents.

type ListNotificationLogsRequest

type ListNotificationLogsRequest struct {
	// URL path parameters.
	NotificationID string `in:"path=notification_id" json:"-"`

	// After is a query parameter.
	// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
	After *string `in:"query=after;omitempty" json:"-"`
	// PerPage is a query parameter.
	/*
	   Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.

	   Default: `50`; Maximum: `200`.
	*/
	PerPage *int `in:"query=per_page;omitempty" json:"-"`
}

ListNotificationLogsRequest is given as an input to ListNotificationLogs.

type ListNotificationSettingsRequest

type ListNotificationSettingsRequest struct {
	// After is a query parameter.
	// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
	After *string `in:"query=after;omitempty" json:"-"`
	// PerPage is a query parameter.
	/*
	   Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.

	   Default: `200`; Maximum: `200`.
	*/
	PerPage *int `in:"query=per_page;omitempty" json:"-"`
	// OrderBy is a query parameter.
	/*
	   Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.

	   Valid fields for ordering: `id`.
	*/
	OrderBy *string `in:"query=order_by;omitempty" json:"-"`
}

ListNotificationSettingsRequest is given as an input to ListNotificationSettings.

type ListNotificationsRequest

type ListNotificationsRequest struct {
	// After is a query parameter.
	// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
	After *string `in:"query=after;omitempty" json:"-"`
	// NotificationSettingID is a query parameter.
	// Return entities related to the specified notification destination. Use a comma-separated list to specify multiple notification destination IDs.
	NotificationSettingID []string `in:"query=notification_setting_id;omitempty" json:"-"`
	// OrderBy is a query parameter.
	/*
	   Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.

	   Valid fields for ordering: `id`.
	*/
	OrderBy *string `in:"query=order_by;omitempty" json:"-"`
	// PerPage is a query parameter.
	/*
	   Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.

	   Default: `50`; Maximum: `200`.
	*/
	PerPage *int `in:"query=per_page;omitempty" json:"-"`
	// Search is a query parameter.
	// Return entities that match a search query. Searches `id` and `type` fields.
	Search *string `in:"query=search;omitempty" json:"-"`
	// Status is a query parameter.
	// Return entities that match the specified status. Use a comma-separated list to specify multiple status values.
	Status []string `in:"query=status;omitempty" json:"-"`
	// Filter is a query parameter.
	// Return entities that contain the Paddle ID specified. Pass a transaction, customer, or subscription ID.
	Filter *string `in:"query=filter;omitempty" json:"-"`
	// To is a query parameter.
	// Return entities up to a specific time.
	To *string `in:"query=to;omitempty" json:"-"`
	// From is a query parameter.
	// Return entities from a specific time.
	From *string `in:"query=from;omitempty" json:"-"`
}

ListNotificationsRequest is given as an input to ListNotifications.

type ListPricesRequest

type ListPricesRequest struct {
	// After is a query parameter.
	// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
	After *string `in:"query=after;omitempty" json:"-"`
	// ID is a query parameter.
	// Return only the IDs specified. Use a comma-separated list to get multiple entities.
	ID []string `in:"query=id;omitempty" json:"-"`
	// OrderBy is a query parameter.
	/*
	   Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.

	   Valid fields for ordering: `billing_cycle.frequency`, `billing_cycle.interval`, `id`, `product_id`, `quantity.maximum`, `quantity.minimum`, `status`, `tax_mode`, `unit_price.amount`, and `unit_price.currency_code`.
	*/
	OrderBy *string `in:"query=order_by;omitempty" json:"-"`
	// PerPage is a query parameter.
	/*
	   Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.

	   Default: `50`; Maximum: `200`.
	*/
	PerPage *int `in:"query=per_page;omitempty" json:"-"`
	// ProductID is a query parameter.
	// Return entities related to the specified product. Use a comma-separated list to specify multiple product IDs.
	ProductID []string `in:"query=product_id;omitempty" json:"-"`
	// Status is a query parameter.
	// Return entities that match the specified status. Use a comma-separated list to specify multiple status values.
	Status []string `in:"query=status;omitempty" json:"-"`
	// Recurring is a query parameter.
	// Determine whether returned entities are for recurring prices (`true`) or one-time prices (`false`).
	Recurring *bool `in:"query=recurring;omitempty" json:"-"`
	// Type is a query parameter.
	// Return items that match the specified type.
	Type *string `in:"query=type;omitempty" json:"-"`

	// IncludeProduct allows requesting the product sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeProduct bool `in:"paddle_include=product" json:"-"`
}

ListPricesRequest is given as an input to ListPrices.

type ListProductsRequest

type ListProductsRequest struct {
	// After is a query parameter.
	// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
	After *string `in:"query=after;omitempty" json:"-"`
	// ID is a query parameter.
	// Return only the IDs specified. Use a comma-separated list to get multiple entities.
	ID []string `in:"query=id;omitempty" json:"-"`
	// OrderBy is a query parameter.
	/*
	   Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.

	   Valid fields for ordering: `created_at`, `custom_data`, `description`, `id`, `image_url`, `name`, `status`, `tax_category`, and `updated_at`.
	*/
	OrderBy *string `in:"query=order_by;omitempty" json:"-"`
	// PerPage is a query parameter.
	/*
	   Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.

	   Default: `50`; Maximum: `200`.
	*/
	PerPage *int `in:"query=per_page;omitempty" json:"-"`
	// Status is a query parameter.
	// Return entities that match the specified status. Use a comma-separated list to specify multiple status values.
	Status []string `in:"query=status;omitempty" json:"-"`
	// TaxCategory is a query parameter.
	// Return entities that match the specified tax category. Use a comma-separated list to specify multiple tax categories.
	TaxCategory []string `in:"query=tax_category;omitempty" json:"-"`
	// Type is a query parameter.
	// Return items that match the specified type.
	Type *string `in:"query=type;omitempty" json:"-"`

	// IncludePrices allows requesting the prices sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludePrices bool `in:"paddle_include=prices" json:"-"`
}

ListProductsRequest is given as an input to ListProducts.

type ListReportsRequest

type ListReportsRequest struct {
	// After is a query parameter.
	// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
	After *string `in:"query=after;omitempty" json:"-"`
	// OrderBy is a query parameter.
	/*
	   Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.

	   Valid fields for ordering: `id`.
	*/
	OrderBy *string `in:"query=order_by;omitempty" json:"-"`
	// PerPage is a query parameter.
	/*
	   Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.

	   Default: `50`; Maximum: `200`.
	*/
	PerPage *int `in:"query=per_page;omitempty" json:"-"`
	// Status is a query parameter.
	// Return entities that match the specified status. Use a comma-separated list to specify multiple status values.
	Status []string `in:"query=status;omitempty" json:"-"`
}

ListReportsRequest is given as an input to ListReports.

type ListSubscriptionsRequest

type ListSubscriptionsRequest struct {
	// AddressID is a query parameter.
	// Return entities related to the specified address. Use a comma-separated list to specify multiple address IDs.
	AddressID []string `in:"query=address_id;omitempty" json:"-"`
	// After is a query parameter.
	// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
	After *string `in:"query=after;omitempty" json:"-"`
	// CollectionMode is a query parameter.
	// Return entities that match the specified collection mode.
	CollectionMode *string `in:"query=collection_mode;omitempty" json:"-"`
	// CustomerID is a query parameter.
	// Return entities related to the specified customer. Use a comma-separated list to specify multiple customer IDs.
	CustomerID []string `in:"query=customer_id;omitempty" json:"-"`
	// ID is a query parameter.
	// Return only the IDs specified. Use a comma-separated list to get multiple entities.
	ID []string `in:"query=id;omitempty" json:"-"`
	// OrderBy is a query parameter.
	/*
	   Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.

	   Valid fields for ordering: `id`.
	*/
	OrderBy *string `in:"query=order_by;omitempty" json:"-"`
	// PerPage is a query parameter.
	/*
	   Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.

	   Default: `50`; Maximum: `200`.
	*/
	PerPage *int `in:"query=per_page;omitempty" json:"-"`
	// PriceID is a query parameter.
	// Return entities related to the specified price. Use a comma-separated list to specify multiple price IDs.
	PriceID []string `in:"query=price_id;omitempty" json:"-"`
	// ScheduledChangeAction is a query parameter.
	// Return subscriptions that have a scheduled change. Use a comma-separated list to specify multiple scheduled change actions.
	ScheduledChangeAction []string `in:"query=scheduled_change_action;omitempty" json:"-"`
	// Status is a query parameter.
	// Return entities that match the specified status. Use a comma-separated list to specify multiple status values.
	Status []string `in:"query=status;omitempty" json:"-"`
}

ListSubscriptionsRequest is given as an input to ListSubscriptions.

type ListTransactionsRequest

type ListTransactionsRequest struct {
	// After is a query parameter.
	// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
	After *string `in:"query=after;omitempty" json:"-"`
	// BilledAt is a query parameter.
	// Return entities billed at a specific time. Pass an RFC 3339 datetime string, or use `[LT]` (less than), `[LTE]` (less than or equal to), `[GT]` (greater than), or `[GTE]` (greater than or equal to) operators. For example, `billed_at=2023-04-18T17:03:26` or `billed_at[LT]=2023-04-18T17:03:26`.
	BilledAt *string `in:"query=billed_at;omitempty" json:"-"`
	// CollectionMode is a query parameter.
	// Return entities that match the specified collection mode.
	CollectionMode *string `in:"query=collection_mode;omitempty" json:"-"`
	// CreatedAt is a query parameter.
	// Return entities created at a specific time. Pass an RFC 3339 datetime string, or use `[LT]` (less than), `[LTE]` (less than or equal to), `[GT]` (greater than), or `[GTE]` (greater than or equal to) operators. For example, `created_at=2023-04-18T17:03:26` or `created_at[LT]=2023-04-18T17:03:26`.
	CreatedAt *string `in:"query=created_at;omitempty" json:"-"`
	// CustomerID is a query parameter.
	// Return entities related to the specified customer. Use a comma-separated list to specify multiple customer IDs.
	CustomerID []string `in:"query=customer_id;omitempty" json:"-"`
	// ID is a query parameter.
	// Return only the IDs specified. Use a comma-separated list to get multiple entities.
	ID []string `in:"query=id;omitempty" json:"-"`
	// InvoiceNumber is a query parameter.
	// Return entities that match the invoice number. Use a comma-separated list to specify multiple invoice numbers.
	InvoiceNumber []string `in:"query=invoice_number;omitempty" json:"-"`
	// Origin is a query parameter.
	// Return entities related to the specified origin. Use a comma-separated list to specify multiple origins.
	Origin []string `in:"query=origin;omitempty" json:"-"`
	// OrderBy is a query parameter.
	/*
	   Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.

	   Valid fields for ordering: `billed_at`, `created_at`, `id`, and `updated_at`.
	*/
	OrderBy *string `in:"query=order_by;omitempty" json:"-"`
	// Status is a query parameter.
	// Return entities that match the specified status. Use a comma-separated list to specify multiple status values.
	Status []string `in:"query=status;omitempty" json:"-"`
	// SubscriptionID is a query parameter.
	// Return entities related to the specified subscription. Use a comma-separated list to specify multiple subscription IDs. Pass `null` to return entities that are not related to any subscription.
	SubscriptionID []string `in:"query=subscription_id;omitempty" json:"-"`
	// PerPage is a query parameter.
	// Set how many entities are returned per page.
	PerPage *int `in:"query=per_page;omitempty" json:"-"`
	// UpdatedAt is a query parameter.
	// Return entities updated at a specific time. Pass an RFC 3339 datetime string, or use `[LT]` (less than), `[LTE]` (less than or equal to), `[GT]` (greater than), or `[GTE]` (greater than or equal to) operators. For example, `updated_at=2023-04-18T17:03:26` or `updated_at[LT]=2023-04-18T17:03:26`.
	UpdatedAt *string `in:"query=updated_at;omitempty" json:"-"`

	// IncludeAddress allows requesting the address sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAddress bool `in:"paddle_include=address" json:"-"`

	// IncludeAdjustments allows requesting the adjustment sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAdjustments bool `in:"paddle_include=adjustment" json:"-"`

	// IncludeAdjustmentsTotals allows requesting the adjustments_totals sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAdjustmentsTotals bool `in:"paddle_include=adjustments_totals" json:"-"`

	// IncludeAvailablePaymentMethods allows requesting the available_payment_methods sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAvailablePaymentMethods bool `in:"paddle_include=available_payment_methods" json:"-"`

	// IncludeBusiness allows requesting the business sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeBusiness bool `in:"paddle_include=business" json:"-"`

	// IncludeCustomer allows requesting the customer sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeCustomer bool `in:"paddle_include=customer" json:"-"`

	// IncludeDiscount allows requesting the discount sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeDiscount bool `in:"paddle_include=discount" json:"-"`
}

ListTransactionsRequest is given as an input to ListTransactions.

type Meta

type Meta struct {
	// RequestID: Unique ID for the request relating to this response. Provide this when contacting Paddle support about a specific request.
	RequestID string `json:"request_id,omitempty"`
}

Meta: Information about this response.

type MetaPaginated

type MetaPaginated struct {
	// RequestID: Unique ID for the request relating to this response. Provide this when contacting Paddle support about a specific request.
	RequestID string `json:"request_id,omitempty"`
	// Pagination: Keys used for working with paginated results.
	Pagination Pagination `json:"pagination,omitempty"`
}

MetaPaginated: Information about this response.

type MethodDetails

type MethodDetails struct {
	// Type: Type of payment method used for this payment attempt.
	Type PaymentMethodType `json:"type,omitempty"`
	// Card: Information about the credit or debit card used to pay. `null` unless `type` is `card`.
	Card *Card `json:"card,omitempty"`
}

MethodDetails: Information about the payment method used for a payment attempt.

type Money

type Money struct {
	// Amount: Amount in the lowest denomination for the currency, e.g. 10 USD = 1000 (cents).
	Amount string `json:"amount,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
}

Money: Base price. This price applies to all customers, except for customers located in countries where you have `unit_price_overrides`.

type NextTransaction

type NextTransaction struct {
	// BillingPeriod: Billing period for the next transaction.
	BillingPeriod TimePeriod `json:"billing_period,omitempty"`
	// Details: Calculated totals for a transaction preview, including discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction preview.
	Details SubscriptionTransactionDetailsPreview `json:"details,omitempty"`
	// Adjustments: Represents an adjustment entity when previewing adjustments.
	Adjustments []AdjustmentPreview `json:"adjustments,omitempty"`
}

NextTransaction: Preview of the next transaction for this subscription. May include prorated charges that are not yet billed and one-time charges. Returned when the `include` parameter is used with the `next_transaction` value. `null` if the subscription is scheduled to cancel or pause.

type NonCatalogPriceAndProduct

type NonCatalogPriceAndProduct struct {
	// Quantity: Quantity of this item on the transaction.
	Quantity int `json:"quantity,omitempty"`
	// Proration: How proration was calculated for this item. Populated when a transaction is created from a subscription change, where `proration_billing_mode` was `prorated_immediately` or `prorated_next_billing_period`. Set automatically by Paddle.
	Proration *Proration `json:"proration,omitempty"`
	// Price: Price object for a non-catalog item to charge for. Include a `product` object to create a non-catalog product for this non-catalog price.
	Price TransactionPriceCreateWithProduct `json:"price,omitempty"`
}

NonCatalogPriceAndProduct: Add a non-catalog price for a non-catalog product in your catalog to a transaction. In this case, the product and price that you're billing for are specific to this transaction.

type NonCatalogPriceForAnExistingProduct

type NonCatalogPriceForAnExistingProduct struct {
	// Quantity: Quantity of this item on the transaction.
	Quantity int `json:"quantity,omitempty"`
	// Proration: How proration was calculated for this item. Populated when a transaction is created from a subscription change, where `proration_billing_mode` was `prorated_immediately` or `prorated_next_billing_period`. Set automatically by Paddle.
	Proration *Proration `json:"proration,omitempty"`
	// Price: Price object for a non-catalog item to charge for. Include a `product_id` to relate this non-catalog price to an existing catalog price.
	Price TransactionPriceCreateWithProductID `json:"price,omitempty"`
}

NonCatalogPriceForAnExistingProduct: Add a non-catalog price for an existing product in your catalog to a transaction. In this case, the product you're billing for is a catalog product, but you charge a specific price for it.

type Notification

type Notification struct {
	// ID: Unique Paddle ID for this notification, prefixed with `ntf_`.
	ID string `json:"id,omitempty"`
	// Type: Type of event sent by Paddle, in the format `entity.event_type`.
	Type EventTypeName `json:"type,omitempty"`
	// Status: Status of this notification.
	Status NotificationStatus `json:"status,omitempty"`
	// Payload: Notification payload. Includes the new or changed event.
	Payload paddlenotification.NotificationEvent `json:"payload,omitempty"`
	// OccurredAt: RFC 3339 datetime string of when this notification occurred.
	OccurredAt string `json:"occurred_at,omitempty"`
	// DeliveredAt: RFC 3339 datetime string of when this notification was delivered. `null` if not yet delivered successfully.
	DeliveredAt *string `json:"delivered_at,omitempty"`
	// ReplayedAt: RFC 3339 datetime string of when this notification was replayed. `null` if not replayed.
	ReplayedAt *string `json:"replayed_at,omitempty"`
	// Origin: Describes how this notification was created.
	Origin NotificationOrigin `json:"origin,omitempty"`
	// LastAttemptAt: RFC 3339 datetime string of when this notification was last attempted.
	LastAttemptAt *string `json:"last_attempt_at,omitempty"`
	// RetryAt: RFC 3339 datetime string of when this notification is scheduled to be retried.
	RetryAt *string `json:"retry_at,omitempty"`
	// TimesAttempted: How many times delivery of this notification has been attempted. Automatically incremented by Paddle after an attempt.
	TimesAttempted int `json:"times_attempted,omitempty"`
	// NotificationSettingID: Unique Paddle ID for this notification setting, prefixed with `ntfset_`.
	NotificationSettingID string `json:"notification_setting_id,omitempty"`
}

Notification: Represents a notification entity.

func (*Notification) UnmarshalJSON added in v0.2.1

func (n *Notification) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Notification

type NotificationLog

type NotificationLog struct {
	// ID: Unique Paddle ID for this notification log, prefixed with `ntflog_`.
	ID string `json:"id,omitempty"`
	// ResponseCode: HTTP code sent by the responding server.
	ResponseCode int `json:"response_code,omitempty"`
	// ResponseContentType: Content-Type sent by the responding server.
	ResponseContentType *string `json:"response_content_type,omitempty"`
	// ResponseBody: Response body sent by the responding server. Typically empty for success responses.
	ResponseBody string `json:"response_body,omitempty"`
	// AttemptedAt: RFC 3339 datetime string of when Paddle attempted to deliver the related notification.
	AttemptedAt string `json:"attempted_at,omitempty"`
}

NotificationLog: Represents a notification log entity.

type NotificationLogsClient

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

NotificationLogsClient is a client for the Notification logs resource.

func (*NotificationLogsClient) ListNotificationLogs

func (c *NotificationLogsClient) ListNotificationLogs(ctx context.Context, req *ListNotificationLogsRequest) (res *Collection[*NotificationLog], err error)

ListNotificationLogs performs the GET operation on a Notification logs resource.

type NotificationOrigin added in v0.5.0

type NotificationOrigin string

NotificationOrigin: Describes how this notification was created..

const (
	NotificationOriginEvent  NotificationOrigin = "event"
	NotificationOriginReplay NotificationOrigin = "replay"
)

type NotificationSetting

type NotificationSetting struct {
	// ID: Unique Paddle ID for this notification setting, prefixed with `ntfset_`.
	ID string `json:"id,omitempty"`
	// Description: Short description for this notification destination. Shown in the Paddle web app.
	Description string `json:"description,omitempty"`
	// Type: Where notifications should be sent for this destination.
	Type NotificationSettingType `json:"type,omitempty"`
	// Destination: Webhook endpoint URL or email address.
	Destination string `json:"destination,omitempty"`
	// Active: Whether Paddle should try to deliver events to this notification destination.
	Active bool `json:"active,omitempty"`
	// APIVersion: API version that returned objects for events should conform to. Must be a valid version of the Paddle API. Cannot be a version older than your account default.
	APIVersion int `json:"api_version,omitempty"`
	// IncludeSensitiveFields: Whether potentially sensitive fields should be sent to this notification destination.
	IncludeSensitiveFields bool `json:"include_sensitive_fields,omitempty"`
	// SubscribedEvents: Represents an event type.
	SubscribedEvents []EventType `json:"subscribed_events,omitempty"`
	// EndpointSecretKey: Webhook destination secret key, prefixed with `pdl_ntfset_`. Used for signature verification.
	EndpointSecretKey string `json:"endpoint_secret_key,omitempty"`
}

NotificationSetting: Represents a notification destination.

type NotificationSettingReplaysClient

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

NotificationSettingReplaysClient is a client for the Notification setting replays resource.

func (*NotificationSettingReplaysClient) ReplayNotification

func (c *NotificationSettingReplaysClient) ReplayNotification(ctx context.Context, req *ReplayNotificationRequest) (err error)

ReplayNotification performs the POST operation on a Notification setting replays resource.

type NotificationSettingType

type NotificationSettingType string

NotificationSettingType: Where notifications should be sent for this destination..

const (
	NotificationSettingTypeEmail NotificationSettingType = "email"
	NotificationSettingTypeURL   NotificationSettingType = "url"
)

type NotificationSettingsClient

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

NotificationSettingsClient is a client for the Notification settings resource.

func (*NotificationSettingsClient) CreateNotificationSetting

func (c *NotificationSettingsClient) CreateNotificationSetting(ctx context.Context, req *CreateNotificationSettingRequest) (res *NotificationSetting, err error)

CreateNotificationSetting performs the POST operation on a Notification settings resource.

func (*NotificationSettingsClient) DeleteNotificationSetting

func (c *NotificationSettingsClient) DeleteNotificationSetting(ctx context.Context, req *DeleteNotificationSettingRequest) (err error)

DeleteNotificationSetting performs the DELETE operation on a Notification settings resource.

func (*NotificationSettingsClient) GetNotificationSetting

func (c *NotificationSettingsClient) GetNotificationSetting(ctx context.Context, req *GetNotificationSettingRequest) (res *NotificationSetting, err error)

GetNotificationSetting performs the GET operation on a Notification settings resource.

func (*NotificationSettingsClient) ListNotificationSettings

ListNotificationSettings performs the GET operation on a Notification settings resource.

func (*NotificationSettingsClient) UpdateNotificationSetting

func (c *NotificationSettingsClient) UpdateNotificationSetting(ctx context.Context, req *UpdateNotificationSettingRequest) (res *NotificationSetting, err error)

UpdateNotificationSetting performs the PATCH operation on a Notification settings resource.

type NotificationStatus

type NotificationStatus string

NotificationStatus: Status of this notification..

const (
	NotificationStatusNotAttempted NotificationStatus = "not_attempted"
	NotificationStatusNeedsRetry   NotificationStatus = "needs_retry"
	NotificationStatusDelivered    NotificationStatus = "delivered"
	NotificationStatusFailed       NotificationStatus = "failed"
)

type NotificationsClient

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

NotificationsClient is a client for the Notifications resource.

func (*NotificationsClient) GetNotification

func (c *NotificationsClient) GetNotification(ctx context.Context, req *GetNotificationRequest) (res *Notification, err error)

GetNotification performs the GET operation on a Notifications resource.

func (*NotificationsClient) ListNotifications

func (c *NotificationsClient) ListNotifications(ctx context.Context, req *ListNotificationsRequest) (res *Collection[*Notification], err error)

ListNotifications performs the GET operation on a Notifications resource.

type Option

type Option func(*options)

Option is a function that configures the Paddle SDK.

func WithAPIKey

func WithAPIKey(apiKey string) Option

WithAPIKey returns an option that sets the Paddle API key.

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL returns an option that sets the base URL for the Paddle API.

func WithClient

func WithClient(c client.HTTPDoer) Option

WithClient returns an option that sets the HTTP client used to make requests to the Paddle API.

type Original

type Original struct {
	// Amount: Fee amount for this chargeback in the original currency.
	Amount string `json:"amount,omitempty"`
	// CurrencyCode: Three-letter ISO 4217 currency code for the original chargeback fee.
	CurrencyCode CurrencyCodeChargebacks `json:"currency_code,omitempty"`
}

Original: Chargeback fee before conversion to the payout currency. `null` when the chargeback fee is the same as the payout currency.

type Pagination

type Pagination struct {
	// PerPage: Number of entities per page for this response. May differ from the number requested if the requested number is greater than the maximum.
	PerPage int `json:"per_page,omitempty"`
	// Next: URL containing the query parameters of the original request, along with the `after` parameter that marks the starting point of the next page. Always returned, even if `has_more` is `false`.
	Next string `json:"next,omitempty"`
	// HasMore: Whether this response has another page.
	HasMore bool `json:"has_more,omitempty"`
	// EstimatedTotal: Estimated number of entities for this response.
	EstimatedTotal int `json:"estimated_total,omitempty"`
}

Pagination: Keys used for working with paginated results.

type PatchField

type PatchField[T any] struct {
	// contains filtered or unexported fields
}

PatchField is a type that represents a field in a patch request. It is used to differentiate between: * a field that should not be present in the request. * a field that should be present in the request, but with a null value. * a field that should be present in the request, with a non-null value. Using the standard json package, it is not possible to differentiate between a field that is not present and a field that is present with an explicit null value without the use of maps. This type is used to work around this limitation, and provides some type safety by allowing the user to specify the type of the field as a type parameter. To create a new PatchField value, use the NewPatchField function.

func NewNullPatchField

func NewNullPatchField[T any]() *PatchField[T]

NewNullPatchField creates a new PatchField with a null value.

func NewPatchField

func NewPatchField[T any](value T) *PatchField[T]

NewPatchField creates a new PatchField from a given value. This is used for fields that accept either a value, or omitted completely.

func NewPtrPatchField

func NewPtrPatchField[T any](value T) *PatchField[*T]

NewPtrPatchField creates a new PatchField from a concrete value, where the expected PatchField value is a pointer (aka optional). This is an alias to doing NewPatchField(ptrTo(v)), where ptrTo is a function that returns a pointer to the given value (e.g. &v).

func (PatchField[T]) MarshalJSON

func (f PatchField[T]) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. If the PatchField hasn't been set on the type, then the omitempty will handle it as an omitted field. If the PatchField has been set, then this will render the null value as a JSON null.

func (PatchField[T]) Value

func (f PatchField[T]) Value() *T

Value returns the value, if any.

type PauseSubscriptionRequest

type PauseSubscriptionRequest struct {
	// URL path parameters.
	SubscriptionID string `in:"path=subscription_id" json:"-"`

	/*
	   EffectiveFrom: When this subscription change should take effect from. Defaults to `next_billing_period` for active subscriptions,
	   which creates a `scheduled_change` to apply the subscription change at the end of the billing period.
	*/
	EffectiveFrom *EffectiveFrom `json:"effective_from,omitempty"`
	// ResumeAt: RFC 3339 datetime string of when the paused subscription should resume. Omit to pause indefinitely until resumed.
	ResumeAt *string `json:"resume_at,omitempty"`
}

PauseSubscriptionRequest is given as an input to PauseSubscription.

type PaymentAttemptStatus

type PaymentAttemptStatus string

PaymentAttemptStatus: Status of this payment attempt..

const (
	PaymentAttemptStatusAuthorized              PaymentAttemptStatus = "authorized"
	PaymentAttemptStatusAuthorizedFlagged       PaymentAttemptStatus = "authorized_flagged"
	PaymentAttemptStatusCanceled                PaymentAttemptStatus = "canceled"
	PaymentAttemptStatusCaptured                PaymentAttemptStatus = "captured"
	PaymentAttemptStatusError                   PaymentAttemptStatus = "error"
	PaymentAttemptStatusActionRequired          PaymentAttemptStatus = "action_required"
	PaymentAttemptStatusPendingNoActionRequired PaymentAttemptStatus = "pending_no_action_required"
	PaymentAttemptStatusCreated                 PaymentAttemptStatus = "created"
	PaymentAttemptStatusUnknown                 PaymentAttemptStatus = "unknown"
	PaymentAttemptStatusDropped                 PaymentAttemptStatus = "dropped"
)

type PaymentMethodType

type PaymentMethodType string

PaymentMethodType: Type of payment method used for this payment attempt..

const (
	PaymentMethodTypeAlipay       PaymentMethodType = "alipay"
	PaymentMethodTypeApplePay     PaymentMethodType = "apple_pay"
	PaymentMethodTypeBancontact   PaymentMethodType = "bancontact"
	PaymentMethodTypeCard         PaymentMethodType = "card"
	PaymentMethodTypeGooglePay    PaymentMethodType = "google_pay"
	PaymentMethodTypeIdeal        PaymentMethodType = "ideal"
	PaymentMethodTypeOffline      PaymentMethodType = "offline"
	PaymentMethodTypePaypal       PaymentMethodType = "paypal"
	PaymentMethodTypeUnknown      PaymentMethodType = "unknown"
	PaymentMethodTypeWireTransfer PaymentMethodType = "wire_transfer"
)

type PayoutCreatedEvent added in v0.2.1

type PayoutCreatedEvent struct {
	GenericEvent
	Data paddlenotification.PayoutNotification `json:"data"`
}

PayoutCreatedEvent represents an Event implementation for payout.created event.

type PayoutPaidEvent added in v0.2.1

type PayoutPaidEvent struct {
	GenericEvent
	Data paddlenotification.PayoutNotification `json:"data"`
}

PayoutPaidEvent represents an Event implementation for payout.paid event.

type PayoutTotalsAdjustment

type PayoutTotalsAdjustment struct {
	// Subtotal: Adjustment total before tax and fees.
	Subtotal string `json:"subtotal,omitempty"`
	// Tax: Total tax on the adjustment subtotal.
	Tax string `json:"tax,omitempty"`
	// Total: Adjustment total after tax.
	Total string `json:"total,omitempty"`
	// Fee: Adjusted Paddle fee.
	Fee string `json:"fee,omitempty"`
	// ChargebackFee: Chargeback fees incurred for this adjustment. Only returned when the adjustment `action` is `chargeback` or `chargeback_warning`.
	ChargebackFee ChargebackFee `json:"chargeback_fee,omitempty"`
	// Earnings: Adjusted payout earnings. This is the adjustment total plus adjusted Paddle fees, excluding chargeback fees.
	Earnings string `json:"earnings,omitempty"`
	// CurrencyCode: Three-letter ISO 4217 currency code used for the payout for this transaction. If your primary currency has changed, this reflects the primary currency at the time the transaction was billed.
	CurrencyCode CurrencyCodePayouts `json:"currency_code,omitempty"`
}

PayoutTotalsAdjustment: Breakdown of how this adjustment affects your payout balance.

type PreviewSubscriptionChargeItems

PreviewSubscriptionChargeItems represents a union request type of the following types:

  • `SubscriptionCatalogItem`
  • `SubscriptionNonCatalogPriceForAnExistingProduct`
  • `SubscriptionNonCatalogPriceAndProduct`

The following constructor functions can be used to create a new instance of this type.

  • `NewPreviewSubscriptionChargeItemsSubscriptionCatalogItem()`
  • `NewPreviewSubscriptionChargeItemsSubscriptionNonCatalogPriceForAnExistingProduct()`
  • `NewPreviewSubscriptionChargeItemsSubscriptionNonCatalogPriceAndProduct()`

Only one of the values can be set at a time, the first non-nil value will be used in the request. Items: Add a non-catalog price for a non-catalog product in your catalog to a subscription. In this case, the product and price that you're billing for are specific to this transaction.

func NewPreviewSubscriptionChargeItemsSubscriptionCatalogItem added in v0.7.0

func NewPreviewSubscriptionChargeItemsSubscriptionCatalogItem(r *SubscriptionCatalogItem) *PreviewSubscriptionChargeItems

NewPreviewSubscriptionChargeItemsSubscriptionCatalogItem takes a SubscriptionCatalogItem type and creates a PreviewSubscriptionChargeItems for use in a request.

func NewPreviewSubscriptionChargeItemsSubscriptionNonCatalogPriceAndProduct added in v0.7.0

func NewPreviewSubscriptionChargeItemsSubscriptionNonCatalogPriceAndProduct(r *SubscriptionNonCatalogPriceAndProduct) *PreviewSubscriptionChargeItems

NewPreviewSubscriptionChargeItemsSubscriptionNonCatalogPriceAndProduct takes a SubscriptionNonCatalogPriceAndProduct type and creates a PreviewSubscriptionChargeItems for use in a request.

func NewPreviewSubscriptionChargeItemsSubscriptionNonCatalogPriceForAnExistingProduct added in v0.7.0

func NewPreviewSubscriptionChargeItemsSubscriptionNonCatalogPriceForAnExistingProduct(r *SubscriptionNonCatalogPriceForAnExistingProduct) *PreviewSubscriptionChargeItems

NewPreviewSubscriptionChargeItemsSubscriptionNonCatalogPriceForAnExistingProduct takes a SubscriptionNonCatalogPriceForAnExistingProduct type and creates a PreviewSubscriptionChargeItems for use in a request.

func (PreviewSubscriptionChargeItems) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface.

type PreviewSubscriptionChargeRequest

type PreviewSubscriptionChargeRequest struct {
	// URL path parameters.
	SubscriptionID string `in:"path=subscription_id" json:"-"`

	// EffectiveFrom: When one-time charges should be billed.
	EffectiveFrom EffectiveFrom `json:"effective_from,omitempty"`
	// Items: Add a non-catalog price for a non-catalog product in your catalog to a subscription. In this case, the product and price that you're billing for are specific to this transaction.
	Items []PreviewSubscriptionChargeItems `json:"items,omitempty"`
	// OnPaymentFailure: How Paddle should handle changes made to a subscription or its items if the payment fails during update. If omitted, defaults to `prevent_change`.
	OnPaymentFailure *SubscriptionOnPaymentFailure `json:"on_payment_failure,omitempty"`
}

PreviewSubscriptionChargeRequest is given as an input to PreviewSubscriptionCharge.

type PreviewSubscriptionUpdateRequest added in v0.5.0

type PreviewSubscriptionUpdateRequest struct {
	// URL path parameters.
	SubscriptionID string `in:"path=subscription_id" json:"-"`

	// CustomerID: Paddle ID of the customer that this subscription is for, prefixed with `ctm_`. Include to change the customer for a subscription.
	CustomerID *PatchField[string] `json:"customer_id,omitempty"`
	// AddressID: Paddle ID of the address that this subscription is for, prefixed with `add_`. Include to change the address for a subscription.
	AddressID *PatchField[string] `json:"address_id,omitempty"`
	// BusinessID: Paddle ID of the business that this subscription is for, prefixed with `biz_`. Include to change the business for a subscription.
	BusinessID *PatchField[*string] `json:"business_id,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code. Include to change the currency that a subscription bills in. When changing `collection_mode` to `manual`, you may need to change currency code to `USD`, `EUR`, or `GBP`.
	CurrencyCode *PatchField[CurrencyCode] `json:"currency_code,omitempty"`
	// NextBilledAt: RFC 3339 datetime string of when this subscription is next scheduled to be billed. Include to change the next billing date.
	NextBilledAt *PatchField[string] `json:"next_billed_at,omitempty"`
	// Discount: Details of the discount applied to this subscription. Include to add a discount to a subscription. `null` to remove a discount.
	Discount *PatchField[*SubscriptionDiscountEffectiveFrom] `json:"discount,omitempty"`
	// CollectionMode: How payment is collected for transactions created for this subscription. `automatic` for checkout, `manual` for invoices.
	CollectionMode *PatchField[CollectionMode] `json:"collection_mode,omitempty"`
	// BillingDetails: Details for invoicing. Required if `collection_mode` is `manual`. `null` if changing `collection_mode` to `automatic`.
	BillingDetails *PatchField[*BillingDetailsUpdate] `json:"billing_details,omitempty"`
	// ScheduledChange: Change that's scheduled to be applied to a subscription. When updating, you may only set to `null` to remove a scheduled change. Use the pause subscription, cancel subscription, and resume subscription operations to create scheduled changes.
	ScheduledChange *PatchField[*SubscriptionScheduledChange] `json:"scheduled_change,omitempty"`
	// Items: Add or update a catalog item to a subscription. In this case, the product and price that you're billing for exist in your product catalog in Paddle.
	Items *PatchField[[]SubscriptionUpdateCatalogItem] `json:"items,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData *PatchField[CustomData] `json:"custom_data,omitempty"`
	/*
	   ProrationBillingMode: How Paddle should handle proration calculation for changes made to a subscription or its items. Required when making
	   changes that impact billing.

	   For automatically-collected subscriptions, responses may take longer than usual if a proration billing mode that
	   collects for payment immediately is used.
	*/
	ProrationBillingMode *PatchField[ProrationBillingMode] `json:"proration_billing_mode,omitempty"`
	// OnPaymentFailure: How Paddle should handle changes made to a subscription or its items if the payment fails during update. If omitted, defaults to `prevent_change`.
	OnPaymentFailure *PatchField[SubscriptionOnPaymentFailure] `json:"on_payment_failure,omitempty"`
}

PreviewSubscriptionUpdateRequest is given as an input to PreviewSubscriptionUpdate.

type PreviewTransactionCreateRequest added in v0.5.0

type PreviewTransactionCreateRequest struct {
	*TransactionPreviewByAddress
	*TransactionPreviewByIP
	*TransactionPreviewByCustomer
}

PreviewTransactionCreateRequest represents a union request type of the following types:

  • `TransactionPreviewByAddress`
  • `TransactionPreviewByIP`
  • `TransactionPreviewByCustomer`

The following constructor functions can be used to create a new instance of this type.

  • `NewPreviewTransactionCreateRequestTransactionPreviewByAddress()`
  • `NewPreviewTransactionCreateRequestTransactionPreviewByIP()`
  • `NewPreviewTransactionCreateRequestTransactionPreviewByCustomer()`

Only one of the values can be set at a time, the first non-nil value will be used in the request.

func NewPreviewTransactionCreateRequestTransactionPreviewByAddress added in v0.5.0

func NewPreviewTransactionCreateRequestTransactionPreviewByAddress(r *TransactionPreviewByAddress) *PreviewTransactionCreateRequest

NewPreviewTransactionCreateRequestTransactionPreviewByAddress takes a TransactionPreviewByAddress type and creates a PreviewTransactionCreateRequest for use in a request.

func NewPreviewTransactionCreateRequestTransactionPreviewByCustomer added in v0.5.0

func NewPreviewTransactionCreateRequestTransactionPreviewByCustomer(r *TransactionPreviewByCustomer) *PreviewTransactionCreateRequest

NewPreviewTransactionCreateRequestTransactionPreviewByCustomer takes a TransactionPreviewByCustomer type and creates a PreviewTransactionCreateRequest for use in a request.

func NewPreviewTransactionCreateRequestTransactionPreviewByIP added in v0.5.0

func NewPreviewTransactionCreateRequestTransactionPreviewByIP(r *TransactionPreviewByIP) *PreviewTransactionCreateRequest

NewPreviewTransactionCreateRequestTransactionPreviewByIP takes a TransactionPreviewByIP type and creates a PreviewTransactionCreateRequest for use in a request.

func (PreviewTransactionCreateRequest) MarshalJSON added in v0.5.0

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

MarshalJSON implements the json.Marshaler interface.

type Price

type Price struct {
	// ID: Unique Paddle ID for this price, prefixed with `pri_`.
	ID string `json:"id,omitempty"`
	// ProductID: Paddle ID for the product that this price is for, prefixed with `pro_`.
	ProductID string `json:"product_id,omitempty"`
	// Description: Internal description for this price, not shown to customers. Typically notes for your team.
	Description string `json:"description,omitempty"`
	// Type: Type of item. Standard items are considered part of your catalog and are shown on the Paddle web app.
	Type CatalogType `json:"type,omitempty"`
	// Name: Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
	Name *string `json:"name,omitempty"`
	// BillingCycle: How often this price should be charged. `null` if price is non-recurring (one-time).
	BillingCycle *Duration `json:"billing_cycle,omitempty"`
	// TrialPeriod: Trial period for the product related to this price. The billing cycle begins once the trial period is over. `null` for no trial period. Requires `billing_cycle`.
	TrialPeriod *Duration `json:"trial_period,omitempty"`
	// TaxMode: How tax is calculated for this price.
	TaxMode TaxMode `json:"tax_mode,omitempty"`
	// UnitPrice: Base price. This price applies to all customers, except for customers located in countries where you have `unit_price_overrides`.
	UnitPrice Money `json:"unit_price,omitempty"`
	// UnitPriceOverrides: List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
	UnitPriceOverrides []UnitPriceOverride `json:"unit_price_overrides,omitempty"`
	// Quantity: Limits on how many times the related product can be purchased at this price. Useful for discount campaigns.
	Quantity PriceQuantity `json:"quantity,omitempty"`
	// Status: Whether this entity can be used in Paddle.
	Status Status `json:"status,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
	// ImportMeta: Import information for this entity. `null` if this entity is not imported.
	ImportMeta *ImportMeta `json:"import_meta,omitempty"`
	// CreatedAt: RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
	CreatedAt string `json:"created_at,omitempty"`
	// UpdatedAt: RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
	UpdatedAt string `json:"updated_at,omitempty"`
	// Product: Related product for this price. Returned when the `include` parameter is used with the `product` value.
	Product Product `json:"product,omitempty"`
}

Price: Represents a price entity with included entities.

type PriceCreatedEvent added in v0.2.1

type PriceCreatedEvent struct {
	GenericEvent
	Data paddlenotification.PriceNotification `json:"data"`
}

PriceCreatedEvent represents an Event implementation for price.created event.

type PriceImportedEvent added in v0.2.1

type PriceImportedEvent struct {
	GenericEvent
	Data paddlenotification.PriceNotification `json:"data"`
}

PriceImportedEvent represents an Event implementation for price.imported event.

type PricePreview

type PricePreview struct {
	// CustomerID: Paddle ID of the customer that this preview is for, prefixed with `ctm_`.
	CustomerID *string `json:"customer_id,omitempty"`
	// AddressID: Paddle ID of the address that this preview is for, prefixed with `add_`. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
	AddressID *string `json:"address_id,omitempty"`
	// BusinessID: Paddle ID of the business that this preview is for, prefixed with `biz_`.
	BusinessID *string `json:"business_id,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
	// DiscountID: Paddle ID of the discount applied to this preview, prefixed with `dsc_`.
	DiscountID *string `json:"discount_id,omitempty"`
	// Address: Address for this preview. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
	Address *AddressPreview `json:"address,omitempty"`
	// CustomerIPAddress: IP address for this transaction preview. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
	CustomerIPAddress *string `json:"customer_ip_address,omitempty"`
	// Items: List of items to preview price calculations for.
	Items []PricePreviewItem `json:"items,omitempty"`
	// Details: Calculated totals for a price preview, including discounts, tax, and currency conversion.
	Details PricePreviewDetails `json:"details,omitempty"`
	// AvailablePaymentMethods: List of available payment methods for Paddle Checkout given the price and location information passed.
	AvailablePaymentMethods []PaymentMethodType `json:"available_payment_methods,omitempty"`
}

type PricePreviewDetails

type PricePreviewDetails struct {
	// LineItems: Information about line items for this preview. Includes totals calculated by Paddle. Considered the source of truth for line item totals.
	LineItems []PricePreviewLineItem `json:"line_items,omitempty"`
}

PricePreviewDetails: Calculated totals for a price preview, including discounts, tax, and currency conversion.

type PricePreviewDiscounts

type PricePreviewDiscounts struct {
	// Discount: Related discount entity for this preview line item.
	Discount Discount `json:"discount,omitempty"`
	// Total: Total amount discounted as a result of this discount.
	Total string `json:"total,omitempty"`
	// FormattedTotal: Total amount discounted as a result of this discount in the format of a given currency. '
	FormattedTotal string `json:"formatted_total,omitempty"`
}

PricePreviewDiscounts: Array of discounts applied to this preview line item. Empty if no discounts applied.

type PricePreviewItem

type PricePreviewItem struct {
	// PriceID: Paddle ID for the price to add to this transaction, prefixed with `pri_`.
	PriceID string `json:"price_id,omitempty"`
	// Quantity: Quantity of the item to preview.
	Quantity int `json:"quantity,omitempty"`
}

PricePreviewItem: List of items to preview price calculations for.

type PricePreviewLineItem

type PricePreviewLineItem struct {
	// Price: Related price entity for this preview line item.
	Price Price `json:"price,omitempty"`
	// Quantity: Quantity of this preview line item.
	Quantity int `json:"quantity,omitempty"`
	// TaxRate: Rate used to calculate tax for this preview line item.
	TaxRate string `json:"tax_rate,omitempty"`
	// UnitTotals: Breakdown of the charge for one unit in the lowest denomination of a currency (e.g. cents for USD).
	UnitTotals Totals `json:"unit_totals,omitempty"`
	// FormattedUnitTotals: Breakdown of the charge for one unit in the format of a given currency.
	FormattedUnitTotals Totals `json:"formatted_unit_totals,omitempty"`
	// Totals: Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
	Totals Totals `json:"totals,omitempty"`
	// FormattedTotals: The financial breakdown of a charge in the format of a given currency.
	FormattedTotals Totals `json:"formatted_totals,omitempty"`
	// Product: Related product entity for this preview line item price.
	Product Product `json:"product,omitempty"`
	// Discounts: Array of discounts applied to this preview line item. Empty if no discounts applied.
	Discounts []PricePreviewDiscounts `json:"discounts,omitempty"`
}

PricePreviewLineItem: Information about line items for this preview. Includes totals calculated by Paddle. Considered the source of truth for line item totals.

type PricePreviewRequest

type PricePreviewRequest struct {
	// Items: List of items to preview price calculations for.
	Items []PricePreviewItem `json:"items,omitempty"`
	// CustomerID: Paddle ID of the customer that this preview is for, prefixed with `ctm_`.
	CustomerID *string `json:"customer_id,omitempty"`
	// AddressID: Paddle ID of the address that this preview is for, prefixed with `add_`. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
	AddressID *string `json:"address_id,omitempty"`
	// BusinessID: Paddle ID of the business that this preview is for, prefixed with `biz_`.
	BusinessID *string `json:"business_id,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code.
	CurrencyCode *CurrencyCode `json:"currency_code,omitempty"`
	// DiscountID: Paddle ID of the discount applied to this preview, prefixed with `dsc_`.
	DiscountID *string `json:"discount_id,omitempty"`
	// Address: Address for this preview. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
	Address *AddressPreview `json:"address,omitempty"`
	// CustomerIPAddress: IP address for this transaction preview. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
	CustomerIPAddress *string `json:"customer_ip_address,omitempty"`
}

PricePreviewRequest is given as an input to PricePreview.

type PriceQuantity

type PriceQuantity struct {
	// Minimum: Minimum quantity of the product related to this price that can be bought. Required if `maximum` set.
	Minimum int `json:"minimum,omitempty"`
	// Maximum: Maximum quantity of the product related to this price that can be bought. Required if `minimum` set. Must be greater than or equal to the `minimum` value.
	Maximum int `json:"maximum,omitempty"`
}

PriceQuantity: Limits on how many times the related product can be purchased at this price. Useful for discount campaigns.

type PriceUpdatedEvent added in v0.2.1

type PriceUpdatedEvent struct {
	GenericEvent
	Data paddlenotification.PriceNotification `json:"data"`
}

PriceUpdatedEvent represents an Event implementation for price.updated event.

type PricesClient

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

PricesClient is a client for the Prices resource.

func (*PricesClient) CreatePrice

func (c *PricesClient) CreatePrice(ctx context.Context, req *CreatePriceRequest) (res *Price, err error)

CreatePrice performs the POST operation on a Prices resource.

func (*PricesClient) GetPrice

func (c *PricesClient) GetPrice(ctx context.Context, req *GetPriceRequest) (res *Price, err error)

GetPrice performs the GET operation on a Prices resource.

func (*PricesClient) ListPrices

func (c *PricesClient) ListPrices(ctx context.Context, req *ListPricesRequest) (res *Collection[*Price], err error)

ListPrices performs the GET operation on a Prices resource.

func (*PricesClient) UpdatePrice

func (c *PricesClient) UpdatePrice(ctx context.Context, req *UpdatePriceRequest) (res *Price, err error)

UpdatePrice performs the PATCH operation on a Prices resource.

type PricingPreviewClient

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

PricingPreviewClient is a client for the Pricing preview resource.

func (*PricingPreviewClient) PricePreview

func (c *PricingPreviewClient) PricePreview(ctx context.Context, req *PricePreviewRequest) (res *PricePreview, err error)

PricePreview performs the POST operation on a Pricing preview resource.

type Product

type Product struct {
	// ID: Unique Paddle ID for this product, prefixed with `pro_`.
	ID string `json:"id,omitempty"`
	// Name: Name of this product.
	Name string `json:"name,omitempty"`
	// Description: Short description for this product.
	Description *string `json:"description,omitempty"`
	// Type: Type of item. Standard items are considered part of your catalog and are shown on the Paddle web app.
	Type CatalogType `json:"type,omitempty"`
	// TaxCategory: Tax category for this product. Used for charging the correct rate of tax. Selected tax category must be enabled on your Paddle account.
	TaxCategory TaxCategory `json:"tax_category,omitempty"`
	// ImageURL: Image for this product. Included in the checkout and on some customer documents.
	ImageURL *string `json:"image_url,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
	// Status: Whether this entity can be used in Paddle.
	Status Status `json:"status,omitempty"`
	// ImportMeta: Import information for this entity. `null` if this entity is not imported.
	ImportMeta *ImportMeta `json:"import_meta,omitempty"`
	// CreatedAt: RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
	CreatedAt string `json:"created_at,omitempty"`
	// UpdatedAt: RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
	UpdatedAt string `json:"updated_at,omitempty"`
	// Prices: Represents a price entity.
	Prices []Price `json:"prices,omitempty"`
}

Product: Represents a product entity with included entities.

type ProductCreatedEvent added in v0.2.1

type ProductCreatedEvent struct {
	GenericEvent
	Data paddlenotification.ProductNotification `json:"data"`
}

ProductCreatedEvent represents an Event implementation for product.created event.

type ProductImportedEvent added in v0.2.1

type ProductImportedEvent struct {
	GenericEvent
	Data paddlenotification.ProductNotification `json:"data"`
}

ProductImportedEvent represents an Event implementation for product.imported event.

type ProductPricesReportFilterName added in v0.7.0

type ProductPricesReportFilterName string

ProductPricesReportFilterName: Field name to filter by..

const (
	ProductPricesReportFilterNameProductStatus    ProductPricesReportFilterName = "product_status"
	ProductPricesReportFilterNamePriceStatus      ProductPricesReportFilterName = "price_status"
	ProductPricesReportFilterNameProductType      ProductPricesReportFilterName = "product_type"
	ProductPricesReportFilterNamePriceType        ProductPricesReportFilterName = "price_type"
	ProductPricesReportFilterNameProductUpdatedAt ProductPricesReportFilterName = "product_updated_at"
	ProductPricesReportFilterNamePriceUpdatedAt   ProductPricesReportFilterName = "price_updated_at"
)

type ProductPricesReportFilters added in v0.7.0

type ProductPricesReportFilters struct {
	// Name: Field name to filter by.
	Name ProductPricesReportFilterName `json:"name,omitempty"`
	// Operator: Operator to use when filtering. Valid when filtering by `updated_at`, `null` otherwise.
	Operator *FilterOperator `json:"operator,omitempty"`
	// Value: Value to filter by.
	Value any `json:"value,omitempty"`
}

ProductPricesReportFilters: Filter criteria for this report. If omitted when creating, reports are filtered to include data updated in the last 30 days. This means `product_updated_at` and `price_updated_at` are greater than or equal to (`gte`) the date 30 days ago from the time the report was generated.

type ProductUpdatedEvent added in v0.2.1

type ProductUpdatedEvent struct {
	GenericEvent
	Data paddlenotification.ProductNotification `json:"data"`
}

ProductUpdatedEvent represents an Event implementation for product.updated event.

type ProductsAndPricesReport

type ProductsAndPricesReport struct {
	// Type: Type of report to create.
	Type ProductsPricesReportType `json:"type,omitempty"`
	// Filters: Filter criteria for this report. If omitted when creating, reports are filtered to include data updated in the last 30 days. This means `product_updated_at` and `price_updated_at` are greater than or equal to (`gte`) the date 30 days ago from the time the report was generated.
	Filters []ProductPricesReportFilters `json:"filters,omitempty"`
}

ProductsAndPricesReport: Entity when working with a products and prices report.

type ProductsClient

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

ProductsClient is a client for the Products resource.

func (*ProductsClient) CreateProduct

func (c *ProductsClient) CreateProduct(ctx context.Context, req *CreateProductRequest) (res *Product, err error)

CreateProduct performs the POST operation on a Products resource.

func (*ProductsClient) GetProduct

func (c *ProductsClient) GetProduct(ctx context.Context, req *GetProductRequest) (res *Product, err error)

GetProduct performs the GET operation on a Products resource.

func (*ProductsClient) ListProducts

func (c *ProductsClient) ListProducts(ctx context.Context, req *ListProductsRequest) (res *Collection[*Product], err error)

ListProducts performs the GET operation on a Products resource.

func (*ProductsClient) UpdateProduct

func (c *ProductsClient) UpdateProduct(ctx context.Context, req *UpdateProductRequest) (res *Product, err error)

UpdateProduct performs the PATCH operation on a Products resource.

type ProductsPricesReportType added in v0.7.0

type ProductsPricesReportType string

ProductsPricesReportType: Type of report to create..

const ProductsPricesReportTypeProductsPrices ProductsPricesReportType = "products_prices"

type Proration

type Proration struct {
	// Rate: Rate used to calculate proration.
	Rate string `json:"rate,omitempty"`
	// BillingPeriod: Billing period that proration is based on.
	BillingPeriod TimePeriod `json:"billing_period,omitempty"`
}

Proration: How proration was calculated for this item. Populated when a transaction is created from a subscription change, where `proration_billing_mode` was `prorated_immediately` or `prorated_next_billing_period`. Set automatically by Paddle.

type ProrationBillingMode

type ProrationBillingMode string

ProrationBillingMode: How Paddle should handle proration calculation for changes made to a subscription or its items. Required when making changes that impact billing.

For automatically-collected subscriptions, responses may take longer than usual if a proration billing mode that collects for payment immediately is used..

const (
	ProrationBillingModeProratedImmediately       ProrationBillingMode = "prorated_immediately"
	ProrationBillingModeProratedNextBillingPeriod ProrationBillingMode = "prorated_next_billing_period"
	ProrationBillingModeFullImmediately           ProrationBillingMode = "full_immediately"
	ProrationBillingModeFullNextBillingPeriod     ProrationBillingMode = "full_next_billing_period"
	ProrationBillingModeDoNotBill                 ProrationBillingMode = "do_not_bill"
)

type ReplayNotificationRequest

type ReplayNotificationRequest struct {
	// URL path parameters.
	NotificationID string `in:"path=notification_id" json:"-"`
}

ReplayNotificationRequest is given as an input to ReplayNotification.

type Report

type Report struct {
	// ID: Unique Paddle ID for this report, prefixed with `rep_`
	ID string `json:"id,omitempty"`
	/*
	   Status: Status of this report. Set automatically by Paddle.

	   Reports are created as `pending` initially, then move to `ready` when they're available to download.
	*/
	Status ReportStatus `json:"status,omitempty"`
	// Rows: Number of records in this report. `null` if the report is `pending`.
	Rows *int `json:"rows,omitempty"`
	// ExpiresAt: RFC 3339 datetime string of when this report expires. The report is no longer available to download after this date.
	ExpiresAt *string `json:"expires_at,omitempty"`
	// UpdatedAt: RFC 3339 datetime string of when this report was last updated.
	UpdatedAt string `json:"updated_at,omitempty"`
	// CreatedAt: RFC 3339 datetime string of when this report was created.
	CreatedAt string `json:"created_at,omitempty"`
	// Type: Type of report to create.
	Type ReportType `json:"type,omitempty"`
	// Filters: Filter criteria for this report. If omitted when creating, reports are filtered to include data updated in the last 30 days. This means `updated_at` is greater than or equal to (`gte`) the date 30 days ago from the time the report was generated.
	Filters []ReportFilters `json:"filters,omitempty"`
}

Report: Represents a report entity.

type ReportCSV

type ReportCSV struct {
	// URL: URL of the requested resource.
	URL string `json:"url,omitempty"`
}

type ReportCreatedEvent added in v0.2.1

type ReportCreatedEvent struct {
	GenericEvent
	Data paddlenotification.ReportNotification `json:"data"`
}

ReportCreatedEvent represents an Event implementation for report.created event.

type ReportFilters

type ReportFilters struct {
	// Name: Field name to filter by.
	Name ReportFiltersName `json:"name,omitempty"`
	// Operator: Operator to use when filtering. Valid when filtering by `updated_at`, `null` otherwise.
	Operator *ReportFiltersOperator `json:"operator,omitempty"`
	// Value: Value to filter by. Check the allowed values descriptions for the `name` field to see valid values for a field.
	Value any `json:"value,omitempty"`
}

ReportFilters: Filter criteria for this report. If omitted when creating, reports are filtered to include data updated in the last 30 days. This means `updated_at` is greater than or equal to (`gte`) the date 30 days ago from the time the report was generated.

type ReportFiltersName added in v0.7.0

type ReportFiltersName string

ReportFiltersName: Field name to filter by..

const (
	ReportFiltersNameAction           ReportFiltersName = "action"
	ReportFiltersNameCurrencyCode     ReportFiltersName = "currency_code"
	ReportFiltersNameStatus           ReportFiltersName = "status"
	ReportFiltersNameUpdatedAt        ReportFiltersName = "updated_at"
	ReportFiltersNameCollectionMode   ReportFiltersName = "collection_mode"
	ReportFiltersNameOrigin           ReportFiltersName = "origin"
	ReportFiltersNameProductStatus    ReportFiltersName = "product_status"
	ReportFiltersNamePriceStatus      ReportFiltersName = "price_status"
	ReportFiltersNameProductType      ReportFiltersName = "product_type"
	ReportFiltersNamePriceType        ReportFiltersName = "price_type"
	ReportFiltersNameProductUpdatedAt ReportFiltersName = "product_updated_at"
	ReportFiltersNamePriceUpdatedAt   ReportFiltersName = "price_updated_at"
	ReportFiltersNameType             ReportFiltersName = "type"
)

type ReportFiltersOperator added in v0.7.0

type ReportFiltersOperator string

ReportFiltersOperator: Operator to use when filtering. Valid when filtering by `updated_at`, `null` otherwise..

const (
	ReportFiltersOperatorLt  ReportFiltersOperator = "lt"
	ReportFiltersOperatorGte ReportFiltersOperator = "gte"
)

type ReportStatus

type ReportStatus string

ReportStatus: Status of this report. Set automatically by Paddle.

Reports are created as `pending` initially, then move to `ready` when they're available to download..

const (
	ReportStatusPending ReportStatus = "pending"
	ReportStatusReady   ReportStatus = "ready"
	ReportStatusFailed  ReportStatus = "failed"
	ReportStatusExpired ReportStatus = "expired"
)

type ReportType added in v0.7.0

type ReportType string

ReportType: Type of report to create..

const (
	ReportTypeAdjustments          ReportType = "adjustments"
	ReportTypeAdjustmentLineItems  ReportType = "adjustment_line_items"
	ReportTypeTransactions         ReportType = "transactions"
	ReportTypeTransactionLineItems ReportType = "transaction_line_items"
	ReportTypeProductsPrices       ReportType = "products_prices"
	ReportTypeDiscounts            ReportType = "discounts"
)

type ReportUpdatedEvent added in v0.2.1

type ReportUpdatedEvent struct {
	GenericEvent
	Data paddlenotification.ReportNotification `json:"data"`
}

ReportUpdatedEvent represents an Event implementation for report.updated event.

type ReportsClient

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

ReportsClient is a client for the Reports resource.

func (*ReportsClient) CreateReport

func (c *ReportsClient) CreateReport(ctx context.Context, req *CreateReportRequest) (res *Report, err error)

CreateReport performs the POST operation on a Reports resource.

func (*ReportsClient) GetReport

func (c *ReportsClient) GetReport(ctx context.Context, req *GetReportRequest) (res *Report, err error)

GetReport performs the GET operation on a Reports resource.

func (*ReportsClient) GetReportCSV

func (c *ReportsClient) GetReportCSV(ctx context.Context, req *GetReportCSVRequest) (res *ReportCSV, err error)

GetReportCSV performs the GET operation on a Reports resource.

func (*ReportsClient) ListReports

func (c *ReportsClient) ListReports(ctx context.Context, req *ListReportsRequest) (res *Collection[*Report], err error)

ListReports performs the GET operation on a Reports resource.

type Res

type Res[T any] struct {
	// contains filtered or unexported fields
}

Res is a single result returned from an iteration of a collection.

func (*Res[T]) Err

func (r *Res[T]) Err() error

Err returns the error from the result, if it exists. This should be checked on each iteration.

func (*Res[T]) Ok

func (r *Res[T]) Ok() bool

Ok returns true if the result is not an error and not the end of the collection.

func (*Res[T]) Value

func (r *Res[T]) Value() T

Value returns the value contained from the result.

type ResumeImmediately

type ResumeImmediately struct {
	/*
	   EffectiveFrom: When this subscription change should take effect from. You can pass `immediately` to resume immediately.

	   Valid where subscriptions have the status of `paused`.

	   Defaults to `immediately` if omitted.
	*/
	EffectiveFrom *EffectiveFrom `json:"effective_from,omitempty"`
}

type ResumeOnASpecificDate

type ResumeOnASpecificDate struct {
	/*
	   EffectiveFrom: When this scheduled change should take effect from. RFC 3339 datetime string of when the subscription should resume.

	   Valid where subscriptions are `active` with a scheduled change to pause, or where they have the status of `paused`.
	*/
	EffectiveFrom string `json:"effective_from,omitempty"`
}

type ResumeSubscriptionRequest

type ResumeSubscriptionRequest struct {
	// URL path parameters.
	SubscriptionID string `in:"path=subscription_id" json:"-"`

	*ResumeOnASpecificDate
	*ResumeImmediately
}

ResumeSubscriptionRequest represents a union request type of the following types:

  • `ResumeOnASpecificDate`
  • `ResumeImmediately`

The following constructor functions can be used to create a new instance of this type.

  • `NewResumeSubscriptionRequestResumeOnASpecificDate()`
  • `NewResumeSubscriptionRequestResumeImmediately()`

Only one of the values can be set at a time, the first non-nil value will be used in the request.

func NewResumeSubscriptionRequestResumeImmediately

func NewResumeSubscriptionRequestResumeImmediately(r *ResumeImmediately) *ResumeSubscriptionRequest

NewResumeSubscriptionRequestResumeImmediately takes a ResumeImmediately type and creates a ResumeSubscriptionRequest for use in a request.

func NewResumeSubscriptionRequestResumeOnASpecificDate

func NewResumeSubscriptionRequestResumeOnASpecificDate(r *ResumeOnASpecificDate) *ResumeSubscriptionRequest

NewResumeSubscriptionRequestResumeOnASpecificDate takes a ResumeOnASpecificDate type and creates a ResumeSubscriptionRequest for use in a request.

func (ResumeSubscriptionRequest) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface.

type SDK

SDK contains all sub-clients for the Paddle API.

func New

func New(apiKey string, opts ...Option) (*SDK, error)

New creates a new Paddle SDK with the given API key.

func NewSandbox

func NewSandbox(apiKey string, opts ...Option) (*SDK, error)

NewSandbox creates a new Paddle SDK with the given API key, using the sandbox environment.

type ScheduledChangeAction

type ScheduledChangeAction string

ScheduledChangeAction: Kind of change that's scheduled to be applied to this subscription..

const (
	ScheduledChangeActionCancel ScheduledChangeAction = "cancel"
	ScheduledChangeActionPause  ScheduledChangeAction = "pause"
	ScheduledChangeActionResume ScheduledChangeAction = "resume"
)

type Status

type Status string

Status: Whether this entity can be used in Paddle..

const (
	StatusActive   Status = "active"
	StatusArchived Status = "archived"
)

type Subscription

type Subscription struct {
	// ID: Unique Paddle ID for this subscription entity, prefixed with `sub_`.
	ID string `json:"id,omitempty"`
	// Status: Status of this subscription. Set automatically by Paddle. Use the pause subscription or cancel subscription operations to change.
	Status SubscriptionStatus `json:"status,omitempty"`
	// CustomerID: Paddle ID of the customer that this subscription is for, prefixed with `ctm_`.
	CustomerID string `json:"customer_id,omitempty"`
	// AddressID: Paddle ID of the address that this subscription is for, prefixed with `add_`.
	AddressID string `json:"address_id,omitempty"`
	// BusinessID: Paddle ID of the business that this subscription is for, prefixed with `biz_`.
	BusinessID *string `json:"business_id,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code. Transactions for this subscription are created in this currency. Must be `USD`, `EUR`, or `GBP` if `collection_mode` is `manual`.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
	// CreatedAt: RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
	CreatedAt string `json:"created_at,omitempty"`
	// UpdatedAt: RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
	UpdatedAt string `json:"updated_at,omitempty"`
	// StartedAt: RFC 3339 datetime string of when this subscription started. This may be different from `first_billed_at` if the subscription started in trial.
	StartedAt *string `json:"started_at,omitempty"`
	// FirstBilledAt: RFC 3339 datetime string of when this subscription was first billed. This may be different from `started_at` if the subscription started in trial.
	FirstBilledAt *string `json:"first_billed_at,omitempty"`
	// NextBilledAt: RFC 3339 datetime string of when this subscription is next scheduled to be billed.
	NextBilledAt *string `json:"next_billed_at,omitempty"`
	// PausedAt: RFC 3339 datetime string of when this subscription was paused. Set automatically by Paddle when the pause subscription operation is used. `null` if not paused.
	PausedAt *string `json:"paused_at,omitempty"`
	// CanceledAt: RFC 3339 datetime string of when this subscription was canceled. Set automatically by Paddle when the cancel subscription operation is used. `null` if not canceled.
	CanceledAt *string `json:"canceled_at,omitempty"`
	// Discount: Details of the discount applied to this subscription.
	Discount *SubscriptionDiscountTimePeriod `json:"discount,omitempty"`
	// CollectionMode: How payment is collected for transactions created for this subscription. `automatic` for checkout, `manual` for invoices.
	CollectionMode CollectionMode `json:"collection_mode,omitempty"`
	// BillingDetails: Details for invoicing. Required if `collection_mode` is `manual`.
	BillingDetails *BillingDetails `json:"billing_details,omitempty"`
	// CurrentBillingPeriod: Current billing period for this subscription. Set automatically by Paddle based on the billing cycle. `null` for `paused` and `canceled` subscriptions.
	CurrentBillingPeriod *TimePeriod `json:"current_billing_period,omitempty"`
	// BillingCycle: How often this subscription renews. Set automatically by Paddle based on the prices on this subscription.
	BillingCycle Duration `json:"billing_cycle,omitempty"`
	// ScheduledChange: Change that's scheduled to be applied to a subscription. Use the pause subscription, cancel subscription, and resume subscription operations to create scheduled changes. `null` if no scheduled changes.
	ScheduledChange *SubscriptionScheduledChange `json:"scheduled_change,omitempty"`
	// ManagementURLs: Public URLs that customers can use to make changes to this subscription. For security, the `token` appended to each link is temporary. You shouldn't store these links.
	ManagementURLs SubscriptionManagementUrLs `json:"management_urls,omitempty"`
	// Items: Represents a subscription item.
	Items []SubscriptionItem `json:"items,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
	// ImportMeta: Import information for this entity. `null` if this entity is not imported.
	ImportMeta *ImportMeta `json:"import_meta,omitempty"`
	// NextTransaction: Preview of the next transaction for this subscription. May include prorated charges that are not yet billed and one-time charges. Returned when the `include` parameter is used with the `next_transaction` value. `null` if the subscription is scheduled to cancel or pause.
	NextTransaction *NextTransaction `json:"next_transaction,omitempty"`
	// RecurringTransactionDetails: Preview of the recurring transaction for this subscription. This is what the customer can expect to be billed when there are no prorated or one-time charges. Returned when the `include` parameter is used with the `recurring_transaction_details` value.
	RecurringTransactionDetails SubscriptionTransactionDetailsPreview `json:"recurring_transaction_details,omitempty"`
}

Subscription: Represents a subscription entity with included entities.

type SubscriptionActivatedEvent added in v0.2.1

type SubscriptionActivatedEvent struct {
	GenericEvent
	Data paddlenotification.SubscriptionNotification `json:"data"`
}

SubscriptionActivatedEvent represents an Event implementation for subscription.activated event.

type SubscriptionAdjustmentItem added in v0.7.0

type SubscriptionAdjustmentItem struct {
	// ItemID: Paddle ID for the transaction item that this adjustment item relates to, prefixed with `txnitm_`.
	ItemID string `json:"item_id,omitempty"`
	/*
	   Type: Type of adjustment for this transaction item. `tax` adjustments are automatically created by Paddle.
	   Include `amount` when creating a `partial` adjustment.
	*/
	Type AdjustmentType `json:"type,omitempty"`
	// Amount: Amount adjusted for this transaction item. Required when adjustment type is `partial`.
	Amount *string `json:"amount,omitempty"`
	// Proration: How proration was calculated for this adjustment item.
	Proration *Proration `json:"proration,omitempty"`
	// Totals: Breakdown of the total for an adjustment item.
	Totals AdjustmentItemTotals `json:"totals,omitempty"`
}

SubscriptionAdjustmentItem: List of transaction items that this adjustment is for.

type SubscriptionCanceledEvent added in v0.2.1

type SubscriptionCanceledEvent struct {
	GenericEvent
	Data paddlenotification.SubscriptionNotification `json:"data"`
}

SubscriptionCanceledEvent represents an Event implementation for subscription.canceled event.

type SubscriptionCatalogItem added in v0.7.0

type SubscriptionCatalogItem struct {
	// Quantity: Quantity to bill for.
	Quantity int `json:"quantity,omitempty"`
	// PriceID: Paddle ID of an an existing catalog price to bill for.
	PriceID string `json:"price_id,omitempty"`
}

SubscriptionCatalogItem: Add a catalog item to a subscription. In this case, the product and price that you're billing for exist in your product catalog in Paddle.

type SubscriptionChargeCreateWithPrice added in v0.4.0

type SubscriptionChargeCreateWithPrice struct {
	// ProductID: Paddle ID for the product that this price is for, prefixed with `pro_`.
	ProductID string `json:"product_id,omitempty"`
	// Description: Internal description for this price, not shown to customers. Typically notes for your team.
	Description string `json:"description,omitempty"`
	// Name: Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
	Name *string `json:"name,omitempty"`
	// TaxMode: How tax is calculated for this price.
	TaxMode TaxMode `json:"tax_mode,omitempty"`
	// UnitPrice: Base price. This price applies to all customers, except for customers located in countries where you have `unit_price_overrides`.
	UnitPrice Money `json:"unit_price,omitempty"`
	// UnitPriceOverrides: List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
	UnitPriceOverrides []UnitPriceOverride `json:"unit_price_overrides,omitempty"`
	// Quantity: Limits on how many times the related product can be purchased at this price. Useful for discount campaigns. If omitted, defaults to 1-100.
	Quantity PriceQuantity `json:"quantity,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
}

SubscriptionChargeCreateWithPrice: Price object for a non-catalog item to bill for. Include a `product_id` to relate this non-catalog price to an existing catalog price.

type SubscriptionChargeCreateWithProduct added in v0.4.0

type SubscriptionChargeCreateWithProduct struct {
	// Description: Internal description for this price, not shown to customers. Typically notes for your team.
	Description string `json:"description,omitempty"`
	// Name: Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
	Name *string `json:"name,omitempty"`
	// TaxMode: How tax is calculated for this price.
	TaxMode TaxMode `json:"tax_mode,omitempty"`
	// UnitPrice: Base price. This price applies to all customers, except for customers located in countries where you have `unit_price_overrides`.
	UnitPrice Money `json:"unit_price,omitempty"`
	// UnitPriceOverrides: List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
	UnitPriceOverrides []UnitPriceOverride `json:"unit_price_overrides,omitempty"`
	// Quantity: Limits on how many times the related product can be purchased at this price. Useful for discount campaigns. If omitted, defaults to 1-100.
	Quantity PriceQuantity `json:"quantity,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
	// Product: Product object for a non-catalog item to charge for.
	Product TransactionSubscriptionProductCreate `json:"product,omitempty"`
}

SubscriptionChargeCreateWithProduct: Price object for a non-catalog item to charge for. Include a `product` object to create a non-catalog product for this non-catalog price.

type SubscriptionCreatedEvent added in v0.2.1

type SubscriptionCreatedEvent struct {
	GenericEvent
	Data paddlenotification.SubscriptionCreatedNotification `json:"data"`
}

SubscriptionCreatedEvent represents an Event implementation for subscription.created event.

type SubscriptionDiscountEffectiveFrom added in v0.7.0

type SubscriptionDiscountEffectiveFrom struct {
	// ID: Unique Paddle ID for this discount, prefixed with `dsc_`.
	ID string `json:"id,omitempty"`
	// EffectiveFrom: When this discount should take effect from.
	EffectiveFrom EffectiveFrom `json:"effective_from,omitempty"`
}

SubscriptionDiscountEffectiveFrom: Details of the discount applied to this subscription. Include to add a discount to a subscription. `null` to remove a discount.

type SubscriptionDiscountTimePeriod added in v0.7.0

type SubscriptionDiscountTimePeriod struct {
	// ID: Unique Paddle ID for this discount, prefixed with `dsc_`.
	ID string `json:"id,omitempty"`
	// StartsAt: RFC 3339 datetime string of when this discount was first applied.
	StartsAt string `json:"starts_at,omitempty"`
	// EndsAt: RFC 3339 datetime string of when this discount no longer applies. Where a discount has `maximum_recurring_intervals`, this is the date of the last billing period where this discount applies. `null` where a discount recurs forever.
	EndsAt *string `json:"ends_at,omitempty"`
}

SubscriptionDiscountTimePeriod: Details of the discount applied to this subscription.

type SubscriptionImportedEvent added in v0.2.1

type SubscriptionImportedEvent struct {
	GenericEvent
	Data paddlenotification.SubscriptionNotification `json:"data"`
}

SubscriptionImportedEvent represents an Event implementation for subscription.imported event.

type SubscriptionItem

type SubscriptionItem struct {
	// Status: Status of this subscription item. Set automatically by Paddle.
	Status SubscriptionItemStatus `json:"status,omitempty"`
	// Quantity: Quantity of this item on the subscription.
	Quantity int `json:"quantity,omitempty"`
	// Recurring: Whether this is a recurring item. `false` if one-time.
	Recurring bool `json:"recurring,omitempty"`
	// CreatedAt: RFC 3339 datetime string of when this item was added to this subscription.
	CreatedAt string `json:"created_at,omitempty"`
	// UpdatedAt: RFC 3339 datetime string of when this item was last updated on this subscription.
	UpdatedAt string `json:"updated_at,omitempty"`
	// PreviouslyBilledAt: RFC 3339 datetime string of when this item was last billed.
	PreviouslyBilledAt *string `json:"previously_billed_at,omitempty"`
	// NextBilledAt: RFC 3339 datetime string of when this item is next scheduled to be billed.
	NextBilledAt *string `json:"next_billed_at,omitempty"`
	// TrialDates: Trial dates for this item.
	TrialDates *TimePeriod `json:"trial_dates,omitempty"`
	// Price: Related price entity for this item. This reflects the price entity at the time it was added to the subscription.
	Price Price `json:"price,omitempty"`
	// Product: Related product entity for this item. This reflects the product entity at the time it was added to the subscription.
	Product Product `json:"product,omitempty"`
}

SubscriptionItem: Represents a subscription item.

type SubscriptionItemStatus

type SubscriptionItemStatus string

SubscriptionItemStatus: Status of this subscription item. Set automatically by Paddle..

const (
	SubscriptionItemStatusActive   SubscriptionItemStatus = "active"
	SubscriptionItemStatusInactive SubscriptionItemStatus = "inactive"
	SubscriptionItemStatusTrialing SubscriptionItemStatus = "trialing"
)

type SubscriptionManagementUrLs

type SubscriptionManagementUrLs struct {
	// UpdatePaymentMethod: Public URL that lets customers update the payment method for this subscription. Creates or gets a transaction that can be used to update a payment method, then passes it to your default checkout page.
	UpdatePaymentMethod *string `json:"update_payment_method,omitempty"`
	// Cancel: Public URL that lets customers cancel this subscription. Takes customers to a Paddle page that lets them cancel their subscription.
	Cancel string `json:"cancel,omitempty"`
}

SubscriptionManagementUrLs: Public URLs that customers can use to make changes to this subscription. For security, the `token` appended to each link is temporary. You shouldn't store these links.

type SubscriptionNonCatalogPriceAndProduct added in v0.7.0

type SubscriptionNonCatalogPriceAndProduct struct {
	// Quantity: Quantity to bill for.
	Quantity int `json:"quantity,omitempty"`
	// Price: Price object for a non-catalog item to charge for. Include a `product` object to create a non-catalog product for this non-catalog price.
	Price SubscriptionChargeCreateWithProduct `json:"price,omitempty"`
}

SubscriptionNonCatalogPriceAndProduct: Add a non-catalog price for a non-catalog product in your catalog to a subscription. In this case, the product and price that you're billing for are specific to this transaction.

type SubscriptionNonCatalogPriceForAnExistingProduct added in v0.7.0

type SubscriptionNonCatalogPriceForAnExistingProduct struct {
	// Quantity: Quantity to bill for.
	Quantity int `json:"quantity,omitempty"`
	// Price: Price object for a non-catalog item to bill for. Include a `product_id` to relate this non-catalog price to an existing catalog price.
	Price SubscriptionChargeCreateWithPrice `json:"price,omitempty"`
}

SubscriptionNonCatalogPriceForAnExistingProduct: Add a non-catalog price for an existing product in your catalog to a subscription. In this case, the product you're billing for is a catalog product, but you charge a specific price for it.

type SubscriptionOnPaymentFailure

type SubscriptionOnPaymentFailure string

SubscriptionOnPaymentFailure: How Paddle should handle changes made to a subscription or its items if the payment fails during update. If omitted, defaults to `prevent_change`..

const (
	SubscriptionOnPaymentFailurePreventChange SubscriptionOnPaymentFailure = "prevent_change"
	SubscriptionOnPaymentFailureApplyChange   SubscriptionOnPaymentFailure = "apply_change"
)

type SubscriptionPastDueEvent added in v0.2.1

type SubscriptionPastDueEvent struct {
	GenericEvent
	Data paddlenotification.SubscriptionNotification `json:"data"`
}

SubscriptionPastDueEvent represents an Event implementation for subscription.past_due event.

type SubscriptionPausedEvent added in v0.2.1

type SubscriptionPausedEvent struct {
	GenericEvent
	Data paddlenotification.SubscriptionNotification `json:"data"`
}

SubscriptionPausedEvent represents an Event implementation for subscription.paused event.

type SubscriptionPreview

type SubscriptionPreview struct {
	// Status: Status of this subscription. Set automatically by Paddle. Use the pause subscription or cancel subscription operations to change.
	Status SubscriptionStatus `json:"status,omitempty"`
	// CustomerID: Paddle ID of the customer that this subscription is for, prefixed with `ctm_`.
	CustomerID string `json:"customer_id,omitempty"`
	// AddressID: Paddle ID of the address that this subscription is for, prefixed with `add_`.
	AddressID string `json:"address_id,omitempty"`
	// BusinessID: Paddle ID of the business that this subscription is for, prefixed with `biz_`.
	BusinessID *string `json:"business_id,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code. Transactions for this subscription are created in this currency. Must be `USD`, `EUR`, or `GBP` if `collection_mode` is `manual`.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
	// CreatedAt: RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
	CreatedAt string `json:"created_at,omitempty"`
	// UpdatedAt: RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
	UpdatedAt string `json:"updated_at,omitempty"`
	// StartedAt: RFC 3339 datetime string of when this subscription started. This may be different from `first_billed_at` if the subscription started in trial.
	StartedAt *string `json:"started_at,omitempty"`
	// FirstBilledAt: RFC 3339 datetime string of when this subscription was first billed. This may be different from `started_at` if the subscription started in trial.
	FirstBilledAt *string `json:"first_billed_at,omitempty"`
	// NextBilledAt: RFC 3339 datetime string of when this subscription is next scheduled to be billed.
	NextBilledAt *string `json:"next_billed_at,omitempty"`
	// PausedAt: RFC 3339 datetime string of when this subscription was paused. Set automatically by Paddle when the pause subscription operation is used. `null` if not paused.
	PausedAt *string `json:"paused_at,omitempty"`
	// CanceledAt: RFC 3339 datetime string of when this subscription was canceled. Set automatically by Paddle when the cancel subscription operation is used. `null` if not canceled.
	CanceledAt *string `json:"canceled_at,omitempty"`
	// Discount: Details of the discount applied to this subscription.
	Discount *SubscriptionDiscountTimePeriod `json:"discount,omitempty"`
	// CollectionMode: How payment is collected for transactions created for this subscription. `automatic` for checkout, `manual` for invoices.
	CollectionMode CollectionMode `json:"collection_mode,omitempty"`
	// BillingDetails: Details for invoicing. Required if `collection_mode` is `manual`.
	BillingDetails *BillingDetails `json:"billing_details,omitempty"`
	// CurrentBillingPeriod: Current billing period for this subscription. Set automatically by Paddle based on the billing cycle. `null` for `paused` and `canceled` subscriptions.
	CurrentBillingPeriod *TimePeriod `json:"current_billing_period,omitempty"`
	// BillingCycle: How often this subscription renews. Set automatically by Paddle based on the prices on this subscription.
	BillingCycle Duration `json:"billing_cycle,omitempty"`
	// ScheduledChange: Change that's scheduled to be applied to a subscription. Use the pause subscription, cancel subscription, and resume subscription operations to create scheduled changes. `null` if no scheduled changes.
	ScheduledChange *SubscriptionScheduledChange `json:"scheduled_change,omitempty"`
	// ManagementURLs: Public URLs that customers can use to make changes to this subscription. For security, the `token` appended to each link is temporary. You shouldn't store these links.
	ManagementURLs SubscriptionManagementUrLs `json:"management_urls,omitempty"`
	// Items: Represents a subscription item.
	Items []SubscriptionItem `json:"items,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
	// ImmediateTransaction: Preview of the immediate transaction created as a result of changes to the subscription. Returns a complete object where `proration_billing_mode` is `prorated_immediately` or `full_immediately`; `null` otherwise.
	ImmediateTransaction *NextTransaction `json:"immediate_transaction,omitempty"`
	// NextTransaction: Preview of the next transaction for this subscription. Includes charges created where `proration_billing_mode` is `prorated_next_billing_period` or `full_next_billing_period`, as well as one-time charges. `null` if the subscription is scheduled to cancel or pause.
	NextTransaction *NextTransaction `json:"next_transaction,omitempty"`
	// RecurringTransactionDetails: Preview of the recurring transaction for this subscription. This is what the customer can expect to be billed when there are no prorated or one-time charges.
	RecurringTransactionDetails SubscriptionTransactionDetailsPreview `json:"recurring_transaction_details,omitempty"`
	// UpdateSummary: Impact of this subscription change. Includes whether the change results in a charge or credit, and totals for prorated amounts.
	UpdateSummary *SubscriptionPreviewUpdateSummary `json:"update_summary,omitempty"`
	// ImportMeta: Import information for this entity. `null` if this entity is not imported.
	ImportMeta *ImportMeta `json:"import_meta,omitempty"`
}

SubscriptionPreview: Represents a subscription preview when previewing a subscription.

type SubscriptionPreviewUpdateSummary added in v0.5.0

type SubscriptionPreviewUpdateSummary struct {
	// Credit: Details of any credit adjustments created for this update. Paddle creates adjustments against existing transactions when prorating.
	Credit Money `json:"credit,omitempty"`
	// Charge: Details of the transaction to be created for this update. Paddle creates a transaction to bill for new charges.
	Charge Money `json:"charge,omitempty"`
	// Result: Details of the result of credits and charges. Where the total of any credit adjustments is greater than the total charge, the result is a prorated credit; otherwise, the result is a prorated charge.
	Result UpdateSummaryResult `json:"result,omitempty"`
}

SubscriptionPreviewUpdateSummary: Impact of this subscription change. Includes whether the change results in a charge or credit, and totals for prorated amounts.

type SubscriptionResumedEvent added in v0.2.1

type SubscriptionResumedEvent struct {
	GenericEvent
	Data paddlenotification.SubscriptionNotification `json:"data"`
}

SubscriptionResumedEvent represents an Event implementation for subscription.resumed event.

type SubscriptionScheduledChange

type SubscriptionScheduledChange struct {
	// Action: Kind of change that's scheduled to be applied to this subscription.
	Action ScheduledChangeAction `json:"action,omitempty"`
	// EffectiveAt: RFC 3339 datetime string of when this scheduled change takes effect.
	EffectiveAt string `json:"effective_at,omitempty"`
	// ResumeAt: RFC 3339 datetime string of when a paused subscription should resume. Only used for `pause` scheduled changes.
	ResumeAt *string `json:"resume_at,omitempty"`
}

SubscriptionScheduledChange: Change that's scheduled to be applied to a subscription. Use the pause subscription, cancel subscription, and resume subscription operations to create scheduled changes. `null` if no scheduled changes.

type SubscriptionStatus

type SubscriptionStatus string

SubscriptionStatus: Status of this subscription. Set automatically by Paddle. Use the pause subscription or cancel subscription operations to change..

const (
	SubscriptionStatusActive   SubscriptionStatus = "active"
	SubscriptionStatusCanceled SubscriptionStatus = "canceled"
	SubscriptionStatusPastDue  SubscriptionStatus = "past_due"
	SubscriptionStatusPaused   SubscriptionStatus = "paused"
	SubscriptionStatusTrialing SubscriptionStatus = "trialing"
)

type SubscriptionTransactionDetailsPreview added in v0.2.0

type SubscriptionTransactionDetailsPreview struct {
	// TaxRatesUsed: List of tax rates applied to this transaction preview.
	TaxRatesUsed []TaxRatesUsed `json:"tax_rates_used,omitempty"`
	// Totals: Breakdown of the total for a transaction preview. `fee` and `earnings` always return `null` for transaction previews.
	Totals TransactionTotals `json:"totals,omitempty"`
	// LineItems: Information about line items for this transaction preview. Different from transaction preview `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.
	LineItems []SubscriptionTransactionLineItemPreview `json:"line_items,omitempty"`
}

SubscriptionTransactionDetailsPreview: Calculated totals for a transaction preview, including discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction preview.

type SubscriptionTransactionLineItemPreview added in v0.7.0

type SubscriptionTransactionLineItemPreview struct {
	// PriceID: Paddle ID for the price related to this transaction line item, prefixed with `pri_`.
	PriceID string `json:"price_id,omitempty"`
	// Quantity: Quantity of this transaction line item.
	Quantity int `json:"quantity,omitempty"`
	// TaxRate: Rate used to calculate tax for this transaction line item.
	TaxRate string `json:"tax_rate,omitempty"`
	// UnitTotals: Breakdown of the charge for one unit in the lowest denomination of a currency (e.g. cents for USD).
	UnitTotals Totals `json:"unit_totals,omitempty"`
	// Totals: Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
	Totals Totals `json:"totals,omitempty"`
	// Product: Related product entity for this transaction line item price.
	Product Product `json:"product,omitempty"`
	// Proration: How proration was calculated for this item.
	Proration Proration `json:"proration,omitempty"`
}

SubscriptionTransactionLineItemPreview: Information about line items for this transaction preview. Different from transaction preview `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.

type SubscriptionTrialingEvent added in v0.2.1

type SubscriptionTrialingEvent struct {
	GenericEvent
	Data paddlenotification.SubscriptionNotification `json:"data"`
}

SubscriptionTrialingEvent represents an Event implementation for subscription.trialing event.

type SubscriptionUpdateCatalogItem added in v0.7.0

type SubscriptionUpdateCatalogItem struct {
	// PriceID: Paddle ID for the price to add to this subscription, prefixed with `pri_`.
	PriceID string `json:"price_id,omitempty"`
	// Quantity: Quantity of this item to add to the subscription. If updating an existing item and not changing the quantity, you may omit `quantity`.
	Quantity int `json:"quantity,omitempty"`
}

SubscriptionUpdateCatalogItem: Add or update a catalog item to a subscription. In this case, the product and price that you're billing for exist in your product catalog in Paddle.

type SubscriptionUpdatedEvent added in v0.2.1

type SubscriptionUpdatedEvent struct {
	GenericEvent
	Data paddlenotification.SubscriptionNotification `json:"data"`
}

SubscriptionUpdatedEvent represents an Event implementation for subscription.updated event.

type SubscriptionsClient

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

SubscriptionsClient is a client for the Subscriptions resource.

func (*SubscriptionsClient) ActivateSubscription

func (c *SubscriptionsClient) ActivateSubscription(ctx context.Context, req *ActivateSubscriptionRequest) (res *Subscription, err error)

ActivateSubscription performs the POST operation on a Subscriptions resource.

func (*SubscriptionsClient) CancelSubscription

func (c *SubscriptionsClient) CancelSubscription(ctx context.Context, req *CancelSubscriptionRequest) (res *Subscription, err error)

CancelSubscription performs the POST operation on a Subscriptions resource.

func (*SubscriptionsClient) CreateSubscriptionCharge

func (c *SubscriptionsClient) CreateSubscriptionCharge(ctx context.Context, req *CreateSubscriptionChargeRequest) (res *Subscription, err error)

CreateSubscriptionCharge performs the POST operation on a Subscriptions resource.

func (*SubscriptionsClient) GetSubscription

func (c *SubscriptionsClient) GetSubscription(ctx context.Context, req *GetSubscriptionRequest) (res *Subscription, err error)

GetSubscription performs the GET operation on a Subscriptions resource.

func (*SubscriptionsClient) GetSubscriptionUpdatePaymentMethodTransaction

func (c *SubscriptionsClient) GetSubscriptionUpdatePaymentMethodTransaction(ctx context.Context, req *GetSubscriptionUpdatePaymentMethodTransactionRequest) (res *Transaction, err error)

GetSubscriptionUpdatePaymentMethodTransaction performs the GET operation on a Subscriptions resource.

func (*SubscriptionsClient) ListSubscriptions

func (c *SubscriptionsClient) ListSubscriptions(ctx context.Context, req *ListSubscriptionsRequest) (res *Collection[*Subscription], err error)

ListSubscriptions performs the GET operation on a Subscriptions resource.

func (*SubscriptionsClient) PauseSubscription

func (c *SubscriptionsClient) PauseSubscription(ctx context.Context, req *PauseSubscriptionRequest) (res *Subscription, err error)

PauseSubscription performs the POST operation on a Subscriptions resource.

func (*SubscriptionsClient) PreviewSubscriptionCharge

func (c *SubscriptionsClient) PreviewSubscriptionCharge(ctx context.Context, req *PreviewSubscriptionChargeRequest) (res *SubscriptionPreview, err error)

PreviewSubscriptionCharge performs the POST operation on a Subscriptions resource.

func (*SubscriptionsClient) PreviewSubscriptionUpdate added in v0.5.0

func (c *SubscriptionsClient) PreviewSubscriptionUpdate(ctx context.Context, req *PreviewSubscriptionUpdateRequest) (res *SubscriptionPreview, err error)

PreviewSubscriptionUpdate performs the PATCH operation on a Subscriptions resource.

func (*SubscriptionsClient) ResumeSubscription

func (c *SubscriptionsClient) ResumeSubscription(ctx context.Context, req *ResumeSubscriptionRequest) (res *Subscription, err error)

ResumeSubscription performs the POST operation on a Subscriptions resource.

func (*SubscriptionsClient) UpdateSubscription

func (c *SubscriptionsClient) UpdateSubscription(ctx context.Context, req *UpdateSubscriptionRequest) (res *Subscription, err error)

UpdateSubscription performs the PATCH operation on a Subscriptions resource.

type TaxCategory

type TaxCategory string

TaxCategory: Tax category for this product. Used for charging the correct rate of tax. Selected tax category must be enabled on your Paddle account..

const (
	TaxCategoryDigitalGoods                TaxCategory = "digital-goods"
	TaxCategoryEbooks                      TaxCategory = "ebooks"
	TaxCategoryImplementationServices      TaxCategory = "implementation-services"
	TaxCategoryProfessionalServices        TaxCategory = "professional-services"
	TaxCategorySaas                        TaxCategory = "saas"
	TaxCategorySoftwareProgrammingServices TaxCategory = "software-programming-services"
	TaxCategoryStandard                    TaxCategory = "standard"
	TaxCategoryTrainingServices            TaxCategory = "training-services"
	TaxCategoryWebsiteHosting              TaxCategory = "website-hosting"
)

type TaxMode

type TaxMode string

TaxMode: How tax is calculated for this price..

const (
	TaxModeAccountSetting TaxMode = "account_setting"
	TaxModeExternal       TaxMode = "external"
	TaxModeInternal       TaxMode = "internal"
)

type TaxRatesUsed

type TaxRatesUsed struct {
	// TaxRate: Rate used to calculate tax for this transaction.
	TaxRate string `json:"tax_rate,omitempty"`
	// Totals: Calculated totals for the tax applied to this transaction.
	Totals Totals `json:"totals,omitempty"`
}

TaxRatesUsed: List of tax rates applied for this transaction.

type TimePeriod

type TimePeriod struct {
	// StartsAt: RFC 3339 datetime string of when this period starts.
	StartsAt string `json:"starts_at,omitempty"`
	// EndsAt: RFC 3339 datetime string of when this period ends.
	EndsAt string `json:"ends_at,omitempty"`
}

TimePeriod: Time period that this transaction is for. Set automatically by Paddle for subscription renewals to describe the period that charges are for.

type Totals

type Totals struct {
	// Subtotal: Subtotal before discount, tax, and deductions. If an item, unit price multiplied by quantity.
	Subtotal string `json:"subtotal,omitempty"`
	/*
	   Discount: Total discount as a result of any discounts applied.

	   Except for percentage discounts, Paddle applies tax to discounts based on the line item `price.tax_mode`. If `price.tax_mode` for a line item is `internal`, Paddle removes tax from the discount applied.
	*/
	Discount string `json:"discount,omitempty"`
	// Tax: Total tax on the subtotal.
	Tax string `json:"tax,omitempty"`
	// Total: Total after discount and tax.
	Total string `json:"total,omitempty"`
}

Totals: Calculated totals for the tax applied to this transaction.

type Transaction

type Transaction struct {
	// ID: Unique Paddle ID for this transaction entity, prefixed with `txn_`.
	ID string `json:"id,omitempty"`
	// Status: Status of this transaction. You may set a transaction to `billed` or `canceled`, other statuses are set automatically by Paddle. Automatically-collected transactions may return `completed` if payment is captured successfully, or `past_due` if payment failed.
	Status TransactionStatus `json:"status,omitempty"`
	// CustomerID: Paddle ID of the customer that this transaction is for, prefixed with `ctm_`.
	CustomerID *string `json:"customer_id,omitempty"`
	// AddressID: Paddle ID of the address that this transaction is for, prefixed with `add_`.
	AddressID *string `json:"address_id,omitempty"`
	// BusinessID: Paddle ID of the business that this transaction is for, prefixed with `biz_`.
	BusinessID *string `json:"business_id,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code. Must be `USD`, `EUR`, or `GBP` if `collection_mode` is `manual`.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
	// Origin: Describes how this transaction was created.
	Origin TransactionOrigin `json:"origin,omitempty"`
	// SubscriptionID: Paddle ID of the subscription that this transaction is for, prefixed with `sub_`.
	SubscriptionID *string `json:"subscription_id,omitempty"`
	// InvoiceID: Paddle ID of the invoice that this transaction is related to, prefixed with `inv_`. Used for compatibility with the Paddle Invoice API, which is now deprecated. This field is scheduled to be removed in the next version of the Paddle API.
	InvoiceID *string `json:"invoice_id,omitempty"`
	// InvoiceNumber: Invoice number for this transaction. Automatically generated by Paddle when you mark a transaction as `billed` where `collection_mode` is `manual`.
	InvoiceNumber *string `json:"invoice_number,omitempty"`
	// CollectionMode: How payment is collected for this transaction. `automatic` for checkout, `manual` for invoices.
	CollectionMode CollectionMode `json:"collection_mode,omitempty"`
	// DiscountID: Paddle ID of the discount applied to this transaction, prefixed with `dsc_`.
	DiscountID *string `json:"discount_id,omitempty"`
	// BillingDetails: Details for invoicing. Required if `collection_mode` is `manual`.
	BillingDetails *BillingDetails `json:"billing_details,omitempty"`
	// BillingPeriod: Time period that this transaction is for. Set automatically by Paddle for subscription renewals to describe the period that charges are for.
	BillingPeriod *TimePeriod `json:"billing_period,omitempty"`
	// Items: List of items on this transaction. For calculated totals, use `details.line_items`.
	Items []TransactionItem `json:"items,omitempty"`
	// Details: Calculated totals for a transaction, including proration, discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction.
	Details TransactionDetails `json:"details,omitempty"`
	// Payments: List of payment attempts for this transaction, including successful payments. Sorted by `created_at` in descending order, so most recent attempts are returned first.
	Payments []TransactionPaymentAttempt `json:"payments,omitempty"`
	// Checkout: Paddle Checkout details for this transaction. Returned for automatically-collected transactions and where `billing_details.enable_checkout` is `true` for manually-collected transactions; `null` otherwise.
	Checkout *TransactionCheckout `json:"checkout,omitempty"`
	// CreatedAt: RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
	CreatedAt string `json:"created_at,omitempty"`
	// UpdatedAt: RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
	UpdatedAt string `json:"updated_at,omitempty"`
	// BilledAt: RFC 3339 datetime string of when this transaction was marked as `billed`. `null` for transactions that are not `billed` or `completed`. Set automatically by Paddle.
	BilledAt *string `json:"billed_at,omitempty"`
	// Address: Address for this transaction. Returned when the `include` parameter is used with the `address` value and the transaction has an `address_id`.
	Address Address `json:"address,omitempty"`
	// Adjustments: Represents an adjustment entity.
	Adjustments []Adjustment `json:"adjustments,omitempty"`
	// AdjustmentsTotals: Object containing totals for all adjustments on a transaction. Returned when the `include` parameter is used with the `adjustments_totals` value.
	AdjustmentsTotals TransactionAdjustmentTotals `json:"adjustments_totals,omitempty"`
	// Business: Business for this transaction. Returned when the `include` parameter is used with the `business` value and the transaction has a `business_id`.
	Business Business `json:"business,omitempty"`
	// Customer: Customer for this transaction. Returned when the `include` parameter is used with the `customer` value and the transaction has a `customer_id`.
	Customer Customer `json:"customer,omitempty"`
	// Discount: Discount for this transaction. Returned when the `include` parameter is used with the `discount` value and the transaction has a `discount_id`.
	Discount Discount `json:"discount,omitempty"`
	// AvailablePaymentMethods: List of available payment methods for this transaction. Returned when the `include` parameter is used with the `available_payment_methods` value.
	AvailablePaymentMethods []PaymentMethodType `json:"available_payment_methods,omitempty"`
}

Transaction: Represents a transaction entity with included entities.

type TransactionAdjustmentTotals added in v0.7.0

type TransactionAdjustmentTotals struct {
	// Subtotal: Total before tax.
	Subtotal string `json:"subtotal,omitempty"`
	// Tax: Total tax on the subtotal.
	Tax string `json:"tax,omitempty"`
	// Total: Total after tax.
	Total string `json:"total,omitempty"`
	// Fee: Total fee taken by Paddle.
	Fee string `json:"fee,omitempty"`
	/*
	   Earnings: Total earnings. This is the subtotal minus the Paddle fee.
	   For tax adjustments, this value is negative, which means a positive effect in the transaction earnings.
	   This is because the fee is originally calculated from the transaction total, so if a tax adjustment is made,
	   then the fee portion of it is returned.
	   As a result, the earnings from all the adjustments performed could be either negative, positive or zero.
	*/
	Earnings string `json:"earnings,omitempty"`
	// Breakdown: Breakdown of the total adjustments by adjustment action.
	Breakdown AdjustmentTotalsBreakdown `json:"breakdown,omitempty"`
	// CurrencyCode: Three-letter ISO 4217 currency code used for adjustments for this transaction.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
}

TransactionAdjustmentTotals: Object containing totals for all adjustments on a transaction. Returned when the `include` parameter is used with the `adjustments_totals` value.

type TransactionBilledEvent added in v0.2.1

type TransactionBilledEvent struct {
	GenericEvent
	Data paddlenotification.TransactionNotification `json:"data"`
}

TransactionBilledEvent represents an Event implementation for transaction.billed event.

type TransactionCanceledEvent added in v0.2.1

type TransactionCanceledEvent struct {
	GenericEvent
	Data paddlenotification.TransactionNotification `json:"data"`
}

TransactionCanceledEvent represents an Event implementation for transaction.canceled event.

type TransactionCatalogItem added in v0.7.0

type TransactionCatalogItem struct {
	// Quantity: Quantity of this item on the transaction.
	Quantity int `json:"quantity,omitempty"`
	// IncludeInTotals: Whether this item should be included in totals for this transaction preview. Typically used to exclude one-time charges from calculations.
	IncludeInTotals bool `json:"include_in_totals,omitempty"`
	// Proration: How proration was calculated for this item. `null` for transaction previews.
	Proration *Proration `json:"proration,omitempty"`
	// PriceID: Paddle ID of an existing catalog price to preview charging for, prefixed with `pri_`.
	PriceID string `json:"price_id,omitempty"`
}

TransactionCatalogItem: Add a catalog item to a transaction. In this case, the product and price that you're billing for exist in your product catalog in Paddle.

type TransactionCheckout added in v0.7.0

type TransactionCheckout struct {
	// URL: Paddle Checkout URL for this transaction, composed of the URL passed in the request or your default payment URL + `_?txn=` and the Paddle ID for this transaction.
	URL *string `json:"url,omitempty"`
}

TransactionCheckout: Paddle Checkout details for this transaction. Returned for automatically-collected transactions and where `billing_details.enable_checkout` is `true` for manually-collected transactions; `null` otherwise.

type TransactionCompletedEvent added in v0.2.1

type TransactionCompletedEvent struct {
	GenericEvent
	Data paddlenotification.TransactionNotification `json:"data"`
}

TransactionCompletedEvent represents an Event implementation for transaction.completed event.

type TransactionCreatedEvent added in v0.2.1

type TransactionCreatedEvent struct {
	GenericEvent
	Data paddlenotification.TransactionNotification `json:"data"`
}

TransactionCreatedEvent represents an Event implementation for transaction.created event.

type TransactionDetails

type TransactionDetails struct {
	// TaxRatesUsed: List of tax rates applied for this transaction.
	TaxRatesUsed []TaxRatesUsed `json:"tax_rates_used,omitempty"`
	// Totals: Breakdown of the total for a transaction. These numbers can become negative when dealing with subscription updates that result in credit.
	Totals TransactionTotals `json:"totals,omitempty"`
	// AdjustedTotals: Breakdown of the payout totals for a transaction after adjustments. `null` until the transaction is `completed`.
	AdjustedTotals TransactionTotalsAdjusted `json:"adjusted_totals,omitempty"`
	// PayoutTotals: Breakdown of the payout total for a transaction. `null` until the transaction is `completed`. Returned in your payout currency.
	PayoutTotals *TransactionPayoutTotals `json:"payout_totals,omitempty"`
	// AdjustedPayoutTotals: Breakdown of the payout total for a transaction after adjustments. `null` until the transaction is `completed`.
	AdjustedPayoutTotals *TransactionPayoutTotalsAdjusted `json:"adjusted_payout_totals,omitempty"`
	// LineItems: Information about line items for this transaction. Different from transaction `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.
	LineItems []TransactionLineItem `json:"line_items,omitempty"`
}

TransactionDetails: Calculated totals for a transaction, including proration, discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction.

type TransactionDetailsPreview

type TransactionDetailsPreview struct {
	// TaxRatesUsed: List of tax rates applied to this transaction preview.
	TaxRatesUsed []TaxRatesUsed `json:"tax_rates_used,omitempty"`
	// Totals: Breakdown of the total for a transaction preview. `fee` and `earnings` always return `null` for transaction previews.
	Totals TransactionTotals `json:"totals,omitempty"`
	// LineItems: Information about line items for this transaction preview. Different from transaction preview `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.
	LineItems []TransactionLineItemPreview `json:"line_items,omitempty"`
}

TransactionDetailsPreview: Calculated totals for a transaction preview, including discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction preview.

type TransactionInvoicePDF

type TransactionInvoicePDF struct {
	// URL: URL of the requested resource.
	URL string `json:"url,omitempty"`
}

type TransactionItem

type TransactionItem struct {
	// PriceID: Paddle ID for the price to add to this transaction, prefixed with `pri_`.
	PriceID string `json:"price_id,omitempty"`
	// Price: Represents a price entity.
	Price Price `json:"price,omitempty"`
	// Quantity: Quantity of this item on the transaction.
	Quantity int `json:"quantity,omitempty"`
	// Proration: How proration was calculated for this item. Populated when a transaction is created from a subscription change, where `proration_billing_mode` was `prorated_immediately` or `prorated_next_billing_period`. Set automatically by Paddle.
	Proration *Proration `json:"proration,omitempty"`
}

TransactionItem: List of items on this transaction. For calculated totals, use `details.line_items`.

type TransactionItemPreview

type TransactionItemPreview struct {
	// Quantity: Quantity of this item on the transaction.
	Quantity int `json:"quantity,omitempty"`
	// IncludeInTotals: Whether this item should be included in totals for this transaction preview. Typically used to exclude one-time charges from calculations.
	IncludeInTotals bool `json:"include_in_totals,omitempty"`
	// Proration: How proration was calculated for this item. `null` for transaction previews.
	Proration *Proration `json:"proration,omitempty"`
	// Price: Represents a price entity.
	Price Price `json:"price,omitempty"`
}

TransactionItemPreview: List of items to preview transaction calculations for.

type TransactionLineItem

type TransactionLineItem struct {
	// ID: Unique Paddle ID for this transaction item, prefixed with `txnitm_`.
	ID string `json:"id,omitempty"`
	// PriceID: Paddle ID for the price related to this transaction line item, prefixed with `pri_`.
	PriceID string `json:"price_id,omitempty"`
	// Quantity: Quantity of this transaction line item.
	Quantity int `json:"quantity,omitempty"`
	// Proration: How proration was calculated for this item. Populated when a transaction is created from a subscription change, where `proration_billing_mode` was `prorated_immediately` or `prorated_next_billing_period`. Set automatically by Paddle.
	Proration *Proration `json:"proration,omitempty"`
	// TaxRate: Rate used to calculate tax for this transaction line item.
	TaxRate string `json:"tax_rate,omitempty"`
	// UnitTotals: Breakdown of the charge for one unit in the lowest denomination of a currency (e.g. cents for USD).
	UnitTotals Totals `json:"unit_totals,omitempty"`
	// Totals: Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
	Totals Totals `json:"totals,omitempty"`
	// Product: Related product entity for this transaction line item price.
	Product Product `json:"product,omitempty"`
}

TransactionLineItem: Information about line items for this transaction. Different from transaction `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.

type TransactionLineItemPreview

type TransactionLineItemPreview struct {
	// PriceID: Paddle ID for the price related to this transaction line item, prefixed with `pri_`.
	PriceID string `json:"price_id,omitempty"`
	// Quantity: Quantity of this transaction line item.
	Quantity int `json:"quantity,omitempty"`
	// TaxRate: Rate used to calculate tax for this transaction line item.
	TaxRate string `json:"tax_rate,omitempty"`
	// UnitTotals: Breakdown of the charge for one unit in the lowest denomination of a currency (e.g. cents for USD).
	UnitTotals Totals `json:"unit_totals,omitempty"`
	// Totals: Breakdown of a charge in the lowest denomination of a currency (e.g. cents for USD).
	Totals Totals `json:"totals,omitempty"`
	// Product: Related product entity for this transaction line item price.
	Product Product `json:"product,omitempty"`
}

TransactionLineItemPreview: Information about line items for this transaction preview. Different from transaction preview `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.

type TransactionNonCatalogPriceAndProduct added in v0.7.0

type TransactionNonCatalogPriceAndProduct struct {
	// Quantity: Quantity of this item on the transaction.
	Quantity int `json:"quantity,omitempty"`
	// IncludeInTotals: Whether this item should be included in totals for this transaction preview. Typically used to exclude one-time charges from calculations.
	IncludeInTotals bool `json:"include_in_totals,omitempty"`
	// Proration: How proration was calculated for this item. `null` for transaction previews.
	Proration *Proration `json:"proration,omitempty"`
	// Price: Price object for a non-catalog item to preview charging for. Include a `product` object to create a non-catalog product for this non-catalog price.
	Price TransactionPriceCreateWithProduct `json:"price,omitempty"`
}

TransactionNonCatalogPriceAndProduct: Add a non-catalog price for a non-catalog product in your catalog to a transaction. In this case, the product and price that you're billing for are specific to this transaction.

type TransactionNonCatalogPriceForAnExistingProduct added in v0.7.0

type TransactionNonCatalogPriceForAnExistingProduct struct {
	// Quantity: Quantity of this item on the transaction.
	Quantity int `json:"quantity,omitempty"`
	// IncludeInTotals: Whether this item should be included in totals for this transaction preview. Typically used to exclude one-time charges from calculations.
	IncludeInTotals bool `json:"include_in_totals,omitempty"`
	// Proration: How proration was calculated for this item. `null` for transaction previews.
	Proration *Proration `json:"proration,omitempty"`
	// Price: Price object for a non-catalog item to preview charging for. Include a `product_id` to relate this non-catalog price to an existing catalog price.
	Price TransactionPriceCreateWithProductID `json:"price,omitempty"`
}

TransactionNonCatalogPriceForAnExistingProduct: Add a non-catalog price for an existing product in your catalog to a transaction. In this case, the product you're billing for is a catalog product, but you charge a specific price for it.

type TransactionOrigin

type TransactionOrigin string

TransactionOrigin: Describes how this transaction was created..

const (
	TransactionOriginAPI                             TransactionOrigin = "api"
	TransactionOriginSubscriptionCharge              TransactionOrigin = "subscription_charge"
	TransactionOriginSubscriptionPaymentMethodChange TransactionOrigin = "subscription_payment_method_change"
	TransactionOriginSubscriptionRecurring           TransactionOrigin = "subscription_recurring"
	TransactionOriginSubscriptionUpdate              TransactionOrigin = "subscription_update"
	TransactionOriginWeb                             TransactionOrigin = "web"
)

type TransactionPaidEvent added in v0.2.1

type TransactionPaidEvent struct {
	GenericEvent
	Data paddlenotification.TransactionNotification `json:"data"`
}

TransactionPaidEvent represents an Event implementation for transaction.paid event.

type TransactionPastDueEvent added in v0.2.1

type TransactionPastDueEvent struct {
	GenericEvent
	Data paddlenotification.TransactionNotification `json:"data"`
}

TransactionPastDueEvent represents an Event implementation for transaction.past_due event.

type TransactionPaymentAttempt

type TransactionPaymentAttempt struct {
	// PaymentAttemptID: UUID for this payment attempt.
	PaymentAttemptID string `json:"payment_attempt_id,omitempty"`
	// StoredPaymentMethodID: UUID for the stored payment method used for this payment attempt. Deprecated - use `payment_method_id` instead.
	StoredPaymentMethodID string `json:"stored_payment_method_id,omitempty"`
	// PaymentMethodID: Paddle ID of the payment method used for this payment attempt, prefixed with `paymtd_`.
	PaymentMethodID string `json:"payment_method_id,omitempty"`
	// Amount: Amount for collection in the lowest denomination of a currency (e.g. cents for USD).
	Amount string `json:"amount,omitempty"`
	// Status: Status of this payment attempt.
	Status PaymentAttemptStatus `json:"status,omitempty"`
	// ErrorCode: Reason why a payment attempt failed. Returns `null` if payment captured successfully.
	ErrorCode *ErrorCode `json:"error_code,omitempty"`
	// MethodDetails: Information about the payment method used for a payment attempt.
	MethodDetails MethodDetails `json:"method_details,omitempty"`
	// CreatedAt: RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
	CreatedAt string `json:"created_at,omitempty"`
	// CapturedAt: RFC 3339 datetime string of when this payment was captured. `null` if `status` is not `captured`.
	CapturedAt *string `json:"captured_at,omitempty"`
}

TransactionPaymentAttempt: List of payment attempts for this transaction, including successful payments. Sorted by `created_at` in descending order, so most recent attempts are returned first.

type TransactionPaymentFailedEvent added in v0.2.1

type TransactionPaymentFailedEvent struct {
	GenericEvent
	Data paddlenotification.TransactionNotification `json:"data"`
}

TransactionPaymentFailedEvent represents an Event implementation for transaction.payment_failed event.

type TransactionPayoutTotals

type TransactionPayoutTotals struct {
	// Subtotal: Total before tax and fees.
	Subtotal string `json:"subtotal,omitempty"`
	/*
	   Discount: Total discount as a result of any discounts applied.
	   Except for percentage discounts, Paddle applies tax to discounts based on the line item `price.tax_mode`. If `price.tax_mode` for a line item is `internal`, Paddle removes tax from the discount applied.
	*/
	Discount string `json:"discount,omitempty"`
	// Tax: Total tax on the subtotal.
	Tax string `json:"tax,omitempty"`
	// Total: Total after tax.
	Total string `json:"total,omitempty"`
	// Credit: Total credit applied to this transaction. This includes credits applied using a customer's credit balance and adjustments to a `billed` transaction.
	Credit string `json:"credit,omitempty"`
	// CreditToBalance: Additional credit generated from negative `details.line_items`. This credit is added to the customer balance.
	CreditToBalance string `json:"credit_to_balance,omitempty"`
	// Balance: Total due on a transaction after credits and any payments.
	Balance string `json:"balance,omitempty"`
	// GrandTotal: Total due on a transaction after credits but before any payments.
	GrandTotal string `json:"grand_total,omitempty"`
	// Fee: Total fee taken by Paddle for this payout.
	Fee string `json:"fee,omitempty"`
	// Earnings: Total earnings for this payout. This is the subtotal minus the Paddle fee.
	Earnings string `json:"earnings,omitempty"`
	// CurrencyCode: Three-letter ISO 4217 currency code used for the payout for this transaction. If your primary currency has changed, this reflects the primary currency at the time the transaction was billed.
	CurrencyCode CurrencyCodePayouts `json:"currency_code,omitempty"`
}

TransactionPayoutTotals: Breakdown of the payout total for a transaction. `null` until the transaction is `completed`. Returned in your payout currency.

type TransactionPayoutTotalsAdjusted

type TransactionPayoutTotalsAdjusted struct {
	// Subtotal: Total before tax and fees.
	Subtotal string `json:"subtotal,omitempty"`
	// Tax: Total tax on the subtotal.
	Tax string `json:"tax,omitempty"`
	// Total: Total after tax.
	Total string `json:"total,omitempty"`
	// Fee: Total fee taken by Paddle for this payout.
	Fee string `json:"fee,omitempty"`
	// ChargebackFee: Details of any chargeback fees incurred for this transaction.
	ChargebackFee ChargebackFee `json:"chargeback_fee,omitempty"`
	// Earnings: Total earnings for this payout. This is the subtotal minus the Paddle fee, excluding chargeback fees.
	Earnings string `json:"earnings,omitempty"`
	// CurrencyCode: Three-letter ISO 4217 currency code used for the payout for this transaction. If your primary currency has changed, this reflects the primary currency at the time the transaction was billed.
	CurrencyCode CurrencyCodePayouts `json:"currency_code,omitempty"`
}

TransactionPayoutTotalsAdjusted: Breakdown of the payout total for a transaction after adjustments. `null` until the transaction is `completed`.

type TransactionPreview

type TransactionPreview struct {
	// CustomerID: Paddle ID of the customer that this transaction preview is for, prefixed with `ctm_`.
	CustomerID *string `json:"customer_id,omitempty"`
	// AddressID: Paddle ID of the address that this transaction preview is for, prefixed with `add_`. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
	AddressID *string `json:"address_id,omitempty"`
	// BusinessID: Paddle ID of the business that this transaction preview is for, prefixed with `biz_`.
	BusinessID *string `json:"business_id,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
	// DiscountID: Paddle ID of the discount applied to this transaction preview, prefixed with `dsc_`.
	DiscountID *string `json:"discount_id,omitempty"`
	// CustomerIPAddress: IP address for this transaction preview. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
	CustomerIPAddress *string `json:"customer_ip_address,omitempty"`
	// Address: Address for this transaction preview. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
	Address *AddressPreview `json:"address,omitempty"`
	/*
	   IgnoreTrials: Whether trials should be ignored for transaction preview calculations.

	   By default, recurring items with trials are considered to have a zero charge when previewing. Set to `true` to disable this.
	*/
	IgnoreTrials bool `json:"ignore_trials,omitempty"`
	// Items: List of items to preview transaction calculations for.
	Items []TransactionItemPreview `json:"items,omitempty"`
	// Details: Calculated totals for a transaction preview, including discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction preview.
	Details TransactionDetailsPreview `json:"details,omitempty"`
	// AvailablePaymentMethods: List of available payment methods for Paddle Checkout given the price and location information passed.
	AvailablePaymentMethods []PaymentMethodType `json:"available_payment_methods,omitempty"`
}

TransactionPreview: Represents a transaction entity when previewing transactions.

type TransactionPreviewByAddress added in v0.5.0

type TransactionPreviewByAddress struct {
	// Address: Address for this transaction preview.
	Address AddressPreview `json:"address,omitempty"`
	// CustomerID: Paddle ID of the customer that this transaction preview is for, prefixed with `ctm_`.
	CustomerID *string `json:"customer_id,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
	// DiscountID: Paddle ID of the discount applied to this transaction preview, prefixed with `dsc_`.
	DiscountID *string `json:"discount_id,omitempty"`
	/*
	   IgnoreTrials: Whether trials should be ignored for transaction preview calculations.

	   By default, recurring items with trials are considered to have a zero charge when previewing. Set to `true` to disable this.
	*/
	IgnoreTrials bool `json:"ignore_trials,omitempty"`
	// Items: Add a non-catalog price for a non-catalog product in your catalog to a transaction. In this case, the product and price that you're billing for are specific to this transaction.
	Items []TransactionPreviewByAddressItems `json:"items,omitempty"`
}

TransactionPreviewByAddress: Paddle uses the country and ZIP code (where supplied) to calculate totals.

type TransactionPreviewByAddressItems added in v0.5.0

TransactionPreviewByAddressItems represents a union request type of the following types:

  • `TransactionCatalogItem`
  • `TransactionNonCatalogPriceForAnExistingProduct`
  • `TransactionNonCatalogPriceAndProduct`

The following constructor functions can be used to create a new instance of this type.

  • `NewTransactionPreviewByAddressItemsTransactionCatalogItem()`
  • `NewTransactionPreviewByAddressItemsTransactionNonCatalogPriceForAnExistingProduct()`
  • `NewTransactionPreviewByAddressItemsTransactionNonCatalogPriceAndProduct()`

Only one of the values can be set at a time, the first non-nil value will be used in the request. Items: Add a non-catalog price for a non-catalog product in your catalog to a transaction. In this case, the product and price that you're billing for are specific to this transaction.

func NewTransactionPreviewByAddressItemsTransactionCatalogItem added in v0.7.0

func NewTransactionPreviewByAddressItemsTransactionCatalogItem(r *TransactionCatalogItem) *TransactionPreviewByAddressItems

NewTransactionPreviewByAddressItemsTransactionCatalogItem takes a TransactionCatalogItem type and creates a TransactionPreviewByAddressItems for use in a request.

func NewTransactionPreviewByAddressItemsTransactionNonCatalogPriceAndProduct added in v0.7.0

func NewTransactionPreviewByAddressItemsTransactionNonCatalogPriceAndProduct(r *TransactionNonCatalogPriceAndProduct) *TransactionPreviewByAddressItems

NewTransactionPreviewByAddressItemsTransactionNonCatalogPriceAndProduct takes a TransactionNonCatalogPriceAndProduct type and creates a TransactionPreviewByAddressItems for use in a request.

func NewTransactionPreviewByAddressItemsTransactionNonCatalogPriceForAnExistingProduct added in v0.7.0

func NewTransactionPreviewByAddressItemsTransactionNonCatalogPriceForAnExistingProduct(r *TransactionNonCatalogPriceForAnExistingProduct) *TransactionPreviewByAddressItems

NewTransactionPreviewByAddressItemsTransactionNonCatalogPriceForAnExistingProduct takes a TransactionNonCatalogPriceForAnExistingProduct type and creates a TransactionPreviewByAddressItems for use in a request.

func (TransactionPreviewByAddressItems) MarshalJSON added in v0.5.0

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

MarshalJSON implements the json.Marshaler interface.

type TransactionPreviewByCustomer added in v0.5.0

type TransactionPreviewByCustomer struct {
	// AddressID: Paddle ID of the address that this transaction preview is for, prefixed with `add_`. Requires `customer_id`.
	AddressID string `json:"address_id,omitempty"`
	// BusinessID: Paddle ID of the business that this transaction preview is for, prefixed with `biz_`.
	BusinessID *string `json:"business_id,omitempty"`
	// CustomerID: Paddle ID of the customer that this transaction preview is for, prefixed with `ctm_`.
	CustomerID *string `json:"customer_id,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
	// DiscountID: Paddle ID of the discount applied to this transaction preview, prefixed with `dsc_`.
	DiscountID *string `json:"discount_id,omitempty"`
	/*
	   IgnoreTrials: Whether trials should be ignored for transaction preview calculations.

	   By default, recurring items with trials are considered to have a zero charge when previewing. Set to `true` to disable this.
	*/
	IgnoreTrials bool `json:"ignore_trials,omitempty"`
	// Items: Add a non-catalog price for a non-catalog product in your catalog to a transaction. In this case, the product and price that you're billing for are specific to this transaction.
	Items []TransactionPreviewByCustomerItems `json:"items,omitempty"`
}

TransactionPreviewByCustomer: Paddle uses existing customer data to calculate totals. Typically used for logged-in customers.

type TransactionPreviewByCustomerItems added in v0.5.0

TransactionPreviewByCustomerItems represents a union request type of the following types:

  • `TransactionCatalogItem`
  • `TransactionNonCatalogPriceForAnExistingProduct`
  • `TransactionNonCatalogPriceAndProduct`

The following constructor functions can be used to create a new instance of this type.

  • `NewTransactionPreviewByCustomerItemsTransactionCatalogItem()`
  • `NewTransactionPreviewByCustomerItemsTransactionNonCatalogPriceForAnExistingProduct()`
  • `NewTransactionPreviewByCustomerItemsTransactionNonCatalogPriceAndProduct()`

Only one of the values can be set at a time, the first non-nil value will be used in the request. Items: Add a non-catalog price for a non-catalog product in your catalog to a transaction. In this case, the product and price that you're billing for are specific to this transaction.

func NewTransactionPreviewByCustomerItemsTransactionCatalogItem added in v0.7.0

func NewTransactionPreviewByCustomerItemsTransactionCatalogItem(r *TransactionCatalogItem) *TransactionPreviewByCustomerItems

NewTransactionPreviewByCustomerItemsTransactionCatalogItem takes a TransactionCatalogItem type and creates a TransactionPreviewByCustomerItems for use in a request.

func NewTransactionPreviewByCustomerItemsTransactionNonCatalogPriceAndProduct added in v0.7.0

func NewTransactionPreviewByCustomerItemsTransactionNonCatalogPriceAndProduct(r *TransactionNonCatalogPriceAndProduct) *TransactionPreviewByCustomerItems

NewTransactionPreviewByCustomerItemsTransactionNonCatalogPriceAndProduct takes a TransactionNonCatalogPriceAndProduct type and creates a TransactionPreviewByCustomerItems for use in a request.

func NewTransactionPreviewByCustomerItemsTransactionNonCatalogPriceForAnExistingProduct added in v0.7.0

func NewTransactionPreviewByCustomerItemsTransactionNonCatalogPriceForAnExistingProduct(r *TransactionNonCatalogPriceForAnExistingProduct) *TransactionPreviewByCustomerItems

NewTransactionPreviewByCustomerItemsTransactionNonCatalogPriceForAnExistingProduct takes a TransactionNonCatalogPriceForAnExistingProduct type and creates a TransactionPreviewByCustomerItems for use in a request.

func (TransactionPreviewByCustomerItems) MarshalJSON added in v0.5.0

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

MarshalJSON implements the json.Marshaler interface.

type TransactionPreviewByIP added in v0.5.0

type TransactionPreviewByIP struct {
	// CustomerIPAddress: IP address for this transaction preview.
	CustomerIPAddress string `json:"customer_ip_address,omitempty"`
	// CustomerID: Paddle ID of the customer that this transaction preview is for, prefixed with `ctm_`.
	CustomerID *string `json:"customer_id,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
	// DiscountID: Paddle ID of the discount applied to this transaction preview, prefixed with `dsc_`.
	DiscountID *string `json:"discount_id,omitempty"`
	/*
	   IgnoreTrials: Whether trials should be ignored for transaction preview calculations.

	   By default, recurring items with trials are considered to have a zero charge when previewing. Set to `true` to disable this.
	*/
	IgnoreTrials bool `json:"ignore_trials,omitempty"`
	// Items: Add a non-catalog price for a non-catalog product in your catalog to a transaction. In this case, the product and price that you're billing for are specific to this transaction.
	Items []TransactionPreviewByIPItems `json:"items,omitempty"`
}

TransactionPreviewByIP: Paddle fetches location using the IP address to calculate totals.

type TransactionPreviewByIPItems added in v0.5.0

TransactionPreviewByIPItems represents a union request type of the following types:

  • `TransactionCatalogItem`
  • `TransactionNonCatalogPriceForAnExistingProduct`
  • `TransactionNonCatalogPriceAndProduct`

The following constructor functions can be used to create a new instance of this type.

  • `NewTransactionPreviewByIPItemsTransactionCatalogItem()`
  • `NewTransactionPreviewByIPItemsTransactionNonCatalogPriceForAnExistingProduct()`
  • `NewTransactionPreviewByIPItemsTransactionNonCatalogPriceAndProduct()`

Only one of the values can be set at a time, the first non-nil value will be used in the request. Items: Add a non-catalog price for a non-catalog product in your catalog to a transaction. In this case, the product and price that you're billing for are specific to this transaction.

func NewTransactionPreviewByIPItemsTransactionCatalogItem added in v0.7.0

func NewTransactionPreviewByIPItemsTransactionCatalogItem(r *TransactionCatalogItem) *TransactionPreviewByIPItems

NewTransactionPreviewByIPItemsTransactionCatalogItem takes a TransactionCatalogItem type and creates a TransactionPreviewByIPItems for use in a request.

func NewTransactionPreviewByIPItemsTransactionNonCatalogPriceAndProduct added in v0.7.0

func NewTransactionPreviewByIPItemsTransactionNonCatalogPriceAndProduct(r *TransactionNonCatalogPriceAndProduct) *TransactionPreviewByIPItems

NewTransactionPreviewByIPItemsTransactionNonCatalogPriceAndProduct takes a TransactionNonCatalogPriceAndProduct type and creates a TransactionPreviewByIPItems for use in a request.

func NewTransactionPreviewByIPItemsTransactionNonCatalogPriceForAnExistingProduct added in v0.7.0

func NewTransactionPreviewByIPItemsTransactionNonCatalogPriceForAnExistingProduct(r *TransactionNonCatalogPriceForAnExistingProduct) *TransactionPreviewByIPItems

NewTransactionPreviewByIPItemsTransactionNonCatalogPriceForAnExistingProduct takes a TransactionNonCatalogPriceForAnExistingProduct type and creates a TransactionPreviewByIPItems for use in a request.

func (TransactionPreviewByIPItems) MarshalJSON added in v0.5.0

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

MarshalJSON implements the json.Marshaler interface.

type TransactionPriceCreateWithProduct added in v0.4.0

type TransactionPriceCreateWithProduct struct {
	// Description: Internal description for this price, not shown to customers. Typically notes for your team.
	Description string `json:"description,omitempty"`
	// Name: Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
	Name *string `json:"name,omitempty"`
	// BillingCycle: How often this price should be charged. `null` if price is non-recurring (one-time).
	BillingCycle *Duration `json:"billing_cycle,omitempty"`
	// TrialPeriod: Trial period for the product related to this price. The billing cycle begins once the trial period is over. `null` for no trial period. Requires `billing_cycle`.
	TrialPeriod *Duration `json:"trial_period,omitempty"`
	// TaxMode: How tax is calculated for this price.
	TaxMode TaxMode `json:"tax_mode,omitempty"`
	// UnitPrice: Base price. This price applies to all customers, except for customers located in countries where you have `unit_price_overrides`.
	UnitPrice Money `json:"unit_price,omitempty"`
	// UnitPriceOverrides: List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
	UnitPriceOverrides []UnitPriceOverride `json:"unit_price_overrides,omitempty"`
	// Quantity: Limits on how many times the related product can be purchased at this price. Useful for discount campaigns. If omitted, defaults to 1-100.
	Quantity PriceQuantity `json:"quantity,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
	// Product: Product object for a non-catalog item to charge for.
	Product TransactionSubscriptionProductCreate `json:"product,omitempty"`
}

TransactionPriceCreateWithProduct: Price object for a non-catalog item to charge for. Include a `product` object to create a non-catalog product for this non-catalog price.

type TransactionPriceCreateWithProductID added in v0.4.0

type TransactionPriceCreateWithProductID struct {
	// Description: Internal description for this price, not shown to customers. Typically notes for your team.
	Description string `json:"description,omitempty"`
	// Name: Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
	Name *string `json:"name,omitempty"`
	// BillingCycle: How often this price should be charged. `null` if price is non-recurring (one-time).
	BillingCycle *Duration `json:"billing_cycle,omitempty"`
	// TrialPeriod: Trial period for the product related to this price. The billing cycle begins once the trial period is over. `null` for no trial period. Requires `billing_cycle`.
	TrialPeriod *Duration `json:"trial_period,omitempty"`
	// TaxMode: How tax is calculated for this price.
	TaxMode TaxMode `json:"tax_mode,omitempty"`
	// UnitPrice: Base price. This price applies to all customers, except for customers located in countries where you have `unit_price_overrides`.
	UnitPrice Money `json:"unit_price,omitempty"`
	// UnitPriceOverrides: List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
	UnitPriceOverrides []UnitPriceOverride `json:"unit_price_overrides,omitempty"`
	// Quantity: Limits on how many times the related product can be purchased at this price. Useful for discount campaigns. If omitted, defaults to 1-100.
	Quantity PriceQuantity `json:"quantity,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
	// ProductID: Paddle ID for the product that this price is for, prefixed with `pro_`.
	ProductID string `json:"product_id,omitempty"`
}

TransactionPriceCreateWithProductID: Price object for a non-catalog item to charge for. Include a `product_id` to relate this non-catalog price to an existing catalog price.

type TransactionReadyEvent added in v0.2.1

type TransactionReadyEvent struct {
	GenericEvent
	Data paddlenotification.TransactionNotification `json:"data"`
}

TransactionReadyEvent represents an Event implementation for transaction.ready event.

type TransactionStatus

type TransactionStatus string

TransactionStatus: Status of this transaction. You may set a transaction to `billed` or `canceled`, other statuses are set automatically by Paddle. Automatically-collected transactions may return `completed` if payment is captured successfully, or `past_due` if payment failed..

const (
	TransactionStatusDraft     TransactionStatus = "draft"
	TransactionStatusReady     TransactionStatus = "ready"
	TransactionStatusBilled    TransactionStatus = "billed"
	TransactionStatusPaid      TransactionStatus = "paid"
	TransactionStatusCompleted TransactionStatus = "completed"
	TransactionStatusCanceled  TransactionStatus = "canceled"
	TransactionStatusPastDue   TransactionStatus = "past_due"
)

type TransactionSubscriptionProductCreate

type TransactionSubscriptionProductCreate struct {
	// Name: Name of this product.
	Name string `json:"name,omitempty"`
	// Description: Short description for this product.
	Description *string `json:"description,omitempty"`
	// TaxCategory: Tax category for this product. Used for charging the correct rate of tax. Selected tax category must be enabled on your Paddle account.
	TaxCategory TaxCategory `json:"tax_category,omitempty"`
	// ImageURL: Image for this product. Included in the checkout and on some customer documents.
	ImageURL *string `json:"image_url,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData CustomData `json:"custom_data,omitempty"`
}

TransactionSubscriptionProductCreate: Product object for a non-catalog item to charge for.

type TransactionTotals

type TransactionTotals struct {
	// Subtotal: Subtotal before discount, tax, and deductions. If an item, unit price multiplied by quantity.
	Subtotal string `json:"subtotal,omitempty"`
	/*
	   Discount: Total discount as a result of any discounts applied.

	   Except for percentage discounts, Paddle applies tax to discounts based on the line item `price.tax_mode`. If `price.tax_mode` for a line item is `internal`, Paddle removes tax from the discount applied.
	*/
	Discount string `json:"discount,omitempty"`
	// Tax: Total tax on the subtotal.
	Tax string `json:"tax,omitempty"`
	// Total: Total after discount and tax.
	Total string `json:"total,omitempty"`
	// Credit: Total credit applied to this transaction. This includes credits applied using a customer's credit balance and adjustments to a `billed` transaction.
	Credit string `json:"credit,omitempty"`
	// CreditToBalance: Additional credit generated from negative `details.line_items`. This credit is added to the customer balance.
	CreditToBalance string `json:"credit_to_balance,omitempty"`
	// Balance: Total due on a transaction after credits and any payments.
	Balance string `json:"balance,omitempty"`
	// GrandTotal: Total due on a transaction after credits but before any payments.
	GrandTotal string `json:"grand_total,omitempty"`
	// Fee: Total fee taken by Paddle for this transaction. `null` until the transaction is `completed` and the fee is processed.
	Fee *string `json:"fee,omitempty"`
	// Earnings: Total earnings for this transaction. This is the total minus the Paddle fee. `null` until the transaction is `completed` and the fee is processed.
	Earnings *string `json:"earnings,omitempty"`
	// CurrencyCode: Three-letter ISO 4217 currency code of the currency used for this transaction.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
}

TransactionTotals: Breakdown of the total for a transaction. These numbers can become negative when dealing with subscription updates that result in credit.

type TransactionTotalsAdjusted

type TransactionTotalsAdjusted struct {
	// Subtotal: Subtotal before discount, tax, and deductions. If an item, unit price multiplied by quantity.
	Subtotal string `json:"subtotal,omitempty"`
	// Tax: Total tax on the subtotal.
	Tax string `json:"tax,omitempty"`
	// Total: Total after tax.
	Total string `json:"total,omitempty"`
	// GrandTotal: Total due after credits but before any payments.
	GrandTotal string `json:"grand_total,omitempty"`
	// Fee: Total fee taken by Paddle for this transaction. `null` until the transaction is `completed` and the fee is processed.
	Fee *string `json:"fee,omitempty"`
	/*
	   Earnings: Total earnings for this transaction. This is the total minus the Paddle fee.
	   `null` until the transaction is `completed` and the fee is processed.
	*/
	Earnings *string `json:"earnings,omitempty"`
	// CurrencyCode: Three-letter ISO 4217 currency code of the currency used for this transaction.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
}

TransactionTotalsAdjusted: Breakdown of the payout totals for a transaction after adjustments. `null` until the transaction is `completed`.

type TransactionUpdatedEvent added in v0.2.1

type TransactionUpdatedEvent struct {
	GenericEvent
	Data paddlenotification.TransactionNotification `json:"data"`
}

TransactionUpdatedEvent represents an Event implementation for transaction.updated event.

type TransactionsClient

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

TransactionsClient is a client for the Transactions resource.

func (*TransactionsClient) CreateTransaction

func (c *TransactionsClient) CreateTransaction(ctx context.Context, req *CreateTransactionRequest) (res *Transaction, err error)

CreateTransaction performs the POST operation on a Transactions resource.

func (*TransactionsClient) GetTransaction

func (c *TransactionsClient) GetTransaction(ctx context.Context, req *GetTransactionRequest) (res *Transaction, err error)

GetTransaction performs the GET operation on a Transactions resource.

func (*TransactionsClient) GetTransactionInvoice

func (c *TransactionsClient) GetTransactionInvoice(ctx context.Context, req *GetTransactionInvoiceRequest) (res *TransactionInvoicePDF, err error)

GetTransactionInvoice performs the GET operation on a Transactions resource.

func (*TransactionsClient) ListTransactions

func (c *TransactionsClient) ListTransactions(ctx context.Context, req *ListTransactionsRequest) (res *Collection[*Transaction], err error)

ListTransactions performs the GET operation on a Transactions resource.

func (*TransactionsClient) PreviewTransactionCreate added in v0.5.0

func (c *TransactionsClient) PreviewTransactionCreate(ctx context.Context, req *PreviewTransactionCreateRequest) (res *TransactionPreview, err error)

PreviewTransactionCreate performs the POST operation on a Transactions resource.

func (*TransactionsClient) UpdateTransaction

func (c *TransactionsClient) UpdateTransaction(ctx context.Context, req *UpdateTransactionRequest) (res *Transaction, err error)

UpdateTransaction performs the PATCH operation on a Transactions resource.

type TransactionsReportFilterName added in v0.7.0

type TransactionsReportFilterName string

TransactionsReportFilterName: Field name to filter by..

const (
	TransactionsReportFilterNameCollectionMode TransactionsReportFilterName = "collection_mode"
	TransactionsReportFilterNameCurrencyCode   TransactionsReportFilterName = "currency_code"
	TransactionsReportFilterNameOrigin         TransactionsReportFilterName = "origin"
	TransactionsReportFilterNameStatus         TransactionsReportFilterName = "status"
	TransactionsReportFilterNameUpdatedAt      TransactionsReportFilterName = "updated_at"
)

type TransactionsReportFilters added in v0.7.0

type TransactionsReportFilters struct {
	// Name: Field name to filter by.
	Name TransactionsReportFilterName `json:"name,omitempty"`
	// Operator: Operator to use when filtering. Valid when filtering by `updated_at`, `null` otherwise.
	Operator *FilterOperator `json:"operator,omitempty"`
	// Value: Value to filter by. Check the allowed values descriptions for the `name` field to see valid values for a field.
	Value any `json:"value,omitempty"`
}

TransactionsReportFilters: Filter criteria for this report. If omitted when creating, reports are filtered to include data updated in the last 30 days. This means `updated_at` is greater than or equal to (`gte`) the date 30 days ago from the time the report was generated.

type TransactionsReportType added in v0.7.0

type TransactionsReportType string

TransactionsReportType: Type of report to create..

const (
	TransactionsReportTypeTransactions         TransactionsReportType = "transactions"
	TransactionsReportTypeTransactionLineItems TransactionsReportType = "transaction_line_items"
)

type TransactionsReports

type TransactionsReports struct {
	// Type: Type of report to create.
	Type TransactionsReportType `json:"type,omitempty"`
	// Filters: Filter criteria for this report. If omitted when creating, reports are filtered to include data updated in the last 30 days. This means `updated_at` is greater than or equal to (`gte`) the date 30 days ago from the time the report was generated.
	Filters []TransactionsReportFilters `json:"filters,omitempty"`
}

TransactionsReports: Entity when working with reports for transaction or transaction line items.

type UnitPriceOverride

type UnitPriceOverride struct {
	// CountryCodes: Supported two-letter ISO 3166-1 alpha-2 country code.
	CountryCodes []CountryCode `json:"country_codes,omitempty"`
	// UnitPrice: Override price. This price applies to customers located in the countries for this unit price override.
	UnitPrice Money `json:"unit_price,omitempty"`
}

UnitPriceOverride: List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.

type UpdateAddressRequest

type UpdateAddressRequest struct {
	// URL path parameters.
	CustomerID string `in:"path=customer_id" json:"-"`
	AddressID  string `in:"path=address_id" json:"-"`

	// Description: Memorable description for this address.
	Description *PatchField[*string] `json:"description,omitempty"`
	// FirstLine: First line of this address.
	FirstLine *PatchField[*string] `json:"first_line,omitempty"`
	// SecondLine: Second line of this address.
	SecondLine *PatchField[*string] `json:"second_line,omitempty"`
	// City: City of this address.
	City *PatchField[*string] `json:"city,omitempty"`
	// PostalCode: ZIP or postal code of this address. Required for some countries.
	PostalCode *PatchField[*string] `json:"postal_code,omitempty"`
	// Region: State, county, or region of this address.
	Region *PatchField[*string] `json:"region,omitempty"`
	// CountryCode: Supported two-letter ISO 3166-1 alpha-2 country code for this address.
	CountryCode *PatchField[CountryCode] `json:"country_code,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData *PatchField[CustomData] `json:"custom_data,omitempty"`
	// Status: Whether this entity can be used in Paddle.
	Status *PatchField[Status] `json:"status,omitempty"`
}

UpdateAddressRequest is given as an input to UpdateAddress.

type UpdateBusinessRequest

type UpdateBusinessRequest struct {
	// URL path parameters.
	CustomerID string `in:"path=customer_id" json:"-"`
	BusinessID string `in:"path=business_id" json:"-"`

	// Name: Name of this business.
	Name *PatchField[string] `json:"name,omitempty"`
	// CompanyNumber: Company number for this business.
	CompanyNumber *PatchField[*string] `json:"company_number,omitempty"`
	// TaxIdentifier: Tax or VAT Number for this business.
	TaxIdentifier *PatchField[*string] `json:"tax_identifier,omitempty"`
	// Status: Whether this entity can be used in Paddle.
	Status *PatchField[Status] `json:"status,omitempty"`
	// Contacts: List of contacts related to this business, typically used for sending invoices.
	Contacts *PatchField[[]BusinessContacts] `json:"contacts,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData *PatchField[CustomData] `json:"custom_data,omitempty"`
}

UpdateBusinessRequest is given as an input to UpdateBusiness.

type UpdateCustomerRequest

type UpdateCustomerRequest struct {
	// URL path parameters.
	CustomerID string `in:"path=customer_id" json:"-"`

	// Name: Full name of this customer. Required when creating transactions where `collection_mode` is `manual` (invoices).
	Name *PatchField[*string] `json:"name,omitempty"`
	// Email: Email address for this customer.
	Email *PatchField[string] `json:"email,omitempty"`
	// Status: Whether this entity can be used in Paddle.
	Status *PatchField[Status] `json:"status,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData *PatchField[CustomData] `json:"custom_data,omitempty"`
	// Locale: Valid IETF BCP 47 short form locale tag.
	Locale *PatchField[string] `json:"locale,omitempty"`
}

UpdateCustomerRequest is given as an input to UpdateCustomer.

type UpdateDiscountRequest

type UpdateDiscountRequest struct {
	// URL path parameters.
	DiscountID string `in:"path=discount_id" json:"-"`

	// Status: Whether this entity can be used in Paddle. `expired` and `used` are set automatically by Paddle.
	Status *PatchField[DiscountStatus] `json:"status,omitempty"`
	// Description: Short description for this discount for your reference. Not shown to customers.
	Description *PatchField[string] `json:"description,omitempty"`
	// EnabledForCheckout: Whether this discount can be applied by customers at checkout.
	EnabledForCheckout *PatchField[bool] `json:"enabled_for_checkout,omitempty"`
	// Code: Unique code that customers can use to apply this discount at checkout.
	Code *PatchField[*string] `json:"code,omitempty"`
	// Type: Type of discount. Determines how this discount impacts the transaction total.
	Type *PatchField[DiscountType] `json:"type,omitempty"`
	// Amount: Amount to discount by. For `percentage` discounts, must be an amount between `0.01` and `100`. For `flat` and `flat_per_seat` discounts, amount in the lowest denomination for a currency.
	Amount *PatchField[string] `json:"amount,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code. Required where discount type is `flat` or `flat_per_seat`.
	CurrencyCode *PatchField[*CurrencyCode] `json:"currency_code,omitempty"`
	// Recur: Whether this discount applies for multiple subscription billing periods.
	Recur *PatchField[bool] `json:"recur,omitempty"`
	// MaximumRecurringIntervals: Amount of subscription billing periods that this discount recurs for. Requires `recur`. `null` if this discount recurs forever.
	MaximumRecurringIntervals *PatchField[*int] `json:"maximum_recurring_intervals,omitempty"`
	// UsageLimit: Maximum amount of times this discount can be used. This is an overall limit, rather than a per-customer limit. `null` if this discount can be used an unlimited amount of times.
	UsageLimit *PatchField[*int] `json:"usage_limit,omitempty"`
	// RestrictTo: Product or price IDs that this discount is for. When including a product ID, all prices for that product can be discounted. `null` if this discount applies to all products and prices.
	RestrictTo *PatchField[[]string] `json:"restrict_to,omitempty"`
	// ExpiresAt: RFC 3339 datetime string of when this discount expires. Discount can no longer be applied after this date has elapsed. `null` if this discount can be applied forever.
	ExpiresAt *PatchField[*string] `json:"expires_at,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData *PatchField[CustomData] `json:"custom_data,omitempty"`
}

UpdateDiscountRequest is given as an input to UpdateDiscount.

type UpdateNotificationSettingRequest

type UpdateNotificationSettingRequest struct {
	// URL path parameters.
	NotificationSettingID string `in:"path=notification_setting_id" json:"-"`

	// Description: Short description for this notification destination. Shown in the Paddle Dashboard.
	Description *PatchField[string] `json:"description,omitempty"`
	// Destination: Webhook endpoint URL or email address.
	Destination *PatchField[string] `json:"destination,omitempty"`
	// Active: Whether Paddle should try to deliver events to this notification destination.
	Active *PatchField[bool] `json:"active,omitempty"`
	// APIVersion: API version that returned objects for events should conform to. Must be a valid version of the Paddle API. Cannot be a version older than your account default. Defaults to your account default if omitted.
	APIVersion *PatchField[int] `json:"api_version,omitempty"`
	// IncludeSensitiveFields: Whether potentially sensitive fields should be sent to this notification destination.
	IncludeSensitiveFields *PatchField[bool] `json:"include_sensitive_fields,omitempty"`
	// SubscribedEvents: Type of event sent by Paddle, in the format `entity.event_type`.
	SubscribedEvents *PatchField[[]EventTypeName] `json:"subscribed_events,omitempty"`
}

UpdateNotificationSettingRequest is given as an input to UpdateNotificationSetting.

type UpdatePriceRequest

type UpdatePriceRequest struct {
	// URL path parameters.
	PriceID string `in:"path=price_id" json:"-"`

	// Description: Internal description for this price, not shown to customers. Typically notes for your team.
	Description *PatchField[string] `json:"description,omitempty"`
	// Type: Type of item. Standard items are considered part of your catalog and are shown on the Paddle web app.
	Type *PatchField[CatalogType] `json:"type,omitempty"`
	// Name: Name of this price, shown to customers at checkout and on invoices. Typically describes how often the related product bills.
	Name *PatchField[*string] `json:"name,omitempty"`
	// BillingCycle: How often this price should be charged. `null` if price is non-recurring (one-time).
	BillingCycle *PatchField[*Duration] `json:"billing_cycle,omitempty"`
	// TrialPeriod: Trial period for the product related to this price. The billing cycle begins once the trial period is over. `null` for no trial period. Requires `billing_cycle`.
	TrialPeriod *PatchField[*Duration] `json:"trial_period,omitempty"`
	// TaxMode: How tax is calculated for this price.
	TaxMode *PatchField[TaxMode] `json:"tax_mode,omitempty"`
	// UnitPrice: Base price. This price applies to all customers, except for customers located in countries where you have `unit_price_overrides`.
	UnitPrice *PatchField[Money] `json:"unit_price,omitempty"`
	// UnitPriceOverrides: List of unit price overrides. Use to override the base price with a custom price and currency for a country or group of countries.
	UnitPriceOverrides *PatchField[[]UnitPriceOverride] `json:"unit_price_overrides,omitempty"`
	// Quantity: Limits on how many times the related product can be purchased at this price. Useful for discount campaigns.
	Quantity *PatchField[PriceQuantity] `json:"quantity,omitempty"`
	// Status: Whether this entity can be used in Paddle.
	Status *PatchField[Status] `json:"status,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData *PatchField[CustomData] `json:"custom_data,omitempty"`
}

UpdatePriceRequest is given as an input to UpdatePrice.

type UpdateProductRequest

type UpdateProductRequest struct {
	// URL path parameters.
	ProductID string `in:"path=product_id" json:"-"`

	// Name: Name of this product.
	Name *PatchField[string] `json:"name,omitempty"`
	// Description: Short description for this product.
	Description *PatchField[*string] `json:"description,omitempty"`
	// Type: Type of item. Standard items are considered part of your catalog and are shown on the Paddle web app.
	Type *PatchField[CatalogType] `json:"type,omitempty"`
	// TaxCategory: Tax category for this product. Used for charging the correct rate of tax. Selected tax category must be enabled on your Paddle account.
	TaxCategory *PatchField[TaxCategory] `json:"tax_category,omitempty"`
	// ImageURL: Image for this product. Included in the checkout and on some customer documents.
	ImageURL *PatchField[*string] `json:"image_url,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData *PatchField[CustomData] `json:"custom_data,omitempty"`
	// Status: Whether this entity can be used in Paddle.
	Status *PatchField[Status] `json:"status,omitempty"`
}

UpdateProductRequest is given as an input to UpdateProduct.

type UpdateSubscriptionRequest

type UpdateSubscriptionRequest struct {
	// URL path parameters.
	SubscriptionID string `in:"path=subscription_id" json:"-"`

	// CustomerID: Paddle ID of the customer that this subscription is for, prefixed with `ctm_`. Include to change the customer for a subscription.
	CustomerID *PatchField[string] `json:"customer_id,omitempty"`
	// AddressID: Paddle ID of the address that this subscription is for, prefixed with `add_`. Include to change the address for a subscription.
	AddressID *PatchField[string] `json:"address_id,omitempty"`
	// BusinessID: Paddle ID of the business that this subscription is for, prefixed with `biz_`. Include to change the business for a subscription.
	BusinessID *PatchField[*string] `json:"business_id,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code. Include to change the currency that a subscription bills in. When changing `collection_mode` to `manual`, you may need to change currency code to `USD`, `EUR`, or `GBP`.
	CurrencyCode *PatchField[CurrencyCode] `json:"currency_code,omitempty"`
	// NextBilledAt: RFC 3339 datetime string of when this subscription is next scheduled to be billed. Include to change the next billing date.
	NextBilledAt *PatchField[string] `json:"next_billed_at,omitempty"`
	// Discount: Details of the discount applied to this subscription. Include to add a discount to a subscription. `null` to remove a discount.
	Discount *PatchField[*SubscriptionDiscountEffectiveFrom] `json:"discount,omitempty"`
	// CollectionMode: How payment is collected for transactions created for this subscription. `automatic` for checkout, `manual` for invoices.
	CollectionMode *PatchField[CollectionMode] `json:"collection_mode,omitempty"`
	// BillingDetails: Details for invoicing. Required if `collection_mode` is `manual`. `null` if changing `collection_mode` to `automatic`.
	BillingDetails *PatchField[*BillingDetailsUpdate] `json:"billing_details,omitempty"`
	// ScheduledChange: Change that's scheduled to be applied to a subscription. When updating, you may only set to `null` to remove a scheduled change. Use the pause subscription, cancel subscription, and resume subscription operations to create scheduled changes.
	ScheduledChange *PatchField[*SubscriptionScheduledChange] `json:"scheduled_change,omitempty"`
	// Items: Add or update a catalog item to a subscription. In this case, the product and price that you're billing for exist in your product catalog in Paddle.
	Items *PatchField[[]SubscriptionUpdateCatalogItem] `json:"items,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData *PatchField[CustomData] `json:"custom_data,omitempty"`
	/*
	   ProrationBillingMode: How Paddle should handle proration calculation for changes made to a subscription or its items. Required when making
	   changes that impact billing.

	   For automatically-collected subscriptions, responses may take longer than usual if a proration billing mode that
	   collects for payment immediately is used.
	*/
	ProrationBillingMode *PatchField[ProrationBillingMode] `json:"proration_billing_mode,omitempty"`
	// OnPaymentFailure: How Paddle should handle changes made to a subscription or its items if the payment fails during update. If omitted, defaults to `prevent_change`.
	OnPaymentFailure *PatchField[SubscriptionOnPaymentFailure] `json:"on_payment_failure,omitempty"`
}

UpdateSubscriptionRequest is given as an input to UpdateSubscription.

type UpdateSummaryResult added in v0.5.0

type UpdateSummaryResult struct {
	// Action: Whether the subscription change results in a prorated credit or a charge.
	Action UpdateSummaryResultAction `json:"action,omitempty"`
	// Amount: Amount representing the result of this update, either a charge or a credit.
	Amount string `json:"amount,omitempty"`
	// CurrencyCode: Three-letter ISO 4217 currency code for the transaction or adjustment.
	CurrencyCode CurrencyCode `json:"currency_code,omitempty"`
}

UpdateSummaryResult: Details of the result of credits and charges. Where the total of any credit adjustments is greater than the total charge, the result is a prorated credit; otherwise, the result is a prorated charge.

type UpdateSummaryResultAction added in v0.5.0

type UpdateSummaryResultAction string

UpdateSummaryResultAction: Whether the subscription change results in a prorated credit or a charge..

const (
	UpdateSummaryResultActionCredit UpdateSummaryResultAction = "credit"
	UpdateSummaryResultActionCharge UpdateSummaryResultAction = "charge"
)

type UpdateTransactionItems

UpdateTransactionItems represents a union request type of the following types:

  • `CatalogItem`
  • `NonCatalogPriceForAnExistingProduct`
  • `NonCatalogPriceAndProduct`

The following constructor functions can be used to create a new instance of this type.

  • `NewUpdateTransactionItemsCatalogItem()`
  • `NewUpdateTransactionItemsNonCatalogPriceForAnExistingProduct()`
  • `NewUpdateTransactionItemsNonCatalogPriceAndProduct()`

Only one of the values can be set at a time, the first non-nil value will be used in the request. Items: Add a non-catalog price for a non-catalog product in your catalog to a transaction. In this case, the product and price that you're billing for are specific to this transaction.

func NewUpdateTransactionItemsCatalogItem

func NewUpdateTransactionItemsCatalogItem(r *CatalogItem) *UpdateTransactionItems

NewUpdateTransactionItemsCatalogItem takes a CatalogItem type and creates a UpdateTransactionItems for use in a request.

func NewUpdateTransactionItemsNonCatalogPriceAndProduct

func NewUpdateTransactionItemsNonCatalogPriceAndProduct(r *NonCatalogPriceAndProduct) *UpdateTransactionItems

NewUpdateTransactionItemsNonCatalogPriceAndProduct takes a NonCatalogPriceAndProduct type and creates a UpdateTransactionItems for use in a request.

func NewUpdateTransactionItemsNonCatalogPriceForAnExistingProduct

func NewUpdateTransactionItemsNonCatalogPriceForAnExistingProduct(r *NonCatalogPriceForAnExistingProduct) *UpdateTransactionItems

NewUpdateTransactionItemsNonCatalogPriceForAnExistingProduct takes a NonCatalogPriceForAnExistingProduct type and creates a UpdateTransactionItems for use in a request.

func (UpdateTransactionItems) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface.

type UpdateTransactionRequest

type UpdateTransactionRequest struct {
	// URL path parameters.
	TransactionID string `in:"path=transaction_id" json:"-"`

	/*
	   Status: Status of this transaction. You may set a transaction to `billed` or `canceled`. Billed transactions cannot be changed.

	   For manually-collected transactions, marking as `billed` is essentially issuing an invoice.
	*/
	Status *PatchField[TransactionStatus] `json:"status,omitempty"`
	// CustomerID: Paddle ID of the customer that this transaction is for, prefixed with `ctm_`.
	CustomerID *PatchField[*string] `json:"customer_id,omitempty"`
	// AddressID: Paddle ID of the address that this transaction is for, prefixed with `add_`.
	AddressID *PatchField[*string] `json:"address_id,omitempty"`
	// BusinessID: Paddle ID of the business that this transaction is for, prefixed with `biz_`.
	BusinessID *PatchField[*string] `json:"business_id,omitempty"`
	// CustomData: Your own structured key-value data.
	CustomData *PatchField[CustomData] `json:"custom_data,omitempty"`
	// CurrencyCode: Supported three-letter ISO 4217 currency code. Must be `USD`, `EUR`, or `GBP` if `collection_mode` is `manual`.
	CurrencyCode *PatchField[CurrencyCode] `json:"currency_code,omitempty"`
	// CollectionMode: How payment is collected for this transaction. `automatic` for checkout, `manual` for invoices.
	CollectionMode *PatchField[CollectionMode] `json:"collection_mode,omitempty"`
	// DiscountID: Paddle ID of the discount applied to this transaction, prefixed with `dsc_`.
	DiscountID *PatchField[*string] `json:"discount_id,omitempty"`
	// BillingDetails: Details for invoicing. Required if `collection_mode` is `manual`.
	BillingDetails *PatchField[*BillingDetailsUpdate] `json:"billing_details,omitempty"`
	// BillingPeriod: Time period that this transaction is for. Set automatically by Paddle for subscription renewals to describe the period that charges are for.
	BillingPeriod *PatchField[*TimePeriod] `json:"billing_period,omitempty"`
	// Items: Add a non-catalog price for a non-catalog product in your catalog to a transaction. In this case, the product and price that you're billing for are specific to this transaction.
	Items *PatchField[[]UpdateTransactionItems] `json:"items,omitempty"`
	// Checkout: Paddle Checkout details for this transaction. You may pass a URL when creating or updating an automatically-collected transaction, or when creating or updating a manually-collected transaction where `billing_details.enable_checkout` is `true`.
	Checkout *PatchField[*TransactionCheckout] `json:"checkout,omitempty"`

	// IncludeAddress allows requesting the address sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAddress bool `in:"paddle_include=address" json:"-"`

	// IncludeAdjustments allows requesting the adjustment sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAdjustments bool `in:"paddle_include=adjustment" json:"-"`

	// IncludeAdjustmentsTotals allows requesting the adjustments_totals sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAdjustmentsTotals bool `in:"paddle_include=adjustments_totals" json:"-"`

	// IncludeAvailablePaymentMethods allows requesting the available_payment_methods sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeAvailablePaymentMethods bool `in:"paddle_include=available_payment_methods" json:"-"`

	// IncludeBusiness allows requesting the business sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeBusiness bool `in:"paddle_include=business" json:"-"`

	// IncludeCustomer allows requesting the customer sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeCustomer bool `in:"paddle_include=customer" json:"-"`

	// IncludeDiscount allows requesting the discount sub-resource as part of this request.
	// If set to true, will be included on the response.
	IncludeDiscount bool `in:"paddle_include=discount" json:"-"`
}

UpdateTransactionRequest is given as an input to UpdateTransaction.

type WebhookVerifier

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

WebhookVerifier is used to verify webhook requests from Paddle.

func NewWebhookVerifier

func NewWebhookVerifier(secretKey string) *WebhookVerifier

NewWebhookVerifier creates a new WebhookVerifier with the given secret key.

func (*WebhookVerifier) Middleware

func (wv *WebhookVerifier) Middleware(next http.Handler) http.Handler

Middleware returns a middleware that verifies the signature of a webhook request.

Example

Demonstrates how to use the WebhookVerifier as a middleware.

package main

import (
	"fmt"
	"io"
	"net/http"
	"net/http/httptest"
	"strings"

	paddle "github.com/PaddleHQ/paddle-go-sdk"
)

const (
	exampleSignature = `ts=1710929255;h1=6c05ef8fa83c44d751be6d259ec955ce5638e2c54095bf128e408e2fce1589c8`
	examplePayload   = `{"data":{"id":"pri_01hsdn96k2hxjzsq5yerecdj9j","name":null,"status":"active","quantity":{"maximum":999999,"minimum":1},"tax_mode":"account_setting","product_id":"pro_01hsdn8qp7yydry3x1yeg6a9rv","unit_price":{"amount":"1000","currency_code":"USD"},"custom_data":null,"description":"testing","import_meta":null,"trial_period":null,"billing_cycle":{"interval":"month","frequency":1},"unit_price_overrides":[]},"event_id":"evt_01hsdn97563968dy0szkmgjwh3","event_type":"price.created","occurred_at":"2024-03-20T10:07:35.590857Z","notification_id":"ntf_01hsdn977e920kbgzt6r6c9rqc"}`
	exampleSecretKey = `pdl_ntfset_01hsdn8d43dt7mezr1ef2jtbaw_hKkRiCGyyRhbFwIUuqiTBgI7gnWoV0Gr`
)

func main() {
	// Create a WebhookVerifier with your secret key
	// You should keep your secret outside the src, e.g. as an env variable
	verifier := paddle.NewWebhookVerifier(exampleSecretKey)

	// Wrap your handler with the verifier.Middleware method
	handler := verifier.Middleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		// The request making it this far means the webhook was verified
		// Best practice here is to check if you have processed this webhook already using the event id
		// At this point you should store for async processing
		// For example a local queue or db entry

		// Respond as soon as possible with a 200 OK
		w.Header().Set("Content-Type", "application/json")
		w.WriteHeader(http.StatusOK)
		w.Write([]byte(`{"success": true}`))
	}))

	// We're simulating a call to the server, everything below can be skipped in your implementation

	req, err := http.NewRequest(http.MethodPost, "localhost:8081", strings.NewReader(examplePayload))
	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Set("Paddle-Signature", exampleSignature)

	rr := httptest.NewRecorder()
	handler.ServeHTTP(rr, req)

	body, err := io.ReadAll(rr.Body)
	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(string(body), err)
}
Output:

{"success": true} <nil>

func (*WebhookVerifier) Verify

func (wv *WebhookVerifier) Verify(req *http.Request) (bool, error)

Verify verifies the signature of a webhook request.

Example

Demonstrates how to verify a webhook.

package main

import (
	"errors"
	"fmt"
	"io"
	"net/http"
	"net/http/httptest"
	"strings"

	paddle "github.com/PaddleHQ/paddle-go-sdk"
)

const (
	exampleSignature = `ts=1710929255;h1=6c05ef8fa83c44d751be6d259ec955ce5638e2c54095bf128e408e2fce1589c8`
	examplePayload   = `{"data":{"id":"pri_01hsdn96k2hxjzsq5yerecdj9j","name":null,"status":"active","quantity":{"maximum":999999,"minimum":1},"tax_mode":"account_setting","product_id":"pro_01hsdn8qp7yydry3x1yeg6a9rv","unit_price":{"amount":"1000","currency_code":"USD"},"custom_data":null,"description":"testing","import_meta":null,"trial_period":null,"billing_cycle":{"interval":"month","frequency":1},"unit_price_overrides":[]},"event_id":"evt_01hsdn97563968dy0szkmgjwh3","event_type":"price.created","occurred_at":"2024-03-20T10:07:35.590857Z","notification_id":"ntf_01hsdn977e920kbgzt6r6c9rqc"}`
	exampleSecretKey = `pdl_ntfset_01hsdn8d43dt7mezr1ef2jtbaw_hKkRiCGyyRhbFwIUuqiTBgI7gnWoV0Gr`
)

func main() {
	// Create a WebhookVerifier with your secret key
	// You should keep your secret outside the src, e.g. as an env variable
	verifier := paddle.NewWebhookVerifier(exampleSecretKey)

	// Create a server to receive the webhook
	// Note: you may have this in place already
	s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		// Verify the request with the verifier
		ok, err := verifier.Verify(r)

		// Check no error occurred during verification and return an appropriate response
		if err != nil && (errors.Is(err, paddle.ErrMissingSignature) || errors.Is(err, paddle.ErrInvalidSignatureFormat)) {
			http.Error(w, err.Error(), http.StatusBadRequest)
			return
		} else if err != nil {
			http.Error(w, err.Error(), http.StatusInternalServerError)
			return
		}

		// Check if verification was successful
		if !ok {
			// Return an appropriate response to let Paddle know
			http.Error(w, "signature mismatch", http.StatusForbidden)
			return
		}

		// Best practice here is to check if you have processed this webhook already using the event id
		// At this point you should store for async processing
		// For example a local queue or db entry

		// Respond as soon as possible with a 200 OK
		w.Header().Set("Content-Type", "application/json")
		w.WriteHeader(http.StatusOK)
		w.Write([]byte(`{"success": true}`))
	}))

	// We're simulating a call to the server, everything below can be skipped in your implementation

	req, err := http.NewRequest(http.MethodPost, s.URL, strings.NewReader(examplePayload))
	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Set("Paddle-Signature", exampleSignature)

	client := http.Client{}
	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}

	body, err := io.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}

	defer res.Body.Close()

	fmt.Println(string(body), err)
}
Output:

{"success": true} <nil>

Directories

Path Synopsis
internal
client
Package client provides the base for all requests and responses to the Paddle API.
Package client provides the base for all requests and responses to the Paddle API.
response
Package response provides the response handling logic for responses and any errors returned by the Paddle API.
Package response provides the response handling logic for responses and any errors returned by the Paddle API.
pkg

Jump to

Keyboard shortcuts

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