creem

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package creem is the Creem payment provider adapter. Every checkout uses one Creem product with a custom price that the server computes. Webhooks are verified with the HMAC-SHA256 signature Creem sends in the creem-signature header.

Index

Constants

View Source
const DefaultCheckoutOrigin = "https://www.creem.io"

DefaultCheckoutOrigin is where Creem hosts live checkout pages unless the store uses its own domain.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// APIKey is a Creem API key. A key starting with creem_test_ uses Creem's test API.
	APIKey string
	// WebhookSecret verifies webhook signatures.
	WebhookSecret string
	// ProductID is the one-time product every checkout uses, with a custom price.
	ProductID string
	// CheckoutOrigin is where live checkout pages are hosted. Zero means
	// DefaultCheckoutOrigin; set it when the store uses a custom domain. A test key's
	// checkouts are always on Creem's own domain.
	CheckoutOrigin string
	// APIURL overrides the API base URL. Zero picks Creem's live or test API from the
	// key.
	APIURL string
}

Config configures the adapter.

type Creem

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

Creem implements payments.Provider for Creem.

func New

func New(cfg Config) (*Creem, error)

New validates cfg and returns the adapter. It does not contact Creem.

func (*Creem) CheckoutOrigin

func (c *Creem) CheckoutOrigin() string

CheckoutOrigin returns the origin of hosted checkout pages.

func (*Creem) CreateCheckout

func (c *Creem) CreateCheckout(ctx context.Context, co payments.Checkout) (payments.Session, error)

CreateCheckout creates a checkout for the configured product at the given price. The reference travels as the request ID and as the intent_id metadata, and comes back in webhooks.

func (*Creem) Name

func (c *Creem) Name() string

Name returns "creem".

func (*Creem) ParseWebhook

func (c *Creem) ParseWebhook(header http.Header, body []byte) (payments.Event, error)

ParseWebhook verifies and decodes a Creem webhook.

Jump to

Keyboard shortcuts

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