Documentation
¶
Overview ¶
Package go-ministripe is small library for backend development that allows dev to communicate with Stripe API
Index ¶
- type Config
- type PaymentIntent
- type PaymentIntentParams
- type PaymentIntentResponse
- type StripeClient
- func (sc *StripeClient) CancelPaymentIntent(p *PaymentIntent) (*PaymentIntentResponse, error)
- func (sc *StripeClient) CreatePaymentIntent(params *PaymentIntentParams) (*PaymentIntentResponse, error)
- func (sc *StripeClient) PaymentIntentAction(p *PaymentIntent, action string) (*PaymentIntentResponse, error)
- func (sc *StripeClient) UpdatePaymentIntent(p *PaymentIntent) (*PaymentIntentResponse, error)
- type StripeRequestError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
SecretKey string // SecretKey secret key that is used to authenticate stripe requests, usually begins witk "sk_"
PublicKey string // PublicKey public key, shareable with client side, begins with "pk_", optional for backend
Timeout uint // timeout for requests in seconds
// contains filtered or unexported fields
}
StripeConfig configuration structure type, used by the library
type PaymentIntent ¶
type PaymentIntent struct {
Id string `json:"id" url:"id"` // Id of the PaymentIntent
}
PaymentIntent PaymentIntent struct from Stripe API, only stores id of the PaymentIntent
type PaymentIntentParams ¶
type PaymentIntentParams struct {
Amount uint64 `url:"amount,omitempty"` // Amount of money to charge the user - in smallest unit of the currency (eg. 100 = 1$)
Currency string `url:"currency,omitempty"` // Currency ISO format of the currency (eg. "czk" "eur" "usd")
Description string `url:"description,omitempty"` // Description usefull for displaying on the dashboard
StatementDescriptor string `url:"statement_descriptor,omitempty"` // text that appears on the customer’s statement as the statement descriptor for a non-card charge.
StatementDescriptorSuffix string `url:"statement_descriptor_suffix,omitempty"` // Provides information about a card charge.
}
Used for creating new paymentIntent with stripe API.
Note: There are lot of params missing, and thats for the sake of simplicity
type PaymentIntentResponse ¶
type PaymentIntentResponse struct {
Id string `json:"id"`
ClientSecret string `json:"client_secret"` // ClientSecret Used for client-side retrieval using a publishable key.
Status string `json:"status"` // Status of this PaymentIntent, one of requires_payment_method, requires_confirmation, requires_action, processing, requires_capture, canceled, or succeeded
}
Used to store response from Stripe API after a request
type StripeClient ¶
type StripeClient struct {
// contains filtered or unexported fields
}
func (*StripeClient) CancelPaymentIntent ¶
func (sc *StripeClient) CancelPaymentIntent(p *PaymentIntent) (*PaymentIntentResponse, error)
func (*StripeClient) CreatePaymentIntent ¶
func (sc *StripeClient) CreatePaymentIntent(params *PaymentIntentParams) (*PaymentIntentResponse, error)
Creates new PaymentIntent with specified parameters, as explained in stripe API
func (*StripeClient) PaymentIntentAction ¶
func (sc *StripeClient) PaymentIntentAction(p *PaymentIntent, action string) (*PaymentIntentResponse, error)
func (*StripeClient) UpdatePaymentIntent ¶
func (sc *StripeClient) UpdatePaymentIntent(p *PaymentIntent) (*PaymentIntentResponse, error)
type StripeRequestError ¶
func (*StripeRequestError) Error ¶
func (err *StripeRequestError) Error() string
Click to show internal directories.
Click to hide internal directories.