stripe

package
v1.36.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

func MapWebhookEventType added in v1.34.0

func MapWebhookEventType(stripeType string) string

MapWebhookEventType converts a Stripe webhook event type to a Commerce billing event type. Unknown types are returned as-is.

func PaymentToCard

func PaymentToCard(pay *payment.Payment) *stripe.CardParams

Covert a payment model into a card card we can use for authorization

func StripeSupportedCurrencies

func StripeSupportedCurrencies() []currency.Type

StripeSupportedCurrencies returns all currencies Stripe supports

func SubscriptionToCard

func SubscriptionToCard(sub *subscription.Subscription) *stripe.CardParams

func SyncDispute added in v1.34.0

func SyncDispute(dst *dispute.Dispute, src *sgo.Dispute)

SyncDispute maps a Stripe Dispute to a Commerce Dispute.

func SyncPaymentIntent added in v1.34.0

func SyncPaymentIntent(dst *paymentintent.PaymentIntent, src *sgo.PaymentIntent)

SyncPaymentIntent maps a Stripe PaymentIntent to a Commerce PaymentIntent.

func SyncPaymentMethod added in v1.34.0

func SyncPaymentMethod(dst *paymentmethod.PaymentMethod, src *sgo.PaymentMethod)

SyncPaymentMethod maps a Stripe PaymentMethod to a Commerce PaymentMethod.

func SyncRefund added in v1.34.0

func SyncRefund(dst *refund.Refund, src *sgo.Refund)

SyncRefund maps a Stripe Refund to a Commerce Refund.

func SyncSetupIntent added in v1.34.0

func SyncSetupIntent(dst *setupintent.SetupIntent, src *sgo.SetupIntent)

SyncSetupIntent maps a Stripe SetupIntent to a Commerce SetupIntent.

func UpdatePayoutFromStripe

func UpdatePayoutFromStripe(tr *transfer.Transfer, str *Payout)

func UpdateTransferFromStripe

func UpdateTransferFromStripe(tr *transfer.Transfer, str *Transfer)

Update transfer from Stripe

Types

type Card

type Card _stripe.Card

type CardParams

type CardParams _stripe.CardParams

type Charge

type Charge _stripe.Charge

type ChargeListParams

type ChargeListParams _stripe.ChargeListParams

type ChargeParams

type ChargeParams _stripe.ChargeParams

type Client

type Client struct {
	*client.API
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, accessToken string) *Client

func (Client) Authorize

func (c Client) Authorize(pay *payment.Payment) (*Token, error)

Do authorization, return token

func (Client) AuthorizeSubscription

func (c Client) AuthorizeSubscription(sub *subscription.Subscription) (*Token, error)

func (Client) CancelSubscription

func (c Client) CancelSubscription(sub *subscription.Subscription) (*Subscription, error)

Subscribe to a plan

func (Client) Capture

func (c Client) Capture(chargeId string) (*Charge, error)

Capture charge

func (Client) DeleteCard

func (c Client) DeleteCard(cardId string, usr *user.User) (*Card, error)

Update card associated with Stripe customer

func (Client) GetCard

func (c Client) GetCard(cardId string, customerId string) (*Card, error)

Get an exising Stripe card

func (Client) GetCharge

func (c Client) GetCharge(chargeId string) (*Charge, error)

func (Client) GetCustomer

func (c Client) GetCustomer(token string, usr *user.User) (*Customer, error)

Get Stripe customer

func (Client) NewCard

func (c Client) NewCard(token string, usr *user.User) (*Card, error)

func (Client) NewCharge

func (c Client) NewCharge(source interface{}, pay *payment.Payment) (*Charge, error)

Create new charge

func (Client) NewCustomer

func (c Client) NewCustomer(token string, user *user.User) (*Customer, error)

func (Client) NewPlan

func (c Client) NewPlan(p *plan.Plan) (*Plan, error)

Add new subscription to Stripe

func (Client) NewSubscription

func (c Client) NewSubscription(source interface{}, sub *subscription.Subscription) (*Subscription, error)

func (Client) Payout

func (c Client) Payout(tr *transfer.Transfer) (*Payout, error)

func (Client) RefundPayment

func (c Client) RefundPayment(pay *payment.Payment, refundAmount currency.Cents) (*payment.Payment, error)

Attempts to refund payment and updates the payment in datastore

func (Client) Transfer

func (c Client) Transfer(tr *transfer.Transfer) (*Transfer, error)

func (Client) UpdateCard

func (c Client) UpdateCard(token string, usr *user.User) (*Card, error)

Update card associated with Stripe customer

func (Client) UpdateCharge

func (c Client) UpdateCharge(pay *payment.Payment) (*Charge, error)

Update Stripe charge

func (Client) UpdateCustomer

func (c Client) UpdateCustomer(usr *user.User) (*Customer, error)

Update Stripe customer

func (Client) UpdatePlan

func (c Client) UpdatePlan(p *plan.Plan) (*Plan, error)

func (Client) UpdateSubscription

func (c Client) UpdateSubscription(sub *subscription.Subscription) (*Subscription, error)

type Customer

type Customer _stripe.Customer

type Dispute

type Dispute _stripe.Dispute

type Event

type Event struct {
	ID       string             `json:"id"`
	Account  string             `json:"account"`
	Live     bool               `json:"livemode"`
	Created  int64              `json:"created"`
	Data     *_stripe.EventData `json:"data"`
	Webhooks uint64             `json:"pending_webhooks"`
	Type     string             `json:"type"`
	Request  string             `json:"request"`
}

type Payout

type Payout _stripe.Payout

type Plan

type Plan _stripe.Plan

type PlanList

type PlanList _stripe.PlanList

type PlanListParams

type PlanListParams _stripe.PlanListParams

type PlanParams

type PlanParams _stripe.PlanParams

type Reversal

type Reversal _stripe.TransferReversal

type StripeProcessor

type StripeProcessor struct {
	*processor.BaseProcessor
	// contains filtered or unexported fields
}

StripeProcessor implements the processor.PaymentProcessor interface

func NewProcessor

func NewProcessor(accessToken, webhookSecret string) *StripeProcessor

NewProcessor creates a new Stripe processor

func (*StripeProcessor) AttachPaymentMethod added in v1.34.0

func (sp *StripeProcessor) AttachPaymentMethod(ctx context.Context, paymentMethodID, customerID string) error

AttachPaymentMethod attaches a payment method to a customer.

func (*StripeProcessor) Authorize

Authorize authorizes a payment without capturing

func (*StripeProcessor) AuthorizeViaIntent added in v1.34.0

func (sp *StripeProcessor) AuthorizeViaIntent(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)

AuthorizeViaIntent creates a PaymentIntent with manual capture so funds are held but not collected until CaptureIntent is called.

func (*StripeProcessor) Capture

func (sp *StripeProcessor) Capture(ctx context.Context, transactionID string, amount currency.Cents) (*processor.PaymentResult, error)

Capture captures a previously authorized payment

func (*StripeProcessor) CaptureIntent added in v1.34.0

func (sp *StripeProcessor) CaptureIntent(ctx context.Context, intentID string, amount currency.Cents) (*processor.PaymentResult, error)

CaptureIntent captures a previously authorized PaymentIntent.

func (*StripeProcessor) Charge

Charge processes a payment

func (*StripeProcessor) ChargeViaIntent added in v1.34.0

ChargeViaIntent creates a PaymentIntent, confirms it immediately with automatic capture, and returns the result.

func (*StripeProcessor) ConfirmSetupIntent added in v1.34.0

func (sp *StripeProcessor) ConfirmSetupIntent(ctx context.Context, setupIntentID, paymentMethodID string) error

ConfirmSetupIntent confirms a SetupIntent with a payment method.

func (*StripeProcessor) CreateCustomer added in v1.34.0

func (sp *StripeProcessor) CreateCustomer(ctx context.Context, email, name string, metadata map[string]interface{}) (string, error)

CreateCustomer creates a Stripe customer and returns the customer ID.

func (*StripeProcessor) CreateSetupIntent added in v1.34.0

func (sp *StripeProcessor) CreateSetupIntent(ctx context.Context, customerID string, usage string) (string, string, error)

CreateSetupIntent creates a SetupIntent for saving a payment method without charging the customer. Returns (setupIntentID, clientSecret, error).

func (*StripeProcessor) DeleteCustomer added in v1.34.0

func (sp *StripeProcessor) DeleteCustomer(ctx context.Context, customerID string) error

DeleteCustomer permanently deletes a Stripe customer.

func (*StripeProcessor) DetachPaymentMethod added in v1.34.0

func (sp *StripeProcessor) DetachPaymentMethod(ctx context.Context, paymentMethodID string) error

DetachPaymentMethod detaches a payment method from its customer.

func (*StripeProcessor) GetTransaction

func (sp *StripeProcessor) GetTransaction(ctx context.Context, txID string) (*processor.Transaction, error)

GetTransaction retrieves transaction details

func (*StripeProcessor) IsAvailable

func (sp *StripeProcessor) IsAvailable(ctx context.Context) bool

IsAvailable checks if the processor is configured and available

func (*StripeProcessor) Refund

Refund processes a refund

func (*StripeProcessor) Type

Type returns the processor type

func (*StripeProcessor) UpdateCustomer added in v1.34.0

func (sp *StripeProcessor) UpdateCustomer(ctx context.Context, customerID string, updates map[string]interface{}) error

UpdateCustomer updates a Stripe customer's details.

func (*StripeProcessor) ValidateWebhook

func (sp *StripeProcessor) ValidateWebhook(ctx context.Context, payload []byte, signature string) (*processor.WebhookEvent, error)

ValidateWebhook validates an incoming webhook

type StripeSubscriptionProcessor

type StripeSubscriptionProcessor struct {
	*StripeProcessor
}

StripeSubscriptionProcessor extends StripeProcessor with subscription support

func NewSubscriptionProcessor

func NewSubscriptionProcessor(accessToken, webhookSecret string) *StripeSubscriptionProcessor

NewSubscriptionProcessor creates a processor with subscription support

func (*StripeSubscriptionProcessor) CancelSubscription

func (sp *StripeSubscriptionProcessor) CancelSubscription(ctx context.Context, subscriptionID string, immediately bool) error

CancelSubscription cancels a subscription

func (*StripeSubscriptionProcessor) CreateSubscription

CreateSubscription creates a recurring subscription

func (*StripeSubscriptionProcessor) GetSubscription

func (sp *StripeSubscriptionProcessor) GetSubscription(ctx context.Context, subscriptionID string) (*processor.Subscription, error)

GetSubscription retrieves subscription details

func (*StripeSubscriptionProcessor) ListSubscriptions

func (sp *StripeSubscriptionProcessor) ListSubscriptions(ctx context.Context, customerID string) ([]*processor.Subscription, error)

ListSubscriptions lists subscriptions for a customer

func (*StripeSubscriptionProcessor) UpdateSubscription

func (sp *StripeSubscriptionProcessor) UpdateSubscription(ctx context.Context, subscriptionID string, req processor.SubscriptionUpdate) (*processor.Subscription, error)

UpdateSubscription modifies a subscription

type Subscription

type Subscription _stripe.Subscription

type Token

type Token _stripe.Token

type Transfer

type Transfer _stripe.Transfer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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