checkoutsessionep

package
v1.4.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckoutSessionResponse

type CheckoutSessionResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=checkout_session"`
	// Client secret for the Stripe embedded checkout session.
	//
	// Pass this to Stripe.js to mount the embedded checkout form.
	CheckoutSessionClientSecret string `json:"checkout_session_client_secret" validate:"required,max=255" sensitive:"true"` // #nosec G117 - Struct field, not a hardcoded credential
}

Result of creating a customer checkout session.

func (*CheckoutSessionResponse) SchemaExample

func (*CheckoutSessionResponse) SchemaExample() any

type CheckoutSessionSvc

type CheckoutSessionSvc interface {
	CreateCheckoutSession(ctx context.Context, req *CreateCheckoutSessionRequest) (*CheckoutSessionResponse, *apierror.APIError)
}

func NewCheckoutSessionSvc

func NewCheckoutSessionSvc(config *CheckoutSessionSvcConfig) CheckoutSessionSvc

type CheckoutSessionSvcConfig

type CheckoutSessionSvcConfig struct {
	// CoreSalesClient (required) is the core-service sales gRPC client.
	CoreSalesClient pb.CoreSalesServiceClient
}

type CreateCheckoutSessionEndpoint

type CreateCheckoutSessionEndpoint struct{}

Creates an embedded Stripe checkout session for paying a sales order and returns a client secret for use with Stripe.js.

The session is created on the target account's own Stripe integration, so the caller must be a customer user of that account and the account's Stripe integration must be connected and active. On a customer's first checkout, a Stripe customer record is created for them on that integration and reused afterwards. Payment is confirmed asynchronously: Stripe reports the completed payment back through the account's webhook, which links it to the order.

type CreateCheckoutSessionRequest

type CreateCheckoutSessionRequest struct {
	// ID of the sales order to collect payment for.
	//
	// It is recorded on the Stripe session so that the resulting payment is linked back to this order once Stripe reports it as succeeded.
	OrderID string `json:"order_id" validate:"required"`
	// Human-readable order number shown to the customer during checkout.
	//
	// Appears in the name of the single line item on the Stripe payment form, prefixed with `SO #`.
	OrderNumber string `json:"order_number" validate:"required,max=255"`
	// Amount to charge the customer, in cents.
	//
	// Billed in US dollars as one line item covering the whole order.
	OrderTotalCents int64 `json:"order_total_cents" validate:"required"`
	// Customer purchase order (PO) number to associate with the payment.
	//
	// Appears as the description of the checkout line item, prefixed with `PO #`.
	CustomerPO field.Optional[string] `json:"customer_po,omitzero" validate:"omitempty,max=255"`
}

Request to create a customer checkout session.

func (*CreateCheckoutSessionRequest) SchemaExample

func (*CreateCheckoutSessionRequest) SchemaExample() any

Jump to

Keyboard shortcuts

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