Documentation
¶
Index ¶
- Constants
- func MapWebhookEventType(stripeType string) string
- func PaymentToCard(pay *payment.Payment) *stripe.CardParams
- func StripeSupportedCurrencies() []currency.Type
- func SubscriptionToCard(sub *subscription.Subscription) *stripe.CardParams
- func SyncDispute(dst *dispute.Dispute, src *sgo.Dispute)
- func SyncPaymentIntent(dst *paymentintent.PaymentIntent, src *sgo.PaymentIntent)
- func SyncPaymentMethod(dst *paymentmethod.PaymentMethod, src *sgo.PaymentMethod)
- func SyncRefund(dst *refund.Refund, src *sgo.Refund)
- func SyncSetupIntent(dst *setupintent.SetupIntent, src *sgo.SetupIntent)
- func UpdatePayoutFromStripe(tr *transfer.Transfer, str *Payout)
- func UpdateTransferFromStripe(tr *transfer.Transfer, str *Transfer)
- type Card
- type CardParams
- type Charge
- type ChargeListParams
- type ChargeParams
- type Client
- func (c Client) Authorize(pay *payment.Payment) (*Token, error)
- func (c Client) AuthorizeSubscription(sub *subscription.Subscription) (*Token, error)
- func (c Client) CancelSubscription(sub *subscription.Subscription) (*Subscription, error)
- func (c Client) Capture(chargeId string) (*Charge, error)
- func (c Client) DeleteCard(cardId string, usr *user.User) (*Card, error)
- func (c Client) GetCard(cardId string, customerId string) (*Card, error)
- func (c Client) GetCharge(chargeId string) (*Charge, error)
- func (c Client) GetCustomer(token string, usr *user.User) (*Customer, error)
- func (c Client) NewCard(token string, usr *user.User) (*Card, error)
- func (c Client) NewCharge(source interface{}, pay *payment.Payment) (*Charge, error)
- func (c Client) NewCustomer(token string, user *user.User) (*Customer, error)
- func (c Client) NewPlan(p *plan.Plan) (*Plan, error)
- func (c Client) NewSubscription(source interface{}, sub *subscription.Subscription) (*Subscription, error)
- func (c Client) Payout(tr *transfer.Transfer) (*Payout, error)
- func (c Client) RefundPayment(pay *payment.Payment, refundAmount currency.Cents) (*payment.Payment, error)
- func (c Client) Transfer(tr *transfer.Transfer) (*Transfer, error)
- func (c Client) UpdateCard(token string, usr *user.User) (*Card, error)
- func (c Client) UpdateCharge(pay *payment.Payment) (*Charge, error)
- func (c Client) UpdateCustomer(usr *user.User) (*Customer, error)
- func (c Client) UpdatePlan(p *plan.Plan) (*Plan, error)
- func (c Client) UpdateSubscription(sub *subscription.Subscription) (*Subscription, error)
- type Customer
- type Dispute
- type Event
- type Payout
- type Plan
- type PlanList
- type PlanListParams
- type PlanParams
- type Reversal
- type StripeProcessor
- func (sp *StripeProcessor) AttachPaymentMethod(ctx context.Context, paymentMethodID, customerID string) error
- func (sp *StripeProcessor) Authorize(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
- func (sp *StripeProcessor) AuthorizeViaIntent(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
- func (sp *StripeProcessor) Capture(ctx context.Context, transactionID string, amount currency.Cents) (*processor.PaymentResult, error)
- func (sp *StripeProcessor) CaptureIntent(ctx context.Context, intentID string, amount currency.Cents) (*processor.PaymentResult, error)
- func (sp *StripeProcessor) Charge(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
- func (sp *StripeProcessor) ChargeViaIntent(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
- func (sp *StripeProcessor) ConfirmSetupIntent(ctx context.Context, setupIntentID, paymentMethodID string) error
- func (sp *StripeProcessor) CreateCustomer(ctx context.Context, email, name string, metadata map[string]interface{}) (string, error)
- func (sp *StripeProcessor) CreateSetupIntent(ctx context.Context, customerID string, usage string) (string, string, error)
- func (sp *StripeProcessor) DeleteCustomer(ctx context.Context, customerID string) error
- func (sp *StripeProcessor) DetachPaymentMethod(ctx context.Context, paymentMethodID string) error
- func (sp *StripeProcessor) GetTransaction(ctx context.Context, txID string) (*processor.Transaction, error)
- func (sp *StripeProcessor) IsAvailable(ctx context.Context) bool
- func (sp *StripeProcessor) Refund(ctx context.Context, req processor.RefundRequest) (*processor.RefundResult, error)
- func (sp *StripeProcessor) Type() processor.ProcessorType
- func (sp *StripeProcessor) UpdateCustomer(ctx context.Context, customerID string, updates map[string]interface{}) error
- func (sp *StripeProcessor) ValidateWebhook(ctx context.Context, payload []byte, signature string) (*processor.WebhookEvent, error)
- type StripeSubscriptionProcessor
- func (sp *StripeSubscriptionProcessor) CancelSubscription(ctx context.Context, subscriptionID string, immediately bool) error
- func (sp *StripeSubscriptionProcessor) CreateSubscription(ctx context.Context, req processor.SubscriptionRequest) (*processor.Subscription, error)
- func (sp *StripeSubscriptionProcessor) GetSubscription(ctx context.Context, subscriptionID string) (*processor.Subscription, error)
- func (sp *StripeSubscriptionProcessor) ListSubscriptions(ctx context.Context, customerID string) ([]*processor.Subscription, error)
- func (sp *StripeSubscriptionProcessor) UpdateSubscription(ctx context.Context, subscriptionID string, req processor.SubscriptionUpdate) (*processor.Subscription, error)
- type Subscription
- type Token
- type Transfer
Constants ¶
const Lost = _stripe.DisputeStatusLost
const Needsresponse = _stripe.DisputeStatusNeedsResponse
const ReportFraudulent = _stripe.ChargeFraudUserReportFraudulent
const ReportSafe = _stripe.ChargeFraudUserReportSafe
const Review = _stripe.DisputeStatusUnderReview
const Won = _stripe.DisputeStatusWon
Variables ¶
This section is empty.
Functions ¶
func MapWebhookEventType ¶ added in v1.34.0
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 ¶
StripeSupportedCurrencies returns all currencies Stripe supports
func SubscriptionToCard ¶
func SubscriptionToCard(sub *subscription.Subscription) *stripe.CardParams
func SyncDispute ¶ added in v1.34.0
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
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 UpdateTransferFromStripe ¶
Update transfer from Stripe
Types ¶
type CardParams ¶
type CardParams _stripe.CardParams
type ChargeListParams ¶
type ChargeListParams _stripe.ChargeListParams
type ChargeParams ¶
type ChargeParams _stripe.ChargeParams
type Client ¶
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) DeleteCard ¶
Update card associated with Stripe customer
func (Client) GetCustomer ¶
Get Stripe customer
func (Client) NewCustomer ¶
func (Client) NewSubscription ¶
func (c Client) NewSubscription(source interface{}, sub *subscription.Subscription) (*Subscription, 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) UpdateCard ¶
Update card associated with Stripe customer
func (Client) UpdateCharge ¶
Update Stripe charge
func (Client) UpdateCustomer ¶
Update Stripe customer
func (Client) UpdateSubscription ¶
func (c Client) UpdateSubscription(sub *subscription.Subscription) (*Subscription, error)
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 ¶
func (sp *StripeProcessor) Authorize(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
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 ¶
func (sp *StripeProcessor) Charge(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
Charge processes a payment
func (*StripeProcessor) ChargeViaIntent ¶ added in v1.34.0
func (sp *StripeProcessor) ChargeViaIntent(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
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 ¶
func (sp *StripeProcessor) Refund(ctx context.Context, req processor.RefundRequest) (*processor.RefundResult, error)
Refund processes a refund
func (*StripeProcessor) Type ¶
func (sp *StripeProcessor) Type() processor.ProcessorType
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 ¶
func (sp *StripeSubscriptionProcessor) CreateSubscription(ctx context.Context, req processor.SubscriptionRequest) (*processor.Subscription, error)
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