stripe-go: github.com/stripe/stripe-go Index | Examples | Files | Directories

package stripe

import "github.com/stripe/stripe-go"

Package stripe provides the binding for Stripe REST APIs.

Index

Examples

Package Files

account.go address.go applepaydomain.go application.go balance.go bankaccount.go bitcoinreceiver.go bitcointransaction.go card.go charge.go countryspec.go coupon.go customer.go discount.go dispute.go ephemeralkey.go error.go event.go fee.go feerefund.go fileupload.go invoice.go invoiceitem.go iter.go loginlink.go order.go orderitem.go orderreturn.go params.go paymentsource.go payout.go plan.go product.go recipient.go recipienttransfer.go refund.go reversal.go review.go sku.go source.go stripe.go sub.go subitem.go threedsecure.go token.go transfer.go

Constants

const (
    // Company is a constant value representing a company legal entity type.
    Company LegalEntityType = "company"

    // Day is a constant value representing a daily payout interval.
    Day Interval = "daily"

    // Individual is a constant value representing an individual legal entity
    // type.
    Individual LegalEntityType = "individual"

    // IdentityVerificationPending is a constant value indicating that identity
    // verification status is pending.
    IdentityVerificationPending IdentityVerificationStatus = "pending"

    // IdentityVerificationUnverified is a constant value indicating that
    // identity verification status is unverified.
    IdentityVerificationUnverified IdentityVerificationStatus = "unverified"

    // IdentityVerificationVerified is a constant value indicating that
    // identity verification status is verified.
    IdentityVerificationVerified IdentityVerificationStatus = "verified"

    // Manual is a constant value representing a manual payout interval.
    Manual Interval = "manual"

    // Month is a constant value representing a monthly payout interval.
    Month Interval = "monthly"

    // Week is a constant value representing a weekly payout interval.
    Week Interval = "weekly"
)
const (
    ErrorTypeAPI            ErrorType = "api_error"
    ErrorTypeAPIConnection  ErrorType = "api_connection_error"
    ErrorTypeAuthentication ErrorType = "authentication_error"
    ErrorTypeCard           ErrorType = "card_error"
    ErrorTypeInvalidRequest ErrorType = "invalid_request_error"
    ErrorTypePermission     ErrorType = "more_permissions_required"
    ErrorTypeRateLimit      ErrorType = "rate_limit_error"

    CardDeclined  ErrorCode = "card_declined"
    ExpiredCard   ErrorCode = "expired_card"
    IncorrectNum  ErrorCode = "incorrect_number"
    InvalidCvc    ErrorCode = "invalid_cvc"
    InvalidExpM   ErrorCode = "invalid_expiry_month"
    InvalidExpY   ErrorCode = "invalid_expiry_year"
    InvalidNum    ErrorCode = "invalid_number"
    IncorrectCvc  ErrorCode = "incorrect_cvc"
    IncorrectZip  ErrorCode = "incorrect_zip"
    Missing       ErrorCode = "missing"
    ProcessingErr ErrorCode = "processing_error"
    RateLimit     ErrorCode = "rate_limit"

    APIErr         ErrorType = ErrorTypeAPI
    CardErr        ErrorType = ErrorTypeCard
    InvalidRequest ErrorType = ErrorTypeInvalidRequest
)
const (
    // APIBackend is a constant representing the API service backend.
    APIBackend SupportedBackend = "api"

    // APIURL is the URL of the API service backend.
    APIURL string = "https://api.stripe.com/v1"

    // UploadsBackend is a constant representing the uploads service backend.
    UploadsBackend SupportedBackend = "uploads"

    // UploadsURL is the URL of the uploads service backend.
    UploadsURL string = "https://uploads.stripe.com/v1"
)
const TotalBackends = 2

TotalBackends is the total number of Stripe API endpoints supported by the binding.

const UnknownPlatform = "unknown platform"

UnknownPlatform is the string returned as the system name if we couldn't get one from `uname`.

Variables

var Key string

Key is the Stripe API key used globally in the binding.

var LogLevel = 2

LogLevel is the logging level for this library. 0: no logging 1: errors only 2: errors + informational (default) 3: errors + informational + debug

func NewIdempotencyKey Uses

func NewIdempotencyKey() string

NewIdempotencyKey generates a new idempotency key that can be used on a request.

func SetAppInfo Uses

func SetAppInfo(info *AppInfo)

SetAppInfo sets app information. See AppInfo.

func SetBackend Uses

func SetBackend(backend SupportedBackend, b Backend)

SetBackend sets the backend used in the binding.

func SetHTTPClient Uses

func SetHTTPClient(client *http.Client)

SetHTTPClient overrides the default HTTP client. This is useful if you're running in a Google AppEngine environment where the http.DefaultClient is not available.

type APIConnectionError Uses

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

APIConnectionError is a failure to connect to the Stripe API.

func (*APIConnectionError) Error Uses

func (e *APIConnectionError) Error() string

Error serializes the error object to JSON and returns it as a string.

type APIError Uses

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

APIError is a catch all for any errors not covered by other types (and should be extremely uncommon).

func (*APIError) Error Uses

func (e *APIError) Error() string

Error serializes the error object to JSON and returns it as a string.

type Account Uses

type Account struct {
             string               `json:"business_logo"`
    BusinessName         string               `json:"business_name"`
    BusinessPrimaryColor string               `json:"business_primary_color"`
    BusinessUrl          string               `json:"business_url"`
    ChargesEnabled       bool                 `json:"charges_enabled"`
    Country              string               `json:"country"`
    DebitNegativeBal     bool                 `json:"debit_negative_balances"`
    DefaultCurrency      string               `json:"default_currency"`
    Deleted              bool                 `json:"deleted"`
    DetailsSubmitted     bool                 `json:"details_submitted"`
    Email                string               `json:"email"`
    ExternalAccounts     *ExternalAccountList `json:"external_accounts"`
    ID                   string               `json:"id"`

    Keys *struct {
        Publish string `json:"publishable"`
        Secret  string `json:"secret"`
    }   `json:"keys"`

    LegalEntity     *LegalEntity      `json:"legal_entity"`
    Meta            map[string]string `json:"metadata"`
    Name            string            `json:"display_name"`
    PayoutSchedule  *PayoutSchedule   `json:"payout_schedule"`
    PayoutStatement string            `json:"payout_statement_descriptor"`
    PayoutsEnabled  bool              `json:"payouts_enabled"`
    ProductDesc     string            `json:"product_description"`
    Statement       string            `json:"statement_descriptor"`
    SupportAddress  *Address          `json:"support_address"`
    SupportEmail    string            `json:"support_email"`
    SupportPhone    string            `json:"support_phone"`
    SupportUrl      string            `json:"support_url"`
    Timezone        string            `json:"timezone"`

    TOSAcceptance *struct {
        Date      int64  `json:"date"`
        IP        string `json:"ip"`
        UserAgent string `json:"user_agent"`
    }   `json:"tos_acceptance"`

    Type AccountType

    Verification *struct {
        DisabledReason string   `json:"disabled_reason"`
        Due            *int64   `json:"due_by"`
        Fields         []string `json:"fields_needed"`
    }   `json:"verification"`
}

Account is the resource representing your Stripe account. For more details see https://stripe.com/docs/api/#account.

func (*Account) UnmarshalJSON Uses

func (a *Account) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of an account. This custom unmarshaling is needed because the resulting property may be an ID or the full struct if it was expanded.

type AccountExternalAccountParams Uses

type AccountExternalAccountParams struct {
    Params            `form:"*"`
    Account           string `form:"account_number"`
    AccountHolderName string `form:"account_holder_name"`
    AccountHolderType string `form:"account_holder_type"`
    Country           string `form:"country"`
    Currency          string `form:"currency"`
    Routing           string `form:"routing_number"`
    Token             string `form:"token"`
}

AccountExternalAccountParams are the parameters allowed to reference an external account when creating an account. It should either have Token set or everything else.

type AccountList Uses

type AccountList struct {
    ListMeta
    Values []*Account `json:"data"`
}

AccountList is a list of accounts as returned from a list endpoint.

type AccountListParams Uses

type AccountListParams struct {
    ListParams `form:"*"`
}

AccountListParams are the parameters allowed during account listing.

type AccountParams Uses

type AccountParams struct {
    Params               `form:"*"`
    BusinessName         string                        `form:"business_name"`
    BusinessPrimaryColor string                        `form:"business_primary_color"`
    BusinessUrl          string                        `form:"business_url"`
    Country              string                        `form:"country"`
    DebitNegativeBal     bool                          `form:"debit_negative_balances"`
    DefaultCurrency      string                        `form:"default_currency"`
    Email                string                        `form:"email"`
    ExternalAccount      *AccountExternalAccountParams `form:"external_account"`
    FromRecipient        string                        `form:"from_recipient"`
    LegalEntity          *LegalEntity                  `form:"legal_entity"`
    NoDebitNegativeBal   bool                          `form:"debit_negative_balances,invert"`
    PayoutSchedule       *PayoutScheduleParams         `form:"payout_schedule"`
    PayoutStatement      string                        `form:"payout_statement_descriptor"`
    Statement            string                        `form:"statement_descriptor"`
    SupportEmail         string                        `form:"support_email"`
    SupportPhone         string                        `form:"support_phone"`
    SupportUrl           string                        `form:"support_url"`
    TOSAcceptance        *TOSAcceptanceParams          `form:"tos_acceptance"`
    Type                 AccountType                   `form:"type"`
}

AccountParams are the parameters allowed during account creation/updates.

type AccountRejectParams Uses

type AccountRejectParams struct {
    // Reason is the reason that an account was rejected. It should be given a
    // value of one of `fraud`, `terms_of_service`, or `other`.
    Reason string `json:"reason" form:"reason"`
}

AccountRejectParams is the structure for the Reject function.

type AccountType Uses

type AccountType string

AccountType is the type of an account.

const (
    // AccountTypeCustom is a constant value representing an account of type custom.
    AccountTypeCustom AccountType = "custom"

    // AccountTypeExpress is a constant value representing an account of type express.
    AccountTypeExpress AccountType = "express"

    // AccountTypeStandard is a constant value representing an account of type standard.
    AccountTypeStandard AccountType = "standard"
)

type Address Uses

type Address struct {
    City    string `json:"city" form:"city"`
    Country string `json:"country" form:"country"`
    Line1   string `json:"line1" form:"line1"`
    Line2   string `json:"line2" form:"line2"`
    State   string `json:"state" form:"state"`

    // Town/cho-me. Note that this is only used for Kana/Kanji representations
    // of an address.
    Town string `json:"town" form:"town"`

    Zip string `json:"postal_code" form:"postal_code"`
}

Address is the structure for an account address.

type AddressParams Uses

type AddressParams struct {
    City       string `form:"city"`
    Country    string `form:"country"`
    Line1      string `form:"line1"`
    Line2      string `form:"line2"`
    PostalCode string `form:"postal_code"`
    State      string `form:"state"`
}

Standard address parameters.

type Amount Uses

type Amount struct {
    Value    int64    `json:"amount"`
    Currency Currency `json:"currency"`
}

Amount is a structure wrapping an amount value and its currency.

type AppInfo Uses

type AppInfo struct {
    Name    string `json:"name"`
    URL     string `json:"url"`
    Version string `json:"version"`
}

AppInfo contains information about the "app" which this integration belongs to. This should be reserved for plugins that wish to identify themselves with Stripe.

type ApplePayDomain Uses

type ApplePayDomain struct {
    Created    int64  `json:"created"`
    Deleted    bool   `json:"deleted"`
    DomainName string `json:"domain_name"`
    ID         string `json:"id"`
    Live       bool   `json:"livemode"`
}

ApplePayDomain is the resource representing a Stripe ApplePayDomain object

type ApplePayDomainList Uses

type ApplePayDomainList struct {
    ListMeta
    Values []*ApplePayDomain `json:"data"`
}

ApplePayDomainList is a list of ApplePayDomains as returned from a list endpoint.

type ApplePayDomainListParams Uses

type ApplePayDomainListParams struct {
    ListParams `form:"*"`
}

ApplePayDomainListParams are the parameters allowed during ApplePayDomain listing.

type ApplePayDomainParams Uses

type ApplePayDomainParams struct {
    Params     `form:"*"`
    DomainName string `form:"domain_name"`
}

ApplePayDomainParams is the set of parameters that can be used when creating an ApplePayDomain object.

type Application Uses

type Application struct {
    ID   string `json:"id"`
    Name string `json:"name"`
}

func (*Application) UnmarshalJSON Uses

func (a *Application) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of an Application. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type AuthenticationError Uses

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

AuthenticationError is a failure to properly authenticate during a request.

func (*AuthenticationError) Error Uses

func (e *AuthenticationError) Error() string

Error serializes the error object to JSON and returns it as a string.

type Backend Uses

type Backend interface {
    Call(method, path, key string, body *form.Values, params *Params, v interface{}) error
    CallMultipart(method, path, key, boundary string, body io.Reader, params *Params, v interface{}) error
}

Backend is an interface for making calls against a Stripe service. This interface exists to enable mocking for during testing if needed.

func GetBackend Uses

func GetBackend(backend SupportedBackend) Backend

GetBackend returns the currently used backend in the binding.

type BackendConfiguration Uses

type BackendConfiguration struct {
    Type       SupportedBackend
    URL        string
    HTTPClient *http.Client
}

BackendConfiguration is the internal implementation for making HTTP calls to Stripe.

func (BackendConfiguration) Call Uses

func (s BackendConfiguration) Call(method, path, key string, form *form.Values, params *Params, v interface{}) error

Call is the Backend.Call implementation for invoking Stripe APIs.

func (BackendConfiguration) CallMultipart Uses

func (s BackendConfiguration) CallMultipart(method, path, key, boundary string, body io.Reader, params *Params, v interface{}) error

CallMultipart is the Backend.CallMultipart implementation for invoking Stripe APIs.

func (*BackendConfiguration) Do Uses

func (s *BackendConfiguration) Do(req *http.Request, v interface{}) error

Do is used by Call to execute an API request and parse the response. It uses the backend's HTTP client to execute the request and unmarshals the response into v. It also handles unmarshaling errors returned by the API.

func (*BackendConfiguration) NewRequest Uses

func (s *BackendConfiguration) NewRequest(method, path, key, contentType string, body io.Reader, params *Params) (*http.Request, error)

NewRequest is used by Call to generate an http.Request. It handles encoding parameters and attaching the appropriate headers.

func (*BackendConfiguration) ResponseToError Uses

func (s *BackendConfiguration) ResponseToError(res *http.Response, resBody []byte) error

type Backends Uses

type Backends struct {
    API, Uploads Backend
}

Backends are the currently supported endpoints.

func NewBackends Uses

func NewBackends(httpClient *http.Client) *Backends

NewBackends creates a new set of backends with the given HTTP client. You should only need to use this for testing purposes or on App Engine.

type Balance Uses

type Balance struct {
    Available []Amount `json:"available"`
    Live      bool     `json:"livemode"`
    Pending   []Amount `json:"pending"`
}

Balance is the resource representing your Stripe balance. For more details see https://stripe.com/docs/api/#balance.

type BalanceParams Uses

type BalanceParams struct {
    Params `form:"*"`
}

BalanceParams is the set of parameters that can be used when retrieving a balance. For more details see https://stripe.com/docs/api#balance.

type BankAccount Uses

type BankAccount struct {
    AccountHolderName string            `json:"account_holder_name"`
    AccountHolderType string            `json:"account_holder_type"`
    Country           string            `json:"country"`
    Currency          Currency          `json:"currency"`
    Customer          *Customer         `json:"customer"`
    Default           bool              `json:"default_for_currency"`
    Deleted           bool              `json:"deleted"`
    Fingerprint       string            `json:"fingerprint"`
    ID                string            `json:"id"`
    LastFour          string            `json:"last4"`
    Meta              map[string]string `json:"metadata"`
    Name              string            `json:"bank_name"`
    Routing           string            `json:"routing_number"`
    Status            BankAccountStatus `json:"status"`
}

BankAccount represents a Stripe bank account.

func (*BankAccount) UnmarshalJSON Uses

func (b *BankAccount) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a BankAccount. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type BankAccountList Uses

type BankAccountList struct {
    ListMeta
    Values []*BankAccount `json:"data"`
}

BankAccountList is a list object for bank accounts.

type BankAccountListParams Uses

type BankAccountListParams struct {
    ListParams `form:"*"`

    // The identifier of the parent account under which the bank accounts are
    // nested. Either AccountID or Customer should be populated.
    AccountID string `form:"-"`

    // The identifier of the parent customer under which the bank accounts are
    // nested. Either AccountID or Customer should be populated.
    Customer string `form:"-"`
}

BankAccountListParams is the set of parameters that can be used when listing bank accounts.

type BankAccountParams Uses

type BankAccountParams struct {
    Params `form:"*"`

    Account string `form:"account_number"`

    // AccountID is the identifier of the parent account under which bank
    // accounts are nested.
    AccountID string `form:"-"`

    AccountHolderName string `form:"account_holder_name"`
    AccountHolderType string `form:"account_holder_type"`
    Country           string `form:"country"`
    Currency          string `form:"currency"`
    Customer          string `form:"-"`
    Default           bool   `form:"default_for_currency"`
    Routing           string `form:"routing_number"`

    // Token is a token referencing an external account like one returned from
    // Stripe.js.
    Token string `form:"-"`
}

BankAccountParams is the set of parameters that can be used when updating a bank account.

Note that while form annotations are used for updates, bank accounts have some unusual logic on creates that necessitates manual handling of all parameters. See AppendToAsSourceOrExternalAccount.

func (*BankAccountParams) AppendToAsSourceOrExternalAccount Uses

func (a *BankAccountParams) AppendToAsSourceOrExternalAccount(body *form.Values)

AppendToAsSourceOrExternalAccount appends the given BankAccountParams as either a source or external account.

It may look like an AppendTo from the form package, but it's not, and is only used in the special case where we use `bankaccount.New`. It's needed because we have some weird encoding logic here that can't be handled by the form package (and it's special enough that it wouldn't be desirable to have it do so).

This is not a pattern that we want to push forward, and this largely exists because the bank accounts endpoint is a little unusual. There is one other resource like it, which is cards.

type BankAccountStatus Uses

type BankAccountStatus string

BankAccountStatus is the list of allowed values for the bank account's status. Allowed values are "new", "verified", "validated", "errored".

type BitcoinReceiver Uses

type BitcoinReceiver struct {
    Active                bool                    `json:"active"`
    Amount                uint64                  `json:"amount"`
    AmountReceived        uint64                  `json:"amount_received"`
    BitcoinAmount         uint64                  `json:"bitcoin_amount"`
    BitcoinAmountReceived uint64                  `json:"bitcoin_amount_received"`
    BitcoinUri            string                  `json:"bitcoin_uri"`
    Created               int64                   `json:"created"`
    Currency              Currency                `json:"currency"`
    Customer              string                  `json:"customer"`
    Desc                  string                  `json:"description"`
    Email                 string                  `json:"email"`
    Filled                bool                    `json:"filled"`
    ID                    string                  `json:"id"`
    InboundAddress        string                  `json:"inbound_address"`
    Meta                  map[string]string       `json:"metadata"`
    Payment               string                  `json:"payment"`
    RefundAddress         string                  `json:"refund_address"`
    RejectTransactions    bool                    `json:"reject_transactions"`
    Transactions          *BitcoinTransactionList `json:"transactions"`
}

BitcoinReceiver is the resource representing a Stripe bitcoin receiver. For more details see https://stripe.com/docs/api/#bitcoin_receivers

func (*BitcoinReceiver) UnmarshalJSON Uses

func (br *BitcoinReceiver) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a BitcoinReceiver. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type BitcoinReceiverList Uses

type BitcoinReceiverList struct {
    ListMeta
    Values []*BitcoinReceiver `json:"data"`
}

BitcoinReceiverList is a list of bitcoin receivers as retrieved from a list endpoint.

type BitcoinReceiverListParams Uses

type BitcoinReceiverListParams struct {
    ListParams `form:"*"`
    NotActive  bool `form:"active,invert"`
    NotFilled  bool `form:"filled,invert"`
    Uncaptured bool `form:"uncaptured_funds"`
}

BitcoinReceiverListParams is the set of parameters that can be used when listing BitcoinReceivers. For more details see https://stripe.com/docs/api/#list_bitcoin_receivers.

type BitcoinReceiverParams Uses

type BitcoinReceiverParams struct {
    Params   `form:"*"`
    Amount   uint64   `form:"amount"`
    Currency Currency `form:"currency"`
    Desc     string   `form:"description"`
    Email    string   `form:"email"`
}

BitcoinReceiverParams is the set of parameters that can be used when creating a BitcoinReceiver. For more details see https://stripe.com/docs/api/#create_bitcoin_receiver.

type BitcoinReceiverUpdateParams Uses

type BitcoinReceiverUpdateParams struct {
    Params     `form:"*"`
    Desc       string `form:"description"`
    Email      string `form:"email"`
    RefundAddr string `form:"refund_address"`
}

BitcoinReceiverUpdateParams is the set of parameters that can be used when updating a BitcoinReceiver. For more details see https://stripe.com/docs/api/#update_bitcoin_receiver.

type BitcoinTransaction Uses

type BitcoinTransaction struct {
    Amount        uint64   `json:"amount"`
    BitcoinAmount uint64   `json:"bitcoin_amount"`
    Created       int64    `json:"created"`
    Currency      Currency `json:"currency"`
    Customer      string   `json:"customer"`
    ID            string   `json:"id"`
    Receiver      string   `json:"receiver"`
}

BitcoinTransaction is the resource representing a Stripe bitcoin transaction. For more details see https://stripe.com/docs/api/#bitcoin_receivers

func (*BitcoinTransaction) UnmarshalJSON Uses

func (bt *BitcoinTransaction) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a BitcoinTransaction. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type BitcoinTransactionList Uses

type BitcoinTransactionList struct {
    ListMeta
    Values []*BitcoinTransaction `json:"data"`
}

BitcoinTransactionList is a list object for BitcoinTransactions. It is a child object of BitcoinRecievers For more details see https://stripe.com/docs/api/#retrieve_bitcoin_receiver

type BitcoinTransactionListParams Uses

type BitcoinTransactionListParams struct {
    ListParams `form:"*"`
    Customer   string `form:"customer"`
    Receiver   string `form:"-"` // Sent in with the URL
}

BitcoinTransactionListParams is the set of parameters that can be used when listing BitcoinTransactions.

type CaptureParams Uses

type CaptureParams struct {
    Params    `form:"*"`
    Amount    uint64 `form:"amount"`
    Email     string `form:"receipt_email"`
    Fee       uint64 `form:"application_fee"`
    Statement string `form:"statement_descriptor"`
}

CaptureParams is the set of parameters that can be used when capturing a charge. For more details see https://stripe.com/docs/api#charge_capture.

type Card Uses

type Card struct {
    Address1      string       `json:"address_line1"`
    Address1Check Verification `json:"address_line1_check"`
    Address2      string       `json:"address_line2"`
    Brand         CardBrand    `json:"brand"`
    CVCCheck      Verification `json:"cvc_check"`
    CardCountry   string       `json:"country"`
    City          string       `json:"address_city"`
    Country       string       `json:"address_country"`
    Currency      Currency     `json:"currency"`
    Customer      *Customer    `json:"customer"`
    Default       bool         `json:"default_for_currency"`
    Deleted       bool         `json:"deleted"`

    // Description is a succinct summary of the card's information.
    //
    // Please note that this field is for internal use only and is not returned
    // as part of standard API requests.
    Description string `json:"description"`

    DynLastFour string      `json:"dynamic_last4"`
    Fingerprint string      `json:"fingerprint"`
    Funding     CardFunding `json:"funding"`
    ID          string      `json:"id"`

    // IIN is the card's "Issuer Identification Number".
    //
    // Please note that this field is for internal use only and is not returned
    // as part of standard API requests.
    IIN string `json:"iin"`

    // Issuer is a bank or financial institution that provides the card.
    //
    // Please note that this field is for internal use only and is not returned
    // as part of standard API requests.
    Issuer string `json:"issuer"`

    LastFour           string             `json:"last4"`
    Meta               map[string]string  `json:"metadata"`
    Month              uint8              `json:"exp_month"`
    Name               string             `json:"name"`
    Recipient          *Recipient         `json:"recipient"`
    State              string             `json:"address_state"`
    ThreeDSecure       *ThreeDSecure      `json:"three_d_secure"`
    TokenizationMethod TokenizationMethod `json:"tokenization_method"`
    Year               uint16             `json:"exp_year"`
    Zip                string             `json:"address_zip"`
    ZipCheck           Verification       `json:"address_zip_check"`
}

Card is the resource representing a Stripe credit/debit card. For more details see https://stripe.com/docs/api#cards.

func (*Card) UnmarshalJSON Uses

func (c *Card) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a Card. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type CardBrand Uses

type CardBrand string

CardBrand is the list of allowed values for the card's brand. Allowed values are "Unknown", "Visa", "American Express", "MasterCard", "Discover" "JCB", "Diners Club".

type CardError Uses

type CardError struct {
    DeclineCode string `json:"decline_code,omitempty"`
    // contains filtered or unexported fields
}

CardError are the most common type of error you should expect to handle. They result when the user enters a card that can't be charged for some reason.

func (*CardError) Error Uses

func (e *CardError) Error() string

Error serializes the error object to JSON and returns it as a string.

type CardFunding Uses

type CardFunding string

CardFunding is the list of allowed values for the card's funding. Allowed values are "credit", "debit", "prepaid", "unknown".

type CardList Uses

type CardList struct {
    ListMeta
    Values []*Card `json:"data"`
}

CardList is a list object for cards.

type CardListParams Uses

type CardListParams struct {
    ListParams `form:"*"`
    Account    string `form:"-"`
    Customer   string `form:"-"`
    Recipient  string `form:"-"`
}

CardListParams is the set of parameters that can be used when listing cards. For more details see https://stripe.com/docs/api#list_cards.

type CardParams Uses

type CardParams struct {
    Params    `form:"*"`
    Account   string `form:"-"`
    Address1  string `form:"address_line1"`
    Address2  string `form:"address_line2"`
    CVC       string `form:"-"`
    City      string `form:"address_city"`
    Country   string `form:"address_country"`
    Currency  string `form:"currency"`
    Customer  string `form:"-"`
    Default   bool   `form:"default_for_currency"`
    Month     string `form:"exp_month"`
    Name      string `form:"name"`
    Number    string `form:"number"`
    Recipient string `form:"-"`
    State     string `form:"address_state"`
    Token     string `form:"-"`
    Year      string `form:"exp_year"`
    Zip       string `form:"address_zip"`
}

CardParams is the set of parameters that can be used when creating or updating a card. For more details see https://stripe.com/docs/api#create_card and https://stripe.com/docs/api#update_card.

Note that while form annotations are used for tokenization and updates, cards have some unusual logic on creates that necessitates manual handling of all parameters. See AppendToAsCardSourceOrExternalAccount.

func (*CardParams) AppendToAsCardSourceOrExternalAccount Uses

func (c *CardParams) AppendToAsCardSourceOrExternalAccount(body *form.Values, keyParts []string)

AppendToAsCardSourceOrExternalAccount appends the given CardParams as either a card or external account.

It may look like an AppendTo from the form package, but it's not, and is only used in the special case where we use `card.New`. It's needed because we have some weird encoding logic here that can't be handled by the form package (and it's special enough that it wouldn't be desirable to have it do so).

This is not a pattern that we want to push forward, and this largely exists because the cards endpoint is a little unusual. There is one other resource like it, which is bank account.

type Charge Uses

type Charge struct {
    Amount         uint64            `json:"amount"`
    AmountRefunded uint64            `json:"amount_refunded"`
    Application    *Application      `json:"application"`
    Captured       bool              `json:"captured"`
    Created        int64             `json:"created"`
    Currency       Currency          `json:"currency"`
    Customer       *Customer         `json:"customer"`
    Desc           string            `json:"description"`
    Dest           *Account          `json:"destination"`
    Dispute        *Dispute          `json:"dispute"`
    Email          string            `json:"receipt_email"`
    FailCode       string            `json:"failure_code"`
    FailMsg        string            `json:"failure_message"`
    Fee            *Fee              `json:"application_fee"`
    FraudDetails   *FraudDetails     `json:"fraud_details"`
    ID             string            `json:"id"`
    Invoice        *Invoice          `json:"invoice"`
    Live           bool              `json:"livemode"`
    Meta           map[string]string `json:"metadata"`
    Outcome        *ChargeOutcome    `json:"outcome"`
    Paid           bool              `json:"paid"`
    ReceiptNumber  string            `json:"receipt_number"`
    Refunded       bool              `json:"refunded"`
    Refunds        *RefundList       `json:"refunds"`
    Review         *Review           `json:"review"`
    Shipping       *ShippingDetails  `json:"shipping"`
    Source         *PaymentSource    `json:"source"`
    SourceTransfer *Transfer         `json:"source_transfer"`
    Statement      string            `json:"statement_descriptor"`
    Status         string            `json:"status"`
    Transfer       *Transfer         `json:"transfer"`
    TransferGroup  string            `json:"transfer_group"`
    Tx             *Transaction      `json:"balance_transaction"`
}

Charge is the resource representing a Stripe charge. For more details see https://stripe.com/docs/api#charges.

Code:

stripe.Key = "sk_key"

params := &stripe.ChargeParams{}
params.Expand("customer")
params.Expand("application")
params.Expand("balance_transaction")

ch, err := charge.Get("ch_example_id", params)

if err != nil {
    log.Fatal(err)
}

if ch.Application != nil {
    log.Fatal(err)
}

log.Printf("%v\n", ch.ID)

Code:

stripe.Key = "sk_key"

params := &stripe.ChargeParams{
    Amount:   1000,
    Currency: currency.USD,
}
params.SetSource("tok_visa")
params.AddMeta("key", "value")

ch, err := charge.New(params)

if err != nil {
    log.Fatal(err)
}

log.Printf("%v\n", ch.ID)

func (*Charge) UnmarshalJSON Uses

func (c *Charge) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a charge. This custom unmarshaling is needed because the resulting property may be an ID or the full struct if it was expanded.

type ChargeList Uses

type ChargeList struct {
    ListMeta
    Values []*Charge `json:"data"`
}

ChargeList is a list of charges as retrieved from a list endpoint.

type ChargeListParams Uses

type ChargeListParams struct {
    ListParams    `form:"*"`
    Created       int64             `form:"created"`
    CreatedRange  *RangeQueryParams `form:"created"`
    Customer      string            `form:"customer"`
    TransferGroup string            `form:"transfer_group"`
}

ChargeListParams is the set of parameters that can be used when listing charges. For more details see https://stripe.com/docs/api#list_charges.

type ChargeOutcome Uses

type ChargeOutcome struct {
    NetworkStatus string             `json:"network_status"`
    Reason        string             `json:"reason"`
    RiskLevel     string             `json:"risk_level"`
    Rule          *ChargeOutcomeRule `json:"rule"`
    SellerMessage string             `json:"seller_message"`
    Type          string             `json:"type"`
}

Outcome is the charge's outcome that details whether a payment was accepted and why.

type ChargeOutcomeRule Uses

type ChargeOutcomeRule struct {
    Action    string `json:"action"`
    ID        string `json:"id"`
    Predicate string `json:"predicate"`
}

ChargeOutcomeRule tells you the Radar rule that blocked the charge, if any.

func (*ChargeOutcomeRule) UnmarshalJSON Uses

func (c *ChargeOutcomeRule) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a ChargeOutcomeRule. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type ChargeParams Uses

type ChargeParams struct {
    Params        `form:"*"`
    Amount        uint64              `form:"amount"`
    Currency      Currency            `form:"currency"`
    Customer      string              `form:"customer"`
    Desc          string              `form:"description"`
    Destination   *DestinationParams  `form:"destination"`
    Email         string              `form:"receipt_email"`
    Fee           uint64              `form:"application_fee"`
    FraudDetails  *FraudDetailsParams `form:"fraud_details"`
    NoCapture     bool                `form:"capture,invert"`
    OnBehalfOf    string              `form:"on_behalf_of"`
    Shipping      *ShippingDetails    `form:"shipping"`
    Source        *SourceParams       `form:"*"` // SourceParams has custom encoding so brought to top level with "*"
    Statement     string              `form:"statement_descriptor"`
    TransferGroup string              `form:"transfer_group"`
}

ChargeParams is the set of parameters that can be used when creating or updating a charge. For more details see https://stripe.com/docs/api#create_charge and https://stripe.com/docs/api#update_charge.

func (*ChargeParams) SetSource Uses

func (p *ChargeParams) SetSource(sp interface{}) error

SetSource adds valid sources to a ChargeParams object, returning an error for unsupported sources.

type Country Uses

type Country string

Country is the list of supported countries

type CountrySpec Uses

type CountrySpec struct {
    DefaultCurrency                Currency                                   `json:"default_currency"`
    ID                             string                                     `json:"id"`
    SupportedBankAccountCurrencies map[Country][]Currency                     `json:"supported_bank_account_currencies"`
    SupportedPaymentCurrencies     []Currency                                 `json:"supported_payment_currencies"`
    SupportedPaymentMethods        []string                                   `json:"supported_payment_methods"`
    VerificationFields             map[LegalEntityType]VerificationFieldsList `json:"verification_fields"`
}

CountrySpec is the resource representing the rules required for a Stripe account. For more details see https://stripe.com/docs/api/#country_specs.

type CountrySpecList Uses

type CountrySpecList struct {
    ListMeta
    Values []*CountrySpec `json:"data"`
}

CountrySpecList is a list of country specs as retrieved from a list endpoint.

type CountrySpecListParams Uses

type CountrySpecListParams struct {
    ListParams `form:"*"`
}

CountrySpecListParams are the parameters allowed during CountrySpec listing.

type Coupon Uses

type Coupon struct {
    Amount         uint64            `json:"amount_off"`
    Created        int64             `json:"created"`
    Currency       Currency          `json:"currency"`
    Deleted        bool              `json:"deleted"`
    Duration       CouponDuration    `json:"duration"`
    DurationPeriod uint64            `json:"duration_in_months"`
    ID             string            `json:"id"`
    Live           bool              `json:"livemode"`
    Meta           map[string]string `json:"metadata"`
    Percent        uint64            `json:"percent_off"`
    RedeemBy       int64             `json:"redeem_by"`
    Redeemed       uint64            `json:"times_redeemed"`
    Redemptions    uint64            `json:"max_redemptions"`
    Valid          bool              `json:"valid"`
}

Coupon is the resource representing a Stripe coupon. For more details see https://stripe.com/docs/api#coupons.

func (*Coupon) UnmarshalJSON Uses

func (c *Coupon) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a Coupon. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type CouponDuration Uses

type CouponDuration string

CouponDuration is the list of allowed values for the coupon's duration. Allowed values are "forever", "once", "repeating".

type CouponList Uses

type CouponList struct {
    ListMeta
    Values []*Coupon `json:"data"`
}

CouponList is a list of coupons as retrieved from a list endpoint.

type CouponListParams Uses

type CouponListParams struct {
    ListParams   `form:"*"`
    Created      int64             `form:"created"`
    CreatedRange *RangeQueryParams `form:"created"`
}

CouponListParams is the set of parameters that can be used when listing coupons. For more detail see https://stripe.com/docs/api#list_coupons.

type CouponParams Uses

type CouponParams struct {
    Params         `form:"*"`
    Amount         uint64         `form:"amount_off"`
    Currency       Currency       `form:"currency"`
    Duration       CouponDuration `form:"duration"`
    DurationPeriod uint64         `form:"duration_in_months"`
    ID             string         `form:"id"`
    Percent        uint64         `form:"percent_off"`
    RedeemBy       int64          `form:"redeem_by"`
    Redemptions    uint64         `form:"max_redemptions"`
}

CouponParams is the set of parameters that can be used when creating a coupon. For more details see https://stripe.com/docs/api#create_coupon.

type Currency Uses

type Currency string

Currency is the list of supported currencies. For more details see https://support.stripe.com/questions/which-currencies-does-stripe-support.

type Customer Uses

type Customer struct {
    Balance       int64                    `json:"account_balance"`
    BusinessVatID string                   `json:"business_vat_id"`
    Currency      Currency                 `json:"currency"`
    Created       int64                    `json:"created"`
    DefaultSource *PaymentSource           `json:"default_source"`
    Deleted       bool                     `json:"deleted"`
    Delinquent    bool                     `json:"delinquent"`
    Desc          string                   `json:"description"`
    Discount      *Discount                `json:"discount"`
    Email         string                   `json:"email"`
    ID            string                   `json:"id"`
    Live          bool                     `json:"livemode"`
    Meta          map[string]string        `json:"metadata"`
    Shipping      *CustomerShippingDetails `json:"shipping"`
    Sources       *SourceList              `json:"sources"`
    Subs          *SubList                 `json:"subscriptions"`
}

Customer is the resource representing a Stripe customer. For more details see https://stripe.com/docs/api#customers.

Code:

stripe.Key = "sk_key"

customerDel, err := customer.Del("cus_example_id", nil)

if err != nil {
    log.Fatal(err)
}

if !customerDel.Deleted {
    log.Fatal("Customer doesn't appear deleted while it should be")
}

func (*Customer) UnmarshalJSON Uses

func (c *Customer) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a Customer. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type CustomerList Uses

type CustomerList struct {
    ListMeta
    Values []*Customer `json:"data"`
}

CustomerList is a list of customers as retrieved from a list endpoint.

type CustomerListParams Uses

type CustomerListParams struct {
    ListParams   `form:"*"`
    Created      int64             `form:"created"`
    CreatedRange *RangeQueryParams `form:"created"`
}

CustomerListParams is the set of parameters that can be used when listing customers. For more details see https://stripe.com/docs/api#list_customers.

type CustomerParams Uses

type CustomerParams struct {
    Params         `form:"*"`
    Balance        int64                    `form:"account_balance"`
    BalanceZero    bool                     `form:"account_balance,zero"`
    BusinessVatID  string                   `form:"business_vat_id"`
    Coupon         string                   `form:"coupon"`
    CouponEmpty    bool                     `form:"coupon,empty"`
    DefaultSource  string                   `form:"default_source"`
    Desc           string                   `form:"description"`
    Email          string                   `form:"email"`
    Plan           string                   `form:"plan"`
    Quantity       uint64                   `form:"quantity"`
    Shipping       *CustomerShippingDetails `form:"shipping"`
    Source         *SourceParams            `form:"*"` // SourceParams has custom encoding so brought to top level with "*"
    TaxPercent     float64                  `form:"tax_percent"`
    TaxPercentZero bool                     `form:"tax_percent,zero"`
    Token          string                   `form:"-"` // This doesn't seem to be used?
    TrialEnd       int64                    `form:"trial_end"`
}

CustomerParams is the set of parameters that can be used when creating or updating a customer. For more details see https://stripe.com/docs/api#create_customer and https://stripe.com/docs/api#update_customer.

func (*CustomerParams) SetSource Uses

func (cp *CustomerParams) SetSource(sp interface{}) error

SetSource adds valid sources to a CustomerParams object, returning an error for unsupported sources.

type CustomerShippingDetails Uses

type CustomerShippingDetails struct {
    Address Address `json:"address" form:"address"`
    Name    string  `json:"name" form:"name"`
    Phone   string  `json:"phone" form:"phone"`
}

CustomerShippingDetails is the structure containing shipping information.

type CustomerSourceParams Uses

type CustomerSourceParams struct {
    Params   `form:"*"`
    Customer string        `form:"-"` // Goes in the URL
    Source   *SourceParams `form:"*"` // SourceParams has custom encoding so brought to top level with "*"
}

CustomerSourceParams are used to manipulate a given Stripe Customer object's payment sources. For more details see https://stripe.com/docs/api#sources

func (*CustomerSourceParams) SetSource Uses

func (cp *CustomerSourceParams) SetSource(sp interface{}) error

SetSource adds valid sources to a CustomerSourceParams object, returning an error for unsupported sources.

type DOB Uses

type DOB struct {
    Day   int `json:"day" form:"day"`
    Month int `json:"month" form:"month"`
    Year  int `json:"year" form:"year"`
}

DOB is a structure for an account owner's date of birth.

type DeliveryEstimate Uses

type DeliveryEstimate struct {
    Type EstimateType `json:"type"`
    // If Type == Range
    Earliest string `json:"earliest"`
    Latest   string `json:"latest"`
    // If Type == Exact
    Date string `json:"date"`
}

type DestinationParams Uses

type DestinationParams struct {
    Account string `form:"account"`
    Amount  uint64 `form:"amount"`
}

type Discount Uses

type Discount struct {
    Coupon   *Coupon `json:"coupon"`
    Customer string  `json:"customer"`
    Deleted  bool    `json:"deleted"`
    End      int64   `json:"end"`
    Start    int64   `json:"start"`
    Sub      string  `json:"subscription"`
}

Discount is the resource representing a Stripe discount. For more details see https://stripe.com/docs/api#discounts.

type DiscountParams Uses

type DiscountParams struct {
    Params `form:"*"`
}

DiscountParams is the set of parameters that can be used when deleting a discount.

type Dispute Uses

type Dispute struct {
    Amount          uint64            `json:"amount"`
    Charge          string            `json:"charge"`
    Created         int64             `json:"created"`
    Currency        Currency          `json:"currency"`
    Evidence        *DisputeEvidence  `json:"evidence"`
    EvidenceDetails *EvidenceDetails  `json:"evidence_details"`
    ID              string            `json:"id"`
    Live            bool              `json:"livemode"`
    Meta            map[string]string `json:"metadata"`
    Reason          DisputeReason     `json:"reason"`
    Refundable      bool              `json:"is_charge_refundable"`
    Status          DisputeStatus     `json:"status"`
    Transactions    []*Transaction    `json:"balance_transactions"`
}

Dispute is the resource representing a Stripe dispute. For more details see https://stripe.com/docs/api#disputes.

func (*Dispute) UnmarshalJSON Uses

func (t *Dispute) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a Dispute. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type DisputeEvidence Uses

type DisputeEvidence struct {
    ActivityLog                  string `json:"access_activity_log"`
    BillingAddress               string `json:"billing_address"`
    CancellationPolicy           *File  `json:"cancellation_policy"`
    CancellationPolicyDisclosure string `json:"cancellation_policy_disclosure"`
    CancellationRebuttal         string `json:"cancellation_rebuttal"`
    CustomerComm                 *File  `json:"customer_communication"`
    CustomerEmail                string `json:"customer_email_address"`
    CustomerIP                   string `json:"customer_purchase_ip"`
    CustomerName                 string `json:"customer_name"`
    CustomerSig                  *File  `json:"customer_signature"`
    DuplicateCharge              string `json:"duplicate_charge_id"`
    DuplicateChargeDoc           *File  `json:"duplicate_charge_documentation"`
    DuplicateChargeReason        string `json:"duplicate_charge_explanation"`
    ProductDesc                  string `json:"product_description"`
    Receipt                      *File  `json:"receipt"`
    RefundPolicy                 *File  `json:"refund_policy"`
    RefundPolicyDisclosure       string `json:"refund_policy_disclosure"`
    RefundRefusalReason          string `json:"refund_refusal_explanation"`
    ServiceDate                  string `json:"service_date"`
    ServiceDoc                   *File  `json:"service_documentation"`
    ShippingAddress              string `json:"shipping_address"`
    ShippingCarrier              string `json:"shipping_carrier"`
    ShippingDate                 string `json:"shipping_date"`
    ShippingDoc                  *File  `json:"shipping_documentation"`
    ShippingTracking             string `json:"shipping_tracking_number"`
    UncategorizedFile            *File  `json:"uncategorized_file"`
    UncategorizedText            string `json:"uncategorized_text"`
}

DisputeEvidence is the structure that contains various details about the evidence submitted for the dispute. Almost all fields are strings since there structures (i.e. address) do not typically get parsed by anyone and are thus presented as-received.

type DisputeEvidenceParams Uses

type DisputeEvidenceParams struct {
    ActivityLog                  string `form:"access_activity_log"`
    BillingAddress               string `form:"billing_address"`
    CancellationPolicy           string `form:"cancellation_policy"`
    CancellationPolicyDisclsoure string `form:"cancellation_policy_disclosure"`
    CancellationRebuttal         string `form:"cancellation_rebuttal"`
    CustomerComm                 string `form:"customer_communication"`
    CustomerEmail                string `form:"customer_email_address"`
    CustomerIP                   string `form:"customer_purchase_ip"`
    CustomerName                 string `form:"customer_name"`
    CustomerSig                  string `form:"customer_signature"`
    DuplicateCharge              string `form:"duplicate_charge_id"`
    DuplicateChargeDoc           string `form:"duplicate_charge_documentation"`
    DuplicateChargeReason        string `form:"duplicate_charge_explanation"`
    ProductDesc                  string `form:"product_description"`
    Receipt                      string `form:"receipt"`
    RefundPolicy                 string `form:"refund_policy"`
    RefundPolicyDisclosure       string `form:"refund_policy_disclosure"`
    RefundRefusalReason          string `form:"refund_refusal_explanation"`
    ServiceDate                  string `form:"service_date"`
    ServiceDoc                   string `form:"service_documentation"`
    ShippingAddress              string `form:"shipping_address"`
    ShippingCarrier              string `form:"shipping_carrier"`
    ShippingDate                 string `form:"shipping_date"`
    ShippingDoc                  string `form:"shipping_documentation"`
    ShippingTracking             string `form:"shipping_tracking_number"`
    UncategorizedFile            string `form:"uncategorized_file"`
    UncategorizedText            string `form:"uncategorized_text"`
}

DisputeEvidenceParams is the set of parameters that can be used when submitting evidence for disputes.

type DisputeList Uses

type DisputeList struct {
    ListMeta
    Values []*Dispute `json:"data"`
}

DisputeList is a list of disputes as retrieved from a list endpoint.

type DisputeListParams Uses

type DisputeListParams struct {
    ListParams   `form:"*"`
    Created      int64             `form:"created"`
    CreatedRange *RangeQueryParams `form:"created"`
}

DisputeListParams is the set of parameters that can be used when listing disputes. For more details see https://stripe.com/docs/api#list_disputes.

type DisputeParams Uses

type DisputeParams struct {
    Params   `form:"*"`
    Evidence *DisputeEvidenceParams `form:"evidence"`
    NoSubmit bool                   `form:"submit,invert"`
}

DisputeParams is the set of parameters that can be used when updating a dispute. For more details see https://stripe.com/docs/api#update_dispute.

type DisputeReason Uses

type DisputeReason string

DisputeReason is the list of allowed values for a discount's reason. Allowed values are "duplicate", "fraudulent", "subscription_canceled", "product_unacceptable", "product_not_received", "unrecognized", "credit_not_processed", "general".

type DisputeStatus Uses

type DisputeStatus string

DisputeStatus is the list of allowed values for a discount's status. Allowed values are "won", "lost", "needs_response", "under_review", "warning_needs_response", "warning_under_review", "charge_refunded", "warning_closed".

type EphemeralKey Uses

type EphemeralKey struct {
    AssociatedObjects []struct {
        ID   string `json:"id"`
        Type string `json:"type"`
    }   `json:"associated_objects"`

    Created int64  `json:"created"`
    Expires int64  `json:"expires"`
    ID      string `json:"id"`
    Live    bool   `json:"livemode"`

    // RawJSON is provided so that it may be passed back to the frontend
    // unchanged.  Ephemeral keys are issued on behalf of another client which
    // may be running a different version of the bindings and thus expect a
    // different JSON structure.  This ensures that if the structure differs
    // from the version of these bindings, we can still pass back a compatible
    // key.
    RawJSON []byte `json:"-"`
}

EphemeralKey is the resource representing a Stripe ephemeral key. For more details see https://stripe.com/docs/api#ephemeral_keys.

func (*EphemeralKey) UnmarshalJSON Uses

func (e *EphemeralKey) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of an EphemeralKey. This custom unmarshaling is needed because we need to store the raw JSON on the object so it may be passed back to the frontend.

type EphemeralKeyParams Uses

type EphemeralKeyParams struct {
    Params        `form:"*"`
    Customer      string `form:"customer"`
    StripeVersion string `form:"-"` // This goes in the `Stripe-Version` header
}

EphemeralKeyParams is the set of parameters that can be used when creating an ephemeral key. For more details see https://stripe.com/docs/api#ephemeral_keys.

type Error Uses

type Error struct {
    ChargeID string    `json:"charge,omitempty"`
    Code     ErrorCode `json:"code,omitempty"`

    // Err contains an internal error with an additional level of granularity
    // that can be used in some cases to get more detailed information about
    // what went wrong. For example, Err may hold a ChargeError that indicates
    // exactly what went wrong during a charge.
    Err error `json:"-"`

    HTTPStatusCode int       `json:"status,omitempty"`
    Msg            string    `json:"message"`
    Param          string    `json:"param,omitempty"`
    RequestID      string    `json:"request_id,omitempty"`
    Type           ErrorType `json:"type"`
}

Error is the response returned when a call is unsuccessful. For more details see https://stripe.com/docs/api#errors.

func (*Error) Error Uses

func (e *Error) Error() string

Error serializes the error object to JSON and returns it as a string.

type ErrorCode Uses

type ErrorCode string

ErrorCode is the list of allowed values for the error's code.

type ErrorType Uses

type ErrorType string

ErrorType is the list of allowed values for the error's type.

type EstimateType Uses

type EstimateType string
const (
    Exact EstimateType = "exact"
    Range EstimateType = "range"
)

type Event Uses

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

Event is the resource representing a Stripe event. For more details see https://stripe.com/docs/api#events.

func (*Event) GetObjValue Uses

func (e *Event) GetObjValue(keys ...string) string

GetObjValue returns the value from the e.Data.Obj bag based on the keys hierarchy.

func (*Event) GetPrevValue Uses

func (e *Event) GetPrevValue(keys ...string) string

GetPrevValue returns the value from the e.Data.Prev bag based on the keys hierarchy.

type EventData Uses

type EventData struct {
    Obj  map[string]interface{}
    Prev map[string]interface{} `json:"previous_attributes"`
    Raw  json.RawMessage        `json:"object"`
}

EventData is the unmarshalled object as a map.

func (*EventData) UnmarshalJSON Uses

func (e *EventData) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of the EventData. This custom unmarshaling exists so that we can keep both the map and raw data.

type EventList Uses

type EventList struct {
    ListMeta
    Values []*Event `json:"data"`
}

EventList is a list of events as retrieved from a list endpoint.

type EventListParams Uses

type EventListParams struct {
    ListParams   `form:"*"`
    Created      int64             `form:"created"`
    CreatedRange *RangeQueryParams `form:"created"`
    Type         string            `form:"type"`
    Types        []string          `form:"types"`
}

EventListParams is the set of parameters that can be used when listing events. For more details see https://stripe.com/docs/api#list_events.

type EventRequest Uses

type EventRequest struct {
    // ID is the request ID of the request that created an event, if the event
    // was created by a request.
    ID  string `json:"id"`

    // IdempotencyKey is the idempotency key of the request that created an
    // event, if the event was created by a request and if an idempotency key
    // was specified for that request.
    IdempotencyKey string `json:"idempotency_key"`
}

EventRequest contains information on a request that created an event.

type EvidenceDetails Uses

type EvidenceDetails struct {
    Count       int   `json:"submission_count"`
    DueDate     int64 `json:"due_by"`
    HasEvidence bool  `json:"has_evidence"`
    PastDue     bool  `json:"past_due"`
}

EvidenceDetails is the structure representing more details about the dispute.

type ExternalAccount Uses

type ExternalAccount struct {
    // BankAccount is a bank account attached to an account. Populated only if
    // the external account is a bank account.
    BankAccount *BankAccount

    // Card is a card attached to an account. Populated only if the external
    // account is a card.
    Card *Card

    ID   string              `json:"id"`
    Type ExternalAccountType `json:"object"`
}

ExternalAccount is an external account (a bank account or card) that's attached to an account. It contains fields that will be conditionally populated depending on its type.

func (*ExternalAccount) UnmarshalJSON Uses

func (ea *ExternalAccount) UnmarshalJSON(b []byte) error

UnmarshalJSON implements Unmarshaler.UnmarshalJSON.

type ExternalAccountList Uses

type ExternalAccountList struct {
    ListMeta

    // Values contains any external accounts (bank accounts and/or cards)
    // currently attached to this account.
    Values []*ExternalAccount `json:"data"`
}

ExternalAccountList is a list of external accounts that may be either bank accounts or cards.

type ExternalAccountType Uses

type ExternalAccountType string

ExternalAccountType is the type of an external account.

const (
    // ExternalAccountTypeBankAccount is a constant value representing an external
    // account which is a bank account.
    ExternalAccountTypeBankAccount ExternalAccountType = "bank_account"

    // ExternalAccountTypeCard is a constant value representing an external account
    // which is a card.
    ExternalAccountTypeCard ExternalAccountType = "card"
)

type ExtraValues Uses

type ExtraValues struct {
    url.Values `form:"-"` // See custom AppendTo implementation
}

ExtraValues are extra parameters that are attached to an API request. They're implemented as a custom type so that they can have their own AppendTo implementation.

func (ExtraValues) AppendTo Uses

func (v ExtraValues) AppendTo(body *form.Values, keyParts []string)

AppendTo implements custom form encoding for extra parameter values.

type Fee Uses

type Fee struct {
    Account                *Account       `json:"account"`
    Amount                 uint64         `json:"amount"`
    AmountRefunded         uint64         `json:"amount_refunded"`
    App                    string         `json:"application"`
    Charge                 *Charge        `json:"charge"`
    Created                int64          `json:"created"`
    Currency               Currency       `json:"currency"`
    ID                     string         `json:"id"`
    Live                   bool           `json:"livemode"`
    OriginatingTransaction *Charge        `json:"originating_transaction"`
    Refunded               bool           `json:"refunded"`
    Refunds                *FeeRefundList `json:"refunds"`
    Tx                     *Transaction   `json:"balance_transaction"`
}

Fee is the resource representing a Stripe application fee. For more details see https://stripe.com/docs/api#application_fees.

func (*Fee) UnmarshalJSON Uses

func (f *Fee) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a Fee. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type FeeList Uses

type FeeList struct {
    ListMeta
    Values []*Fee `json:"data"`
}

FeeList is a list of fees as retrieved from a list endpoint.

type FeeListParams Uses

type FeeListParams struct {
    ListParams   `form:"*"`
    Charge       string            `form:"charge"`
    Created      int64             `form:"created"`
    CreatedRange *RangeQueryParams `form:"created"`
}

FeeListParams is the set of parameters that can be used when listing application fees. For more details see https://stripe.com/docs/api#list_application_fees.

type FeeParams Uses

type FeeParams struct {
    Params `form:"*"`
    Amount uint64
}

FeeParams is the set of parameters that can be used when refunding an application fee. For more details see https://stripe.com/docs/api#refund_application_fee.

type FeeRefund Uses

type FeeRefund struct {
    Amount   uint64            `json:"amount"`
    Created  int64             `json:"created"`
    Currency Currency          `json:"currency"`
    Fee      string            `json:"fee"`
    ID       string            `json:"id"`
    Meta     map[string]string `json:"metadata"`
    Tx       *Transaction      `json:"balance_transaction"`
}

FeeRefund is the resource representing a Stripe fee refund. For more details see https://stripe.com/docs/api#fee_refunds.

func (*FeeRefund) UnmarshalJSON Uses

func (f *FeeRefund) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a FeeRefund. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type FeeRefundList Uses

type FeeRefundList struct {
    ListMeta
    Values []*FeeRefund `json:"data"`
}

FeeRefundList is a list object for fee refunds.

type FeeRefundListParams Uses

type FeeRefundListParams struct {
    ListParams `form:"*"`
    Fee        string `form:"-"` // Included in the URL
}

FeeRefundListParams is the set of parameters that can be used when listing fee refunds. For more details see https://stripe.com/docs/api#list_fee_refunds.

type FeeRefundParams Uses

type FeeRefundParams struct {
    Params `form:"*"`
    Amount uint64 `form:"amount"`
    Fee    string `form:"-"` // Included in the URL
}

FeeRefundParams is the set of parameters that can be used when refunding a fee. For more details see https://stripe.com/docs/api#fee_refund.

type File Uses

type File struct {
    Created int64  `json:"created"`
    ID      string `json:"id"`
    Mime    string `json:"mime_type"`
    Purpose string `json:"purpose"`
    Size    int    `json:"size"`
    URL     string `json:"url"`
}

File represents a link to downloadable content.

func (*File) UnmarshalJSON Uses

func (f *File) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a File. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type FileUpload Uses

type FileUpload struct {
    Created int64             `json:"created"`
    ID      string            `json:"id"`
    Purpose FileUploadPurpose `json:"purpose"`
    Size    int64             `json:"size"`
    Type    string            `json:"type"`
    URL     string            `json:"url"`
}

FileUpload is the resource representing a Stripe file upload. For more details see https://stripe.com/docs/api#file_uploads.

func (*FileUpload) UnmarshalJSON Uses

func (f *FileUpload) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a FileUpload. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type FileUploadList Uses

type FileUploadList struct {
    ListMeta
    Values []*FileUpload `json:"data"`
}

FileUploadList is a list of file uploads as retrieved from a list endpoint.

type FileUploadListParams Uses

type FileUploadListParams struct {
    ListParams   `form:"*"`
    Created      int64             `form:"created"`
    CreatedRange *RangeQueryParams `form:"created"`
    Purpose      FileUploadPurpose `form:"purpose"`
}

FileUploadListParams is the set of parameters that can be used when listing file uploads. For more details see https://stripe.com/docs/api#list_file_uploads.

type FileUploadParams Uses

type FileUploadParams struct {
    Params `form:"*"`

    // File is a deprecated form of FileReader and Filename that will do the same thing, but
    // allows referencing a file directly. Please prefer the use of FileReader and Filename instead.
    File *os.File

    // FileReader is a reader with the contents of the file that should be uploaded.
    FileReader io.Reader

    // Filename is just the name of the file without path information.
    Filename string

    Purpose FileUploadPurpose
}

FileUploadParams is the set of parameters that can be used when creating a file upload. For more details see https://stripe.com/docs/api#create_file_upload.

func (*FileUploadParams) AppendDetails Uses

func (f *FileUploadParams) AppendDetails(body io.ReadWriter) (string, error)

AppendDetails adds the file upload details to an io.ReadWriter. It returns the boundary string for a multipart/form-data request and an error (if one exists).

type FileUploadPurpose Uses

type FileUploadPurpose string

FileUploadPurpose is the purpose of a particular file upload. Allowed values are "dispute_evidence" and "identity_document".

type Filters Uses

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

Filters is a structure that contains a collection of filters for list-related APIs.

func (*Filters) AddFilter Uses

func (f *Filters) AddFilter(key, op, value string)

AddFilter adds a new filter with a given key, op and value.

func (Filters) AppendTo Uses

func (f Filters) AppendTo(body *form.Values, keyParts []string)

AppendTo implements custom form encoding for filters.

type FraudDetails Uses

type FraudDetails struct {
    UserReport   FraudReport `json:"user_report"`
    StripeReport FraudReport `json:"stripe_report"`
}

FraudDetails is the structure detailing fraud status.

type FraudDetailsParams Uses

type FraudDetailsParams struct {
    UserReport FraudReport `form:"user_report"`
}

FraudDetailsParams provides information on the fraud details for a charge.

type FraudReport Uses

type FraudReport string

FraudReport is the list of allowed values for reporting fraud. Allowed values are "fraudulent", "safe".

type Gender Uses

type Gender string

Gender is the gender of an account owner. International regulations require either “male” or “female”.

type IdentityDocument Uses

type IdentityDocument struct {
    Created int64  `json:"created" form:"-"`
    ID      string `json:"id" form:"-"` // See custom AppendTo implementation
    Size    int64  `json:"size" form:"-"`
}

IdentityDocument is the structure for an identity document.

func (*IdentityDocument) AppendTo Uses

func (d *IdentityDocument) AppendTo(body *form.Values, keyParts []string)

AppendTo implements custom form encoding for IdentityDocument. In the Go library, it's suggested that users initialize an IdentityDocument and fill its ID when updating an account, but in the API's account update method, there is no subobject; you simply pass an ID into the document field.

The inherent cause of this asymmetry is that instead of creating separate structs for parameters (which are normally separate from the structs used for responses), someone decided to reuse them instead, and although request and response constructs are similar, they're not identical, thus the discrepancy.

Long term, we should create separate parameter structs. This isn't hard, but is breaking, and will be somewhat painful for users when they upgrade.

func (*IdentityDocument) UnmarshalJSON Uses

func (d *IdentityDocument) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of an IdentityDocument. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type IdentityVerification Uses

type IdentityVerification struct {
    Details     *string                         `json:"details" form:"-"`
    DetailsCode IdentityVerificationDetailsCode `json:"details_code" form:"-"`
    Document    *IdentityDocument               `json:"document" form:"document"`
    Status      IdentityVerificationStatus      `json:"status" form:"-"`
}

IdentityVerification is the structure for an account's verification.

type IdentityVerificationDetailsCode Uses

type IdentityVerificationDetailsCode string

IdentityVerificationDetailsCode is a machine-readable code specifying the verification state of a legal entity. Allowed values are "failed_keyed_identity", "failed_other", "scan_corrupt", "scan_failed_greyscale", "scan_failed_other", "scan_id_country_not_supported", "scan_id_type_not_supported", "scan_name_mismatch", "scan_not_readable", "scan_not_uploaded".

type IdentityVerificationStatus Uses

type IdentityVerificationStatus string

IdentityVerificationStatus describes the different statuses for identity verification. Allowed values are "pending", "verified", "unverified".

type Interval Uses

type Interval string

Interval describes the payout interval. Allowed values are "manual", "daily", "weekly", "monthly".

type InvalidRequestError Uses

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

InvalidRequestError is an error that occurs when a request contains invalid parameters.

func (*InvalidRequestError) Error Uses

func (e *InvalidRequestError) Error() string

Error serializes the error object to JSON and returns it as a string.

type Inventory Uses

type Inventory struct {
    Quantity int64  `json:"quantity" form:"quantity"`
    Type     string `json:"type" form:"type"`
    Value    string `json:"value" form:"value"`
}

type Invoice Uses

type Invoice struct {
    Amount        int64             `json:"amount_due"`
    Attempted     bool              `json:"attempted"`
    Attempts      uint64            `json:"attempt_count"`
    Billing       InvoiceBilling    `json:"billing"`
    Charge        *Charge           `json:"charge"`
    Closed        bool              `json:"closed"`
    Currency      Currency          `json:"currency"`
    Customer      *Customer         `json:"customer"`
    Date          int64             `json:"date"`
    Desc          string            `json:"description"`
    Discount      *Discount         `json:"discount"`
    DueDate       int64             `json:"due_date"`
    End           int64             `json:"period_end"`
    EndBalance    int64             `json:"ending_balance"`
    Fee           uint64            `json:"application_fee"`
    Forgive       bool              `json:"forgiven"`
    ID            string            `json:"id"`
    Lines         *InvoiceLineList  `json:"lines"`
    Live          bool              `json:"livemode"`
    Meta          map[string]string `json:"metadata"`
    NextAttempt   int64             `json:"next_payment_attempt"`
    Number        string            `json:"number"`
    Paid          bool              `json:"paid"`
    ReceiptNumber string            `json:"receipt_number"`
    Start         int64             `json:"period_start"`
    StartBalance  int64             `json:"starting_balance"`
    Statement     string            `json:"statement_descriptor"`
    Sub           string            `json:"subscription"`
    Subtotal      int64             `json:"subtotal"`
    Tax           int64             `json:"tax"`
    TaxPercent    float64           `json:"tax_percent"`
    Total         int64             `json:"total"`
    Webhook       int64             `json:"webhooks_delivered_at"`
}

Invoice is the resource representing a Stripe invoice. For more details see https://stripe.com/docs/api#invoice_object.

Code:

stripe.Key = "sk_key"

params := &stripe.InvoiceParams{
    Desc: "updated description",
}

inv, err := invoice.Update("sub_example_id", params)

if err != nil {
    log.Fatal(err)
}

log.Printf("%v\n", inv.Desc)

func (*Invoice) UnmarshalJSON Uses

func (i *Invoice) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of an Invoice. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type InvoiceBilling Uses

type InvoiceBilling string

InvoiceBilling is the type of billing method for this invoice. Currently supported values are "send_invoice" and "charge_automatically".

type InvoiceItem Uses

type InvoiceItem struct {
    Amount       int64             `json:"amount"`
    Currency     Currency          `json:"currency"`
    Customer     *Customer         `json:"customer"`
    Date         int64             `json:"date"`
    Deleted      bool              `json:"deleted"`
    Desc         string            `json:"description"`
    Discountable bool              `json:"discountable"`
    ID           string            `json:"id"`
    Invoice      *Invoice          `json:"invoice"`
    Live         bool              `json:"livemode"`
    Meta         map[string]string `json:"metadata"`
    Period       *Period           `json:"period"`
    Plan         *Plan             `json:"plan"`
    Proration    bool              `json:"proration"`
    Quantity     int64             `json:"quantity"`
    Sub          string            `json:"subscription"`
}

InvoiceItem is the resource represneting a Stripe invoice item. For more details see https://stripe.com/docs/api#invoiceitems.

func (*InvoiceItem) UnmarshalJSON Uses

func (i *InvoiceItem) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of an InvoiceItem. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type InvoiceItemList Uses

type InvoiceItemList struct {
    ListMeta
    Values []*InvoiceItem `json:"data"`
}

InvoiceItemList is a list of invoice items as retrieved from a list endpoint.

type InvoiceItemListParams Uses

type InvoiceItemListParams struct {
    ListParams   `form:"*"`
    Created      int64             `form:"created"`
    CreatedRange *RangeQueryParams `form:"created"`
    Customer     string            `form:"customer"`
}

InvoiceItemListParams is the set of parameters that can be used when listing invoice items. For more details see https://stripe.com/docs/api#list_invoiceitems.

type InvoiceItemParams Uses

type InvoiceItemParams struct {
    Params         `form:"*"`
    Amount         int64    `form:"amount"`
    Currency       Currency `form:"currency"`
    Customer       string   `form:"customer"`
    Desc           string   `form:"description"`
    Discountable   bool     `form:"discountable"`
    Invoice        string   `form:"invoice"`
    NoDiscountable bool     `form:"discountable,invert"`
    Sub            string   `form:"subscription"`
}

InvoiceItemParams is the set of parameters that can be used when creating or updating an invoice item. For more details see https://stripe.com/docs/api#create_invoiceitem and https://stripe.com/docs/api#update_invoiceitem.

type InvoiceLine Uses

type InvoiceLine struct {
    Amount       int64             `json:"amount"`
    Currency     Currency          `json:"currency"`
    Desc         string            `json:"description"`
    Discountable bool              `json:"discountable"`
    ID           string            `json:"id"`
    Live         bool              `json:"live_mode"`
    Meta         map[string]string `json:"metadata"`
    Period       *Period           `json:"period"`
    Plan         *Plan             `json:"plan"`
    Proration    bool              `json:"proration"`
    Quantity     int64             `json:"quantity"`
    Sub          string            `json:"subscription"`
    Type         InvoiceLineType   `json:"type"`
}

InvoiceLine is the resource representing a Stripe invoice line item. For more details see https://stripe.com/docs/api#invoice_line_item_object.

type InvoiceLineList Uses

type InvoiceLineList struct {
    ListMeta
    Values []*InvoiceLine `json:"data"`
}

InvoiceLineList is a list object for invoice line items.

type InvoiceLineListParams Uses

type InvoiceLineListParams struct {
    ListParams `form:"*"`

    Customer string `form:"customer"`

    // ID is the invoice ID to list invoice lines for.
    ID  string `form:"-"` // Goes in the URL

    Sub string `form:"subscription"`
}

InvoiceLineListParams is the set of parameters that can be used when listing invoice line items. For more details see https://stripe.com/docs/api#invoice_lines.

type InvoiceLineType Uses

type InvoiceLineType string

InvoiceLineType is the list of allowed values for the invoice line's type. Allowed values are "invoiceitem", "subscription".

type InvoiceList Uses

type InvoiceList struct {
    ListMeta
    Values []*Invoice `json:"data"`
}

InvoiceList is a list of invoices as retrieved from a list endpoint.

type InvoiceListParams Uses

type InvoiceListParams struct {
    ListParams `form:"*"`
    Billing    InvoiceBilling    `form:"billing"`
    Customer   string            `form:"customer"`
    Date       int64             `form:"date"`
    DateRange  *RangeQueryParams `form:"date"`
    DueDate    int64             `form:"due_date"`
    Sub        string            `form:"subscription"`
}

InvoiceListParams is the set of parameters that can be used when listing invoices. For more details see https://stripe.com/docs/api#list_customer_invoices.

type InvoiceParams Uses

type InvoiceParams struct {
    Params         `form:"*"`
    Billing        InvoiceBilling `form:"billing"`
    Closed         bool           `form:"closed"`
    Customer       string         `form:"customer"`
    DaysUntilDue   uint64         `form:"days_until_due"`
    Desc           string         `form:"description"`
    DueDate        int64          `form:"due_date"`
    Fee            uint64         `form:"application_fee"`
    FeeZero        bool           `form:"application_fee,zero"`
    Forgive        bool           `form:"forgiven"`
    NoClosed       bool           `form:"closed,invert"`
    Paid           bool           `form:"paid"`
    Statement      string         `form:"statement_descriptor"`
    Sub            string         `form:"subscription"`
    TaxPercent     float64        `form:"tax_percent"`
    TaxPercentZero bool           `form:"tax_percent,zero"`

    SubItems         []*SubItemsParams `form:"subscription_items,indexed"`
    SubNoProrate     bool              `form:"subscription_prorate,invert"`
    SubPlan          string            `form:"subscription_plan"`
    SubProrationDate int64             `form:"subscription_proration_date"`
    SubQuantity      uint64            `form:"subscription_quantity"`
    SubQuantityZero  bool              `form:"subscription_quantity,zero"`
    SubTrialEnd      int64             `form:"subscription_trial_end"`
}

InvoiceParams is the set of parameters that can be used when creating or updating an invoice. For more details see https://stripe.com/docs/api#create_invoice, https://stripe.com/docs/api#update_invoice.

type InvoicePayParams Uses

type InvoicePayParams struct {
    Params `form:"*"`
    Source string `form:"source"`
}

InvoicePayParams is the set of parameters that can be used when paying invoices. For more details, see: https://stripe.com/docs/api#pay_invoice.

type Iter Uses

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

Iter provides a convenient interface for iterating over the elements returned from paginated list API calls. Successive calls to the Next method will step through each item in the list, fetching pages of items as needed. Iterators are not thread-safe, so they should not be consumed across multiple goroutines.

func GetIter Uses

func GetIter(params *ListParams, qs *form.Values, query Query) *Iter

GetIter returns a new Iter for a given query and its options.

func (*Iter) Current Uses

func (it *Iter) Current() interface{}

Current returns the most recent item visited by a call to Next.

func (*Iter) Err Uses

func (it *Iter) Err() error

Err returns the error, if any, that caused the Iter to stop. It must be inspected after Next returns false.

func (*Iter) Meta Uses

func (it *Iter) Meta() *ListMeta

Meta returns the list metadata.

func (*Iter) Next Uses

func (it *Iter) Next() bool

Next advances the Iter to the next item in the list, which will then be available through the Current method. It returns false when the iterator stops at the end of the list.

type LegalEntity Uses

type LegalEntity struct {
    AdditionalOwners []Owner `json:"additional_owners" form:"additional_owners,indexed"`

    // AdditionalOwnersEmpty can be set to clear a legal entity's additional
    // owners.
    AdditionalOwnersEmpty bool `form:"additional_owners,empty"`

    Address               Address              `json:"address" form:"address"`
    AddressKana           Address              `json:"address_kana" form:"address_kana"`
    AddressKanji          Address              `json:"address_kanji" form:"address_kanji"`
    BusinessName          string               `json:"business_name" form:"business_name"`
    BusinessNameKana      string               `json:"business_name_kana" form:"business_name_kana"`
    BusinessNameKanji     string               `json:"business_name_kanji" form:"business_name_kanji"`
    BusinessTaxID         string               `json:"-" form:"business_tax_id"`
    BusinessTaxIDProvided bool                 `json:"business_tax_id_provided" form:"-"`
    BusinessVatID         string               `json:"-" form:"business_vat_id"`
    BusinessVatIDProvided bool                 `json:"business_vat_id_provided" form:"-"`
    DOB                   DOB                  `json:"dob" form:"dob"`
    First                 string               `json:"first_name" form:"first_name"`
    FirstKana             string               `json:"first_name_kana" form:"first_name_kana"`
    FirstKanji            string               `json:"first_name_kanji" form:"first_name_kanji"`
    Gender                Gender               `json:"gender" form:"gender"`
    Last                  string               `json:"last_name" form:"last_name"`
    LastKana              string               `json:"last_name_kana" form:"last_name_kana"`
    LastKanji             string               `json:"last_name_kanji" form:"last_name_kanji"`
    MaidenName            string               `json:"maiden_name" form:"maiden_name"`
    PersonalAddress       Address              `json:"personal_address" form:"personal_address"`
    PersonalAddressKana   Address              `json:"personal_address_kana" form:"personal_address_kana"`
    PersonalAddressKanji  Address              `json:"personal_address_kanji" form:"personal_address_kanji"`
    PersonalID            string               `json:"-" form:"personal_id_number"`
    PersonalIDProvided    bool                 `json:"personal_id_number_provided" form:"-"`
    PhoneNumber           string               `json:"phone_number" form:"phone_number"`
    SSN                   string               `json:"-" form:"ssn_last_4"`
    SSNProvided           bool                 `json:"ssn_last_4_provided" form:"-"`
    Type                  LegalEntityType      `json:"type" form:"type"`
    Verification          IdentityVerification `json:"verification" form:"verification"`
}

LegalEntity is the structure for properties related to an account's legal state.

type LegalEntityType Uses

type LegalEntityType string

LegalEntityType describes the types for a legal entity. Allowed values are "individual", "company".

type ListMeta Uses

type ListMeta struct {
    Count uint32 `json:"total_count"`
    More  bool   `json:"has_more"`
    URL   string `json:"url"`
}

ListMeta is the structure that contains the common properties of List iterators. The Count property is only populated if the total_count include option is passed in (see tests for example).

type ListParams Uses

type ListParams struct {
    End     string   `form:"ending_before"`
    Exp     []string `form:"expand"`
    Filters Filters  `form:"*"`
    Limit   int      `form:"limit"`

    // Single specifies whether this is a single page iterator. By default,
    // listing through an iterator will automatically grab additional pages as
    // the query progresses. To change this behavior and just load a single
    // page, set this to true.
    Single bool `form:"-"` // Not an API parameter

    Start string `form:"starting_after"`

    // StripeAccount may contain the ID of a connected account. By including
    // this field, the request is made as if it originated from the connected
    // account instead of under the account of the owner of the configured
    // Stripe key.
    StripeAccount string `form:"-"` // Passed as header
}

ListParams is the structure that contains the common properties of any *ListParams structure.

func (*ListParams) Expand Uses

func (p *ListParams) Expand(f string)

Expand appends a new field to expand.

func (*ListParams) ToParams Uses

func (p *ListParams) ToParams() *Params

ToParams converts a ListParams to a Params by moving over any fields that have valid targets in the new type. This is useful because fields in Params can be injected directly into an http.Request while generally ListParams is only used to build a set of parameters.

type LoginLink struct {
    Created int64  `json:"created"`
    Url     string `json:"url"`
}

LoginLink is the resource representing a login link for Express accounts. For more details see https://stripe.com/docs/api#login_link_object

type LoginLinkParams Uses

type LoginLinkParams struct {
    Account string `form:"-"` // Included in URL
}

LoginLinkParams is the set of parameters that can be used when creating a login_link. For more details see https://stripe.com/docs/api#create_login_link.

type Order Uses

type Order struct {
    Amount                 int64             `json:"amount"`
    AmountReturned         int64             `json:"amount_returned"`
    Application            string            `json:"application"`
    ApplicationFee         int64             `json:"application_fee"`
    Charge                 Charge            `json:"charge"`
    Created                int64             `json:"created"`
    Currency               Currency          `json:"currency"`
    Customer               Customer          `json:"customer"`
    Email                  string            `json:"email"`
    ID                     string            `json:"id"`
    Items                  []OrderItem       `json:"items"`
    Live                   bool              `json:"livemode"`
    Meta                   map[string]string `json:"metadata"`
    Returns                *OrderReturnList  `json:"returns"`
    SelectedShippingMethod *string           `json:"selected_shipping_method"`
    Shipping               Shipping          `json:"shipping"`
    ShippingMethods        []ShippingMethod  `json:"shipping_methods"`
    Status                 OrderStatus       `json:"status"`
    StatusTransitions      StatusTransitions `json:"status_transitions"`
    Updated                int64             `json:"updated"`
}

func (*Order) UnmarshalJSON Uses

func (o *Order) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of an Order. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type OrderItem Uses

type OrderItem struct {
    Amount      int64              `json:"amount"`
    Currency    Currency           `json:"currency"`
    Description string             `json:"description"`
    Parent      string             `json:"parent"`
    Quantity    int64              `json:"quantity"`
    Type        orderitem.ItemType `json:"type"`
}

type OrderItemParams Uses

type OrderItemParams struct {
    Amount      int64              `form:"amount"`
    Currency    Currency           `form:"currency"`
    Description string             `form:"description"`
    Parent      string             `form:"parent"`
    Quantity    *int64             `form:"quantity"`
    Type        orderitem.ItemType `form:"type"`
}

type OrderList Uses

type OrderList struct {
    ListMeta
    Values []*Order `json:"data"`
}

OrderList is a list of orders as retrieved from a list endpoint.

type OrderListParams Uses

type OrderListParams struct {
    ListParams   `form:"*"`
    Created      int64             `form:"created"`
    CreatedRange *RangeQueryParams `form:"created"`
    IDs          []string          `form:"ids"`
    Status       OrderStatus       `form:"status"`
}

OrderListParams is the set of parameters that can be used when listing orders. For more details, see: https://stripe.com/docs/api#list_orders.

type OrderParams Uses

type OrderParams struct {
    Params   `form:"*"`
    Coupon   string             `form:"coupon"`
    Currency Currency           `form:"currency"`
    Customer string             `form:"customer"`
    Email    string             `form:"email"`
    Items    []*OrderItemParams `form:"items,indexed"`
    Shipping *ShippingParams    `form:"shipping"`
}

type OrderPayParams Uses

type OrderPayParams struct {
    Params         `form:"*"`
    ApplicationFee int64         `form:"application_fee"`
    Customer       string        `form:"customer"`
    Email          string        `form:"email"`
    Source         *SourceParams `form:"*"` // SourceParams has custom encoding so brought to top level with "*"
}

OrderPayParams is the set of parameters that can be used when paying orders. For more details, see: https://stripe.com/docs/api#pay_order.

func (*OrderPayParams) SetSource Uses

func (op *OrderPayParams) SetSource(sp interface{}) error

SetSource adds valid sources to a OrderParams object, returning an error for unsupported sources.

type OrderReturn Uses

type OrderReturn struct {
    Amount   int64       `json:"amount"`
    Created  int64       `json:"created"`
    Currency Currency    `json:"currency"`
    ID       string      `json:"id"`
    Items    []OrderItem `json:"items"`
    Order    Order       `json:"order"`
    Live     bool        `json:"livemode"`
    Refund   *Refund     `json:"refund"`
}

func (*OrderReturn) UnmarshalJSON Uses

func (ret *OrderReturn) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of an OrderReturn. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type OrderReturnList Uses

type OrderReturnList struct {
    ListMeta
    Values []*OrderReturn `json:"data"`
}

OrderReturnList is a list of returns as retrieved from a list endpoint.

type OrderReturnListParams Uses

type OrderReturnListParams struct {
    ListParams   `form:"*"`
    Created      int64             `form:"created"`
    CreatedRange *RangeQueryParams `form:"created"`
    Order        string            `form:"order"`
}

OrderReturnListParams is the set of parameters that can be used when listing returns. For more details, see: https://stripe.com/docs/api#list_order_returns.

type OrderReturnParams Uses

type OrderReturnParams struct {
    Params `form:"*"`
    Items  []*OrderItemParams `form:"items,indexed"`
}

OrderReturnParams is the set of parameters that can be used when returning orders. For more details, see: https://stripe.com/docs/api#return_order.

type OrderStatus Uses

type OrderStatus string

OrderStatus represents the statuses of an order object.

const (
    StatusCanceled  OrderStatus = "canceled"
    StatusCreated   OrderStatus = "created"
    StatusFulfilled OrderStatus = "fulfilled"
    StatusPaid      OrderStatus = "paid"
    StatusReturned  OrderStatus = "returned"
)

type OrderUpdateParams Uses

type OrderUpdateParams struct {
    Params                 `form:"*"`
    Coupon                 string      `form:"coupon"`
    SelectedShippingMethod string      `form:"selected_shipping_method"`
    Status                 OrderStatus `form:"status"`
}

type Owner Uses

type Owner struct {
    Address      Address              `json:"address" form:"address"`
    DOB          DOB                  `json:"dob" form:"dob"`
    First        string               `json:"first_name" form:"first_name"`
    Last         string               `json:"last_name" form:"last_name"`
    Verification IdentityVerification `json:"verification" form:"verification"`
}

Owner is the structure for an account owner.

type PIIParams Uses

type PIIParams struct {
    Params           `form:"*"`
    PersonalIDNumber string `form:"personal_id_number"`
}

PIIParams are parameters for personal identifiable information (PII).

type PackageDimensions Uses

type PackageDimensions struct {
    Height float64 `json:"height" form:"height"`
    Length float64 `json:"length" form:"length"`
    Weight float64 `json:"weight" form:"weight"`
    Width  float64 `json:"width" form:"width"`
}

PackageDimensions represents the dimension of a product or a sku from the perspective of shipping.

type Params Uses

type Params struct {
    // Account is deprecated form of StripeAccount that will do the same thing.
    // Please use StripeAccount instead.
    Account string `form:"-"` // Passed as header

    Exp   []string     `form:"expand"`
    Extra *ExtraValues `form:"*"`

    // Headers may be used to provide extra header lines on the HTTP request.
    Headers http.Header `form:"-"`

    IdempotencyKey string            `form:"-"` // Passed as header
    Meta           map[string]string `form:"metadata"`

    // StripeAccount may contain the ID of a connected account. By including
    // this field, the request is made as if it originated from the connected
    // account instead of under the account of the owner of the configured
    // Stripe key.
    StripeAccount string `form:"-"` // Passed as header
}

Params is the structure that contains the common properties of any *Params structure.

func (*Params) AddExtra Uses

func (p *Params) AddExtra(key, value string)

AddExtra adds a new arbitrary key-value pair to the request data

func (*Params) AddMeta Uses

func (p *Params) AddMeta(key, value string)

AddMeta adds a new key-value pair to the Metadata.

func (*Params) Expand Uses

func (p *Params) Expand(f string)

Expand appends a new field to expand.

func (*Params) SetAccount Uses

func (p *Params) SetAccount(val string)

SetAccount sets a value for the Stripe-Account header.

func (*Params) SetStripeAccount Uses

func (p *Params) SetStripeAccount(val string)

SetStripeAccount sets a value for the Stripe-Account header.

type PaymentSource Uses

type PaymentSource struct {
    BankAccount     *BankAccount      `json:"-"`
    BitcoinReceiver *BitcoinReceiver  `json:"-"`
    Card            *Card             `json:"-"`
    Deleted         bool              `json:"deleted"`
    ID              string            `json:"id"`
    SourceObject    *Source           `json:"-"`
    Type            PaymentSourceType `json:"object"`
}

PaymentSource describes the payment source used to make a Charge. The Type should indicate which object is fleshed out (eg. BitcoinReceiver or Card) For more details see https://stripe.com/docs/api#retrieve_charge

func (*PaymentSource) MarshalJSON Uses

func (s *PaymentSource) MarshalJSON() ([]byte, error)

MarshalJSON handles serialization of a PaymentSource. This custom marshaling is needed because the specific type of payment instrument it represents is specified by the PaymentSourceType

func (*PaymentSource) UnmarshalJSON Uses

func (s *PaymentSource) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a PaymentSource. This custom unmarshaling is needed because the specific type of payment instrument it refers to is specified in the JSON

type PaymentSourceType Uses

type PaymentSourceType string

PaymentSourceType consts represent valid payment sources.

const (
    // PaymentSourceAccount is a constant representing a payment source which is
    // an account.
    PaymentSourceAccount PaymentSourceType = "account"

    // PaymentSourceBankAccount is a constant representing a payment source
    // which is a bank account.
    PaymentSourceBankAccount PaymentSourceType = "bank_account"

    // PaymentSourceBitcoinReceiver is a constant representing a payment source
    // which is a Bitcoin receiver.
    PaymentSourceBitcoinReceiver PaymentSourceType = "bitcoin_receiver"

    // PaymentSourceCard is a constant representing a payment source which is a
    // card.
    PaymentSourceCard PaymentSourceType = "card"

    // PaymentSourceObject is a constant representing a payment source which
    // is a top level source object (/v1/sources).
    PaymentSourceObject PaymentSourceType = "source"
)

type Payout Uses

type Payout struct {
    Amount                    int64             `json:"amount"`
    ArrivalDate               int64             `json:"arrival_date"`
    BalanceTransaction        *Transaction      `json:"balance_transaction"`
    Bank                      *BankAccount      `json:"bank_account"`
    Card                      *Card             `json:"card"`
    Created                   int64             `json:"created"`
    Currency                  Currency          `json:"currency"`
    Destination               PayoutDestination `json:"destination"`
    FailCode                  PayoutFailureCode `json:"failure_code"`
    FailMessage               string            `json:"failure_message"`
    FailureBalanceTransaction *Transaction      `json:"failure_balance_transaction"`
    ID                        string            `json:"id"`
    Live                      bool              `json:"livemode"`
    Meta                      map[string]string `json:"metadata"`
    Method                    PayoutMethodType  `json:"method"`
    SourceType                PayoutSourceType  `json:"source_type"`
    StatementDescriptor       string            `json:"statement_descriptor"`
    Status                    PayoutStatus      `json:"status"`
    Type                      PayoutType        `json:"type"`
}

Payout is the resource representing a Stripe payout. For more details see https://stripe.com/docs/api#payouts.

func (*Payout) UnmarshalJSON Uses

func (t *Payout) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a Payout. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type PayoutDestination Uses

type PayoutDestination struct {
    BankAccount *BankAccount          `json:"-"`
    Card        *Card                 `json:"-"`
    ID          string                `json:"id"`
    Type        PayoutDestinationType `json:"object"`
}

PayoutDestination describes the destination of a Payout. The Type should indicate which object is fleshed out For more details see https://stripe.com/docs/api/go#payout_object

func (*PayoutDestination) MarshalJSON Uses

func (d *PayoutDestination) MarshalJSON() ([]byte, error)

MarshalJSON handles serialization of a PayoutDestination. This custom marshaling is needed because we can only send a string ID as a destination, even though it can be expanded to a full object when retrieving

func (*PayoutDestination) UnmarshalJSON Uses

func (d *PayoutDestination) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a PayoutDestination. This custom unmarshaling is needed because the specific type of destination it refers to is specified in the JSON

type PayoutDestinationType Uses

type PayoutDestinationType string

PayoutDestinationType consts represent valid payout destinations.

const (
    // PayoutDestinationBankAccount is a constant representing a payout destination
    // which is a bank account.
    PayoutDestinationBankAccount PayoutDestinationType = "bank_account"

    // PayoutDestinationCard is a constant representing a payout destination
    // which is a card.
    PayoutDestinationCard PayoutDestinationType = "card"
)

type PayoutFailureCode Uses

type PayoutFailureCode string

PayoutFailureCode is the list of allowed values for the payout's failure code. Allowed values are "insufficient_funds", "account_closed", "no_account", "invalid_account_number", "debit_not_authorized", "bank_ownership_changed", "account_frozen", "could_not_process", "bank_account_restricted", "invalid_currency".

type PayoutList Uses

type PayoutList struct {
    ListMeta
    Values []*Payout `json:"data"`
}

PayoutList is a list of payouts as retrieved from a list endpoint.

type PayoutListParams Uses

type PayoutListParams struct {
    ListParams       `form:"*"`
    ArrivalDate      int64             `form:"arrival_date"`
    ArrivalDateRange *RangeQueryParams `form:"arrival_date"`
    Created          int64             `form:"created"`
    CreatedRange     *RangeQueryParams `form:"created"`
    Destination      string            `form:"destination"`
    Status           PayoutStatus      `form:"status"`
}

PayoutListParams is the set of parameters that can be used when listing payouts. For more details see https://stripe.com/docs/api#list_payouts.

type PayoutMethodType Uses

type PayoutMethodType string

PayoutMethodType represents the type of payout

const (
    // PayoutMethodInstant is a constant representing an instant payout
    PayoutMethodInstant PayoutMethodType = "instant"

    // PayoutMethodStandard is a constant representing a standard payout
    PayoutMethodStandard PayoutMethodType = "standard"
)

type PayoutParams Uses

type PayoutParams struct {
    Params              `form:"*"`
    Amount              int64            `form:"amount"`
    Currency            Currency         `form:"currency"`
    Destination         string           `form:"destination"`
    Method              PayoutMethodType `form:"method"`
    SourceType          PayoutSourceType `form:"source_type"`
    StatementDescriptor string           `form:"statement_descriptor"`
}

PayoutParams is the set of parameters that can be used when creating or updating a payout. For more details see https://stripe.com/docs/api#create_payout and https://stripe.com/docs/api#update_payout.

type PayoutSchedule Uses

type PayoutSchedule struct {
    Delay       uint64   `json:"delay_days" form:"delay_days"`
    Interval    Interval `json:"interval" form:"interval"`
    MonthAnchor uint64   `json:"monthly_anchor" form:"monthly_anchor"`
    WeekAnchor  string   `json:"weekly_anchor" form:"weekly_anchor"`
}

PayoutSchedule is the structure for an account's payout schedule.

type PayoutScheduleParams Uses

type PayoutScheduleParams struct {
    Delay        uint64   `form:"delay_days"`
    Interval     Interval `form:"interval"`
    MinimumDelay bool     `form:"-"` // See custom AppendTo
    MonthAnchor  uint64   `form:"monthly_anchor"`
    WeekAnchor   string   `form:"weekly_anchor"`
}

PayoutScheduleParams are the parameters allowed for payout schedules.

func (*PayoutScheduleParams) AppendTo Uses

func (p *PayoutScheduleParams) AppendTo(body *form.Values, keyParts []string)

type PayoutSourceType Uses

type PayoutSourceType string

PayoutSourceType is the list of allowed values for the payout's source_type field. Allowed values are "alipay_account", bank_account", "bitcoin_receiver", "card".

type PayoutStatus Uses

type PayoutStatus string

PayoutStatus is the list of allowed values for the payout's status. Allowed values are "paid", "pending", "in_transit", "failed", "canceled".

type PayoutType Uses

type PayoutType string

PayoutType is the list of allowed values for the payout's type. Allowed values are "bank_account" or "card".

type Period Uses

type Period struct {
    End   int64 `json:"end"`
    Start int64 `json:"start"`
}

Period is a structure representing a start and end dates.

type PermissionError Uses

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

PermissionError results when you attempt to make an API request for which your API key doesn't have the right permissions.

func (*PermissionError) Error Uses

func (e *PermissionError) Error() string

Error serializes the error object to JSON and returns it as a string.

type Plan Uses

type Plan struct {
    Amount        uint64            `json:"amount"`
    Created       int64             `json:"created"`
    Currency      Currency          `json:"currency"`
    Deleted       bool              `json:"deleted"`
    ID            string            `json:"id"`
    Interval      PlanInterval      `json:"interval"`
    IntervalCount uint64            `json:"interval_count"`
    Live          bool              `json:"livemode"`
    Meta          map[string]string `json:"metadata"`
    Name          string            `json:"name"`
    Statement     string            `json:"statement_descriptor"`
    TrialPeriod   uint64            `json:"trial_period_days"`
}

Plan is the resource representing a Stripe plan. For more details see https://stripe.com/docs/api#plans.

Code:

stripe.Key = "sk_key"

params := &stripe.PlanListParams{}
params.Filters.AddFilter("limit", "", "3")
params.Single = true

it := plan.List(params)
for it.Next() {
    log.Printf("%v ", it.Plan().Name)
}
if err := it.Err(); err != nil {
    log.Fatal(err)
}

type PlanInterval Uses

type PlanInterval string

PlanInterval is the list of allowed values for a plan's interval. Allowed values are "day", "week", "month", "year".

type PlanList Uses

type PlanList struct {
    ListMeta
    Values []*Plan `json:"data"`
}

PlanList is a list of plans as returned from a list endpoint.

type PlanListParams Uses

type PlanListParams struct {
    ListParams   `form:"*"`
    Created      int64             `form:"created"`
    CreatedRange *RangeQueryParams `form:"created"`
}

PlanListParams is the set of parameters that can be used when listing plans. For more details see https://stripe.com/docs/api#list_plans.

type PlanParams Uses

type PlanParams struct {
    Params        `form:"*"`
    Amount        uint64       `form:"amount"`
    Currency      Currency     `form:"currency"`
    ID            string       `form:"id"`
    Interval      PlanInterval `form:"interval"`
    IntervalCount uint64       `form:"interval_count"`
    Name          string       `form:"name"`
    Statement     string       `form:"statement_descriptor"`
    TrialPeriod   uint64       `form:"trial_period_days"`
}

PlanParams is the set of parameters that can be used when creating or updating a plan. For more details see https://stripe.com/docs/api#create_plan and https://stripe.com/docs/api#update_plan.

type Printfer Uses

type Printfer interface {
    Printf(format string, v ...interface{})
}

Printfer is an interface to be implemented by Logger.

var Logger Printfer

Logger controls how stripe performs logging at a package level. It is useful to customise if you need it prefixed for your application to meet other requirements

type Product Uses

type Product struct {
    Active            bool               `json:"active"`
    Attrs             []string           `json:"attributes"`
    Caption           string             `json:"caption"`
    Created           int64              `json:"created"`
    DeactivateOn      []string           `json:"deactivate_on"`
    Desc              string             `json:"description"`
    ID                string             `json:"id"`
    Images            []string           `json:"images"`
    Live              bool               `json:"livemode"`
    Meta              map[string]string  `json:"metadata"`
    Name              string             `json:"name"`
    PackageDimensions *PackageDimensions `json:"package_dimensions"`
    Shippable         bool               `json:"shippable"`
    Skus              *SKUList           `json:"skus"`
    URL               string             `json:"url"`
    Updated           int64              `json:"updated"`
}

Product is the resource representing a Stripe product. For more details see https://stripe.com/docs/api#products.

func (*Product) UnmarshalJSON Uses

func (p *Product) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a Product. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type ProductList Uses

type ProductList struct {
    ListMeta
    Values []*Product `json:"data"`
}

ProductList is a list of products as retrieved from a list endpoint.

type ProductListParams Uses

type ProductListParams struct {
    ListParams `form:"*"`
    Active     *bool    `form:"active"`
    IDs        []string `form:"ids"`
    Shippable  *bool    `form:"shippable"`
    URL        string   `form:"url"`
}

ProductListParams is the set of parameters that can be used when listing products. For more details, see: https://stripe.com/docs/api#list_products.

type ProductParams Uses

type ProductParams struct {
    Params            `form:"*"`
    Active            *bool              `form:"active"`
    Attrs             []string           `form:"attributes"`
    Caption           string             `form:"caption"`
    DeactivateOn      []string           `form:"deactivate_on"`
    Desc              string             `form:"description"`
    ID                string             `form:"id"`
    Images            []string           `form:"images"`
    Name              string             `form:"name"`
    PackageDimensions *PackageDimensions `form:"package_dimensions"`
    Shippable         *bool              `form:"shippable"`
    URL               string             `form:"url"`
}

ProductParams is the set of parameters that can be used when creating or updating a product. For more details, see https://stripe.com/docs/api#create_product and https://stripe.com/docs/api#update_product.

type Query Uses

type Query func(*form.Values) ([]interface{}, ListMeta, error)

Query is the function used to get a page listing.

type RangeQueryParams Uses

type RangeQueryParams struct {
    // GreaterThan specifies that values should be a greater than this
    // timestamp.
    GreaterThan int64 `form:"gt"`

    // GreaterThanOrEqual specifies that values should be greater than or equal
    // to this timestamp.
    GreaterThanOrEqual int64 `form:"gte"`

    // LesserThan specifies that values should be lesser than this timetamp.
    LesserThan int64 `form:"lt"`

    // LesserThanOrEqual specifies that values should be lesser than or
    // equalthis timetamp.
    LesserThanOrEqual int64 `form:"lte"`
}

RangeQueryParams are a set of generic request parameters that are used on list endpoints to filter their results by some timestamp.

type RateLimitError Uses

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

RateLimitError occurs when the Stripe API is hit to with too many requests too quickly and indicates that the current request has been rate limited.

func (*RateLimitError) Error Uses

func (e *RateLimitError) Error() string

Error serializes the error object to JSON and returns it as a string.

type ReasonType Uses

type ReasonType string

Reason describes the reason why the review is open or closed. Allowed values are "rule", "manual", "approved", "refunded", "refunded_as_fraud", "disputed".

const (
    ReasonApproved        ReasonType = "approved"
    ReasonDisputed        ReasonType = "disputed"
    ReasonManual          ReasonType = "manual"
    ReasonRefunded        ReasonType = "refunded"
    ReasonRefundedAsFraud ReasonType = "refunded_as_fraud"
    ReasonRule            ReasonType = "rule"
)

type ReceiverFlow Uses

type ReceiverFlow struct {
    Address                string                 `json:"address"`
    AmountCharged          int64                  `json:"amount_charged"`
    AmountReceived         int64                  `json:"amount_received"`
    AmountReturned         int64                  `json:"amount_returned"`
    RefundAttributesMethod RefundAttributesMethod `json:"refund_attributes_method"`
    RefundAttributesStatus RefundAttributesStatus `json:"refund_attributes_status"`
}

ReceiverFlow informs of the state of a receiver authentication flow.

type Recipient Uses

type Recipient struct {
    Bank        *BankAccount      `json:"active_account"`
    Cards       *CardList         `json:"cards"`
    Created     int64             `json:"created"`
    DefaultCard *Card             `json:"default_card"`
    Deleted     bool              `json:"deleted"`
    Desc        string            `json:"description"`
    Email       string            `json:"email"`
    ID          string            `json:"id"`
    Live        bool              `json:"livemode"`
    Meta        map[string]string `json:"metadata"`
    MigratedTo  *Account          `json:"migrated_to"`
    Name        string            `json:"name"`
    Type        RecipientType     `json:"type"`
}

Recipient is the resource representing a Stripe recipient. For more details see https://stripe.com/docs/api#recipients.

func (*Recipient) UnmarshalJSON Uses

func (r *Recipient) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a Recipient. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type RecipientList Uses

type RecipientList struct {
    ListMeta
    Values []*Recipient `json:"data"`
}

RecipientList is a list of recipients as retrieved from a list endpoint.

type RecipientListParams Uses

type RecipientListParams struct {
    ListParams `form:"*"`
    Verified   bool `form:"verified"`
}

RecipientListParams is the set of parameters that can be used when listing recipients. For more details see https://stripe.com/docs/api#list_recipients.

type RecipientParams Uses

type RecipientParams struct {
    Params `form:"*"`

    Bank        *BankAccountParams `form:"-"` // Kind of an abberation because a bank account's token will be replace the rest of its data. Keep this in a custom AppendTo for now.
    Card        *CardParams        `form:"card"`
    DefaultCard string             `form:"default_card"`
    Desc        string             `form:"description"`
    Email       string             `form:"email"`
    Name        string             `form:"name"`
    TaxID       string             `form:"tax_id"`
    Token       string             `form:"card"`
    Type        RecipientType      `form:"-"` // Doesn't seem to be used anywhere
}

RecipientParams is the set of parameters that can be used when creating or updating recipients. For more details see https://stripe.com/docs/api#create_recipient and https://stripe.com/docs/api#update_recipient.

func (*RecipientParams) AppendTo Uses

func (p *RecipientParams) AppendTo(body *form.Values, keyParts []string)

AppendTo implements some custom behavior around a recipient's bank account. This was probably the wrong way to go about this, but grandfather the behavior for the time being.

type RecipientTransfer Uses

type RecipientTransfer struct {
    Amount             int64                        `json:"amount"`
    AmountReversed     int64                        `json:"amount_reversed"`
    BalanceTransaction *Transaction                 `json:"balance_transaction"`
    Bank               *BankAccount                 `json:"bank_account"`
    Card               *Card                        `json:"card"`
    Created            int64                        `json:"created"`
    Currency           Currency                     `json:"currency"`
    Date               int64                        `json:"date"`
    Desc               string                       `json:"description"`
    Dest               RecipientTransferDestination `json:"destination"`
    FailCode           RecipientTransferFailCode    `json:"failure_code"`
    FailMsg            string                       `json:"failure_message"`
    ID                 string                       `json:"id"`
    Live               bool                         `json:"livemode"`
    Meta               map[string]string            `json:"metadata"`
    Method             RecipientTransferMethodType  `json:"method"`
    Recipient          *Recipient                   `json:"recipient"`
    Reversals          *ReversalList                `json:"reversals"`
    Reversed           bool                         `json:"reversed"`
    SourceTx           *TransactionSource           `json:"source_transaction"`
    SourceType         RecipientTransferSourceType  `json:"source_type"`
    Statement          string                       `json:"statement_descriptor"`
    Status             RecipientTransferStatus      `json:"status"`
    Type               RecipientTransferType        `json:"type"`
}

RecipientTransfer is the resource representing a Stripe recipient_transfer. For more details see https://stripe.com/docs/api#recipient_transfers.

func (*RecipientTransfer) UnmarshalJSON Uses

func (t *RecipientTransfer) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a RecipientTransfer. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type RecipientTransferDestination Uses

type RecipientTransferDestination struct {
    BankAccount *BankAccount                     `json:"-"`
    Card        *Card                            `json:"-"`
    ID          string                           `json:"id"`
    Type        RecipientTransferDestinationType `json:"object"`
}

RecipientTransferDestination describes the destination of a RecipientTransfer. The Type should indicate which object is fleshed out For more details see https://stripe.com/docs/api/go#recipient_transfer_object

func (*RecipientTransferDestination) MarshalJSON Uses

func (d *RecipientTransferDestination) MarshalJSON() ([]byte, error)

MarshalJSON handles serialization of a RecipientTransferDestination. This custom marshaling is needed because we can only send a string ID as a destination, even though it can be expanded to a full object when retrieving

func (*RecipientTransferDestination) UnmarshalJSON Uses

func (d *RecipientTransferDestination) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a RecipientTransferDestination. This custom unmarshaling is needed because the specific type of destination it refers to is specified in the JSON

type RecipientTransferDestinationType Uses

type RecipientTransferDestinationType string

RecipientTransferDestinationType consts represent valid recipient_transfer destinations.

const (
    // RecipientTransferDestinationBankAccount is a constant representing a recipient_transfer destination
    // which is a bank account.
    RecipientTransferDestinationBankAccount RecipientTransferDestinationType = "bank_account"

    // RecipientTransferDestinationCard is a constant representing a recipient_transfer destination
    // which is a card.
    RecipientTransferDestinationCard RecipientTransferDestinationType = "card"
)

type RecipientTransferFailCode Uses

type RecipientTransferFailCode string

RecipientTransferFailCode is the list of allowed values for the recipient_transfer's failure code. Allowed values are "insufficient_funds", "account_closed", "no_account", "invalid_account_number", "debit_not_authorized", "bank_ownership_changed", "account_frozen", "could_not_process", "bank_account_restricted", "invalid_currency".

type RecipientTransferMethodType Uses

type RecipientTransferMethodType string

RecipientTransferMethodType represents the type of recipient_transfer

const (
    // RecipientTransferMethodInstant is a constant representing an instant recipient_transfer
    RecipientTransferMethodInstant RecipientTransferMethodType = "instant"

    // RecipientTransferMethodStandard is a constant representing a standard recipient_transfer
    RecipientTransferMethodStandard RecipientTransferMethodType = "standard"
)

type RecipientTransferSourceType Uses

type RecipientTransferSourceType string

RecipientTransferSourceType is the list of allowed values for the recipient_transfer's source_type field. Allowed values are "alipay_account", bank_account", "bitcoin_receiver", "card".

type RecipientTransferStatus Uses

type RecipientTransferStatus string

RecipientTransferStatus is the list of allowed values for the recipient_transfer's status. Allowed values are "paid", "pending", "in_transit", "failed".

type RecipientTransferType Uses

type RecipientTransferType string

RecipientTransferType is the list of allowed values for the recipient_transfer's type. Allowed values are "bank_account" or "card".

type RecipientType Uses

type RecipientType string

RecipientType is the list of allowed values for the recipient's type. Allowed values are "individual", "corporation".

type RedirectFlow Uses

type RedirectFlow struct {
    ReturnURL string             `json:"return_url"`
    Status    RedirectFlowStatus `json:"status"`
    URL       string             `json:"url"`
}

ReceiverFlow informs of the state of a redirect authentication flow.

type RedirectFlowStatus Uses

type RedirectFlowStatus string

RedirectFlowStatus represents the possible statuses of a redirect flow.

const (
    RedirectFlowStatusFailed    RedirectFlowStatus = "failed"
    RedirectFlowStatusPending   RedirectFlowStatus = "pending"
    RedirectFlowStatusSucceeded RedirectFlowStatus = "succeeded"
)

type RedirectParams Uses

type RedirectParams struct {
    ReturnURL string `form:"return_url"`
}

type Refund Uses

type Refund struct {
    Amount        uint64            `json:"amount"`
    Charge        *Charge           `json:"charge"`
    Created       int64             `json:"created"`
    Currency      Currency          `json:"currency"`
    ID            string            `json:"id"`
    Meta          map[string]string `json:"metadata"`
    Reason        RefundReason      `json:"reason"`
    ReceiptNumber string            `json:"receipt_number"`
    Status        RefundStatus      `json:"status"`
    Tx            *Transaction      `json:"balance_transaction"`
}

Refund is the resource representing a Stripe refund. For more details see https://stripe.com/docs/api#refunds.

func (*Refund) UnmarshalJSON Uses

func (r *Refund) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a Refund. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type RefundAttributesMethod Uses

type RefundAttributesMethod string

RefundAttributesMethod are the possible method to retrieve a receiver's refund attributes.

const (
    // RefundAttributesEmail the refund attributes are automatically collected over email
    RefundAttributesEmail RefundAttributesMethod = "email"

    // RefundAttributesManual the refund attributes should be collected by the user
    RefundAttributesManual RefundAttributesMethod = "manual"
)

type RefundAttributesStatus Uses

type RefundAttributesStatus string

RefundAttributesStatus are the possible status of a receiver's refund attributes.

const (
    // RefundAttributesAvailable the refund attributes are available
    RefundAttributesAvailable RefundAttributesStatus = "available"

    // RefundAttributesMissing the refund attributes are missing
    RefundAttributesMissing RefundAttributesStatus = "missing"

    // RefundAttributesRequested the refund attributes have been requested
    RefundAttributesRequested RefundAttributesStatus = "requested"
)

type RefundList Uses

type RefundList struct {
    ListMeta
    Values []*Refund `json:"data"`
}

RefundList is a list object for refunds.

type RefundListParams Uses

type RefundListParams struct {
    ListParams `form:"*"`
}

RefundListParams is the set of parameters that can be used when listing refunds. For more details see https://stripe.com/docs/api#list_refunds.

type RefundParams Uses

type RefundParams struct {
    Params   `form:"*"`
    Amount   uint64       `form:"amount"`
    Charge   string       `form:"charge"`
    Fee      bool         `form:"refund_application_fee"`
    Reason   RefundReason `form:"reason"`
    Transfer bool         `form:"reverse_transfer"`
}

RefundParams is the set of parameters that can be used when refunding a charge. For more details see https://stripe.com/docs/api#refund.

type RefundReason Uses

type RefundReason string

RefundReason is, if set, the reason the refund is being made--allowed values are "fraudulent", "duplicate", and "requested_by_customer".

type RefundStatus Uses

type RefundStatus string

RefundStatus is the status of the refund. For credit card refunds, this will always be "succeeded". For other types of refunds, it can be "pending", "succeeded", "failed", or "cancelled".

type Reversal Uses

type Reversal struct {
    Amount   uint64            `json:"amount"`
    Created  int64             `json:"created"`
    Currency Currency          `json:"currency"`
    ID       string            `json:"id"`
    Meta     map[string]string `json:"metadata"`
    Transfer string            `json:"transfer"`
    Tx       *Transaction      `json:"balance_transaction"`
}

Reversal represents a transfer reversal.

func (*Reversal) UnmarshalJSON Uses

func (r *Reversal) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a Reversal. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type ReversalList Uses

type ReversalList struct {
    ListMeta
    Values []*Reversal `json:"data"`
}

ReversalList is a list of object for reversals.

type ReversalListParams Uses

type ReversalListParams struct {
    ListParams `form:"*"`
    Transfer   string `form:"-"` // Included in URL
}

ReversalListParams is the set of parameters that can be used when listing reversals.

type ReversalParams Uses

type ReversalParams struct {
    Params   `form:"*"`
    Transfer string `form:"-"` // Included in URL
    Amount   uint64 `form:"amount"`
    Fee      bool   `form:"refund_application_fee"`
}

ReversalParams is the set of parameters that can be used when reversing a transfer.

type Review Uses

type Review struct {
    Charge  *Charge    `json:"charge"`
    Created int64      `json:"created"`
    ID      string     `json:"id"`
    Live    bool       `json:"livemode"`
    Open    bool       `json:"open"`
    Reason  ReasonType `json:"reason"`
}

func (*Review) UnmarshalJSON Uses

func (r *Review) UnmarshalJSON(data []byte) error

type SKU Uses

type SKU struct {
    Active            bool               `json:"active"`
    Attrs             map[string]string  `json:"attributes"`
    Created           int64              `json:"created"`
    Currency          string             `json:"currency"`
    Desc              string             `json:"description"`
    ID                string             `json:"id"`
    Image             string             `json:"image"`
    Inventory         Inventory          `json:"inventory"`
    Live              bool               `json:"livemode"`
    Meta              map[string]string  `json:"metadata"`
    PackageDimensions *PackageDimensions `json:"package_dimensions"`
    Price             int64              `json:"price"`
    Product           Product            `json:"product"`
    Updated           int64              `json:"updated"`
}

func (*SKU) UnmarshalJSON Uses

func (s *SKU) UnmarshalJSON(data []byte) error

type SKUList Uses

type SKUList struct {
    ListMeta
    Values []*SKU `json:"data"`
}

type SKUListParams Uses

type SKUListParams struct {
    ListParams `form:"*"`
    Active     *bool             `form:"active"`
    Attributes map[string]string `form:"attributes"`
    IDs        []string          `form:"ids"`
    InStock    *bool             `form:"in_stock"`
    Product    string            `form:"product"`
}

type SKUParams Uses

type SKUParams struct {
    Params            `form:"*"`
    Active            *bool              `form:"active"`
    Attrs             map[string]string  `form:"attributes"`
    Currency          string             `form:"currency"`
    Desc              string             `form:"description"`
    ID                string             `form:"id"`
    Image             string             `form:"image"`
    Inventory         Inventory          `form:"inventory"`
    PackageDimensions *PackageDimensions `form:"package_dimensions"`
    Price             int64              `form:"price"`
    Product           string             `form:"product"`
}

type Shipping Uses

type Shipping struct {
    Address Address `json:"address"`
    Name    string  `json:"name"`
    Phone   string  `json:"phone"`
}

type ShippingDetails Uses

type ShippingDetails struct {
    Address  Address `json:"address" form:"address"`
    Carrier  string  `json:"carrier" form:"carrier"`
    Name     string  `json:"name" form:"name"`
    Phone    string  `json:"phone" form:"phone"`
    Tracking string  `json:"tracking_number" form:"tracking_number"`
}

ShippingDetails is the structure containing shipping information.

type ShippingMethod Uses

type ShippingMethod struct {
    Amount           int64             `json:"amount"`
    ID               string            `json:"id"`
    Currency         Currency          `json:"currency"`
    DeliveryEstimate *DeliveryEstimate `json:"delivery_estimate"`
    Description      string            `json:"description"`
}

type ShippingParams Uses

type ShippingParams struct {
    Address *AddressParams `form:"address"`
    Name    string         `form:"name"`
    Phone   string         `form:"phone"`
}

type Source Uses

type Source struct {
    Amount       int64             `json:"amount"`
    ClientSecret string            `json:"client_secret"`
    Created      int64             `json:"created"`
    Currency     Currency          `json:"currency"`
    Flow         SourceFlow        `json:"flow"`
    ID           string            `json:"id"`
    Live         bool              `json:"livemode"`
    Meta         map[string]string `json:"metadata"`
    Owner        SourceOwner       `json:"owner"`
    Receiver     *ReceiverFlow     `json:"receiver,omitempty"`
    Redirect     *RedirectFlow     `json:"redirect,omitempty"`
    Status       SourceStatus      `json:"status"`
    Type         string            `json:"type"`
    TypeData     map[string]interface{}
    Usage        SourceUsage       `json:"usage"`
    Verification *VerificationFlow `json:"verification,omitempty"`
}

func (*Source) UnmarshalJSON Uses

func (s *Source) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of an Source. This custom unmarshaling is needed to extract the type specific data (accessible under `TypeData`) but stored in JSON under a hash named after the `type` of the source.

type SourceFlow Uses

type SourceFlow string

SourceFlow represents the possible flows of a source object.

const (
    // FlowNone no particular authentication is involved the source should
    // become chargeable directly or asyncrhonously.
    FlowNone SourceFlow = "none"

    // FlowReceiver a receiver address should be communicated to the customer
    // to push funds to it.
    FlowReceiver SourceFlow = "receiver"

    // FlowRedirect a redirect is required to authenticate the source.
    FlowRedirect SourceFlow = "redirect"

    // FlowVerification a verification code should be communicated by the
    // customer to authenticate the source.
    FlowVerification SourceFlow = "verification"
)

type SourceList Uses

type SourceList struct {
    ListMeta
    Values []*PaymentSource `json:"data"`
}

SourceList is a list object for cards.

type SourceListParams Uses

type SourceListParams struct {
    ListParams `form:"*"`
    Customer   string `form:"-"` // Handled in URL
}

SourceListParams are used to enumerate the payment sources that are attached to a Customer.

type SourceObjectParams Uses

type SourceObjectParams struct {
    Params   `form:"*"`
    Amount   uint64             `form:"amount"`
    Currency Currency           `form:"currency"`
    Customer string             `form:"customer"`
    Flow     SourceFlow         `form:"flow"`
    Owner    *SourceOwnerParams `form:"owner"`
    Redirect *RedirectParams    `form:"redirect"`
    Token    string             `form:"token"`
    Type     string             `form:"type"`
    TypeData map[string]string  `form:"*"`
    Usage    SourceUsage        `form:"usage"`
}

type SourceOwner Uses

type SourceOwner struct {
    Address         *Address `json:"address,omitempty"`
    Email           string   `json:"email"`
    Name            string   `json:"name"`
    Phone           string   `json:"phone"`
    VerifiedAddress *Address `json:"verified_address,omitempty"`
    VerifiedEmail   string   `json:"verified_email"`
    VerifiedName    string   `json:"verified_name"`
    VerifiedPhone   string   `json:"verified_phone"`
}

type SourceOwnerParams Uses

type SourceOwnerParams struct {
    Address *AddressParams `form:"address"`
    Email   string         `form:"email"`
    Name    string         `form:"name"`
    Phone   string         `form:"phone"`
}

type SourceParams Uses

type SourceParams struct {
    Card  *CardParams `form:"-"`
    Token string      `form:"source"`
}

SourceParams is a union struct used to describe an arbitrary payment source.

func SourceParamsFor Uses

func SourceParamsFor(obj interface{}) (*SourceParams, error)

SourceParamsFor creates SourceParams objects around supported payment sources, returning errors if not.

Currently supported source types are Card (CardParams) and Tokens/IDs (string), where Tokens could be single use card tokens or bitcoin receiver ids

func (*SourceParams) AppendTo Uses

func (p *SourceParams) AppendTo(body *form.Values, keyParts []string)

type SourceStatus Uses

type SourceStatus string

SourceStatus represents the possible statuses of a source object.

const (
    // SourceStatusCanceled we canceled the source along with any side-effect
    // it had (returned funds to customers if any were sent).
    SourceStatusCanceled SourceStatus = "canceled"

    // SourceStatusChargeable the source is ready to be charged (once if usage
    // is `single_use`, repeatidly otherwise).
    SourceStatusChargeable SourceStatus = "chargeable"

    // SourceStatusConsumed the source is `single_use` usage and has been
    // charged already.
    SourceStatusConsumed SourceStatus = "consumed"

    // SourceStatusFailed the source is no longer usable.
    SourceStatusFailed SourceStatus = "failed"

    // SourceStatusPending the source is freshly created and not yet
    // chargeable. The flow should indicate how to authenticate it with your
    // customer.
    SourceStatusPending SourceStatus = "pending"
)

type SourceUsage Uses

type SourceUsage string

SourceUsage represents the possible usages of a source object.

const (
    // UsageReusable the source can be charged multiple times for arbitrary
    // amounts.
    UsageReusable SourceUsage = "reusable"

    // UsageSingleUse the source can only be charged once for the specified
    // amount and currency.
    UsageSingleUse SourceUsage = "single_use"
)

type SourceVerifyParams Uses

type SourceVerifyParams struct {
    Params   `form:"*"`
    Amounts  [2]uint8 `form:"amounts"`
    Customer string   `form:"-"` // Goes in the URL
}

SourceVerifyParams are used to verify a customer source For more details see https://stripe.com/docs/guides/ach-beta

type StatusTransitions Uses

type StatusTransitions struct {
    Canceled  int64 `json:"canceled"`
    Fulfilled int64 `json:"fulfiled"`
    Paid      int64 `json:"paid"`
    Returned  int64 `json:"returned"`
}

StatsuTransitions are the timestamps at which the order status was updated https://stripe.com/docs/api#order_object

type Sub Uses

type Sub struct {
    Billing      SubBilling        `json:"billing"`
    Canceled     int64             `json:"canceled_at"`
    Created      int64             `json:"created"`
    Customer     *Customer         `json:"customer"`
    DaysUntilDue uint64            `json:"days_until_due"`
    Discount     *Discount         `json:"discount"`
    EndCancel    bool              `json:"cancel_at_period_end"`
    Ended        int64             `json:"ended_at"`
    FeePercent   float64           `json:"application_fee_percent"`
    ID           string            `json:"id"`
    Items        *SubItemList      `json:"items"`
    Meta         map[string]string `json:"metadata"`
    PeriodEnd    int64             `json:"current_period_end"`
    PeriodStart  int64             `json:"current_period_start"`
    Plan         *Plan             `json:"plan"`
    Quantity     uint64            `json:"quantity"`
    Start        int64             `json:"start"`
    Status       SubStatus         `json:"status"`
    TaxPercent   float64           `json:"tax_percent"`
    TrialEnd     int64             `json:"trial_end"`
    TrialStart   int64             `json:"trial_start"`
}

Sub is the resource representing a Stripe subscription. For more details see https://stripe.com/docs/api#subscriptions.

func (*Sub) UnmarshalJSON Uses

func (s *Sub) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a Sub. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type SubBilling Uses

type SubBilling string

SubBilling is the type of billing method for this subscription's invoices. Currently supported values are "send_invoice" and "charge_automatically".

type SubItem Uses

type SubItem struct {
    Created  int64             `json:"created"`
    Deleted  bool              `json:"deleted"`
    ID       string            `json:"id"`
    Meta     map[string]string `json:"metadata"`
    Plan     *Plan             `json:"plan"`
    Quantity uint64            `json:"quantity"`
}

SubItem is the resource representing a Stripe subscription item. For more details see https://stripe.com/docs/api#subscription_items.

type SubItemList Uses

type SubItemList struct {
    ListMeta
    Values []*SubItem `json:"data"`
}

SubItemList is a list of invoice items as retrieved from a list endpoint.

type SubItemListParams Uses

type SubItemListParams struct {
    ListParams `form:"*"`
    Sub        string `form:"subscription"`
}

SubItemListParams is the set of parameters that can be used when listing invoice items. For more details see https://stripe.com/docs/api#list_invoiceitems.

type SubItemParams Uses

type SubItemParams struct {
    Params        `form:"*"`
    ID            string `form:"-"` // Handled in URL
    NoProrate     bool   `form:"prorate,invert"`
    Plan          string `form:"plan"`
    ProrationDate int64  `form:"proration_date"`
    Quantity      uint64 `form:"quantity"`
    QuantityZero  bool   `form:"quantity,zero"`
    Sub           string `form:"subscription"`
}

SubItemParams is the set of parameters that can be used when creating or updating a subscription item. For more details see https://stripe.com/docs/api#create_subscription_item and https://stripe.com/docs/api#update_subscription_item.

type SubItemsParams Uses

type SubItemsParams struct {
    Params       `form:"*"`
    Deleted      bool   `form:"deleted"`
    ID           string `form:"id"`
    Plan         string `form:"plan"`
    Quantity     uint64 `form:"quantity"`
    QuantityZero bool   `form:"quantity,zero"`
}

SubItemsParams is the set of parameters that can be used when creating or updating a subscription item on a subscription For more details see https://stripe.com/docs/api#create_subscription and https://stripe.com/docs/api#update_subscription.

type SubList Uses

type SubList struct {
    ListMeta
    Values []*Sub `json:"data"`
}

SubList is a list object for subscriptions.

type SubListParams Uses

type SubListParams struct {
    ListParams   `form:"*"`
    Billing      SubBilling        `form:"billing"`
    Created      int64             `form:"created"`
    CreatedRange *RangeQueryParams `form:"created"`
    Customer     string            `form:"customer"`
    Plan         string            `form:"plan"`
    Status       SubStatus         `form:"status"`
}

SubListParams is the set of parameters that can be used when listing active subscriptions. For more details see https://stripe.com/docs/api#list_subscriptions.

type SubParams Uses

type SubParams struct {
    Params                `form:"*"`
    Billing               SubBilling        `form:"billing"`
    BillingCycleAnchor    int64             `form:"billing_cycle_anchor"`
    BillingCycleAnchorNow bool              `form:"-"` // See custom AppendTo
    Card                  *CardParams       `form:"card"`
    Coupon                string            `form:"coupon"`
    CouponEmpty           bool              `form:"coupon,empty"`
    Customer              string            `form:"customer"`
    DaysUntilDue          uint64            `form:"days_until_due"`
    FeePercent            float64           `form:"application_fee_percent"`
    FeePercentZero        bool              `form:"application_fee_percent,zero"`
    Items                 []*SubItemsParams `form:"items,indexed"`
    NoProrate             bool              `form:"prorate,invert"`
    OnBehalfOf            string            `form:"on_behalf_of"`
    Plan                  string            `form:"plan"`
    ProrationDate         int64             `form:"proration_date"`
    Quantity              uint64            `form:"quantity"`
    QuantityZero          bool              `form:"quantity,zero"`
    TaxPercent            float64           `form:"tax_percent"`
    TaxPercentZero        bool              `form:"tax_percent,zero"`
    Token                 string            `form:"card"`
    TrialEnd              int64             `form:"trial_end"`
    TrialEndNow           bool              `form:"-"` // See custom AppendTo
    TrialPeriod           int64             `form:"trial_period_days"`

    EndCancel bool `form:"at_period_end"`
}

SubParams is the set of parameters that can be used when creating or updating a subscription. For more details see https://stripe.com/docs/api#create_subscription and https://stripe.com/docs/api#update_subscription.

func (*SubParams) AppendTo Uses

func (p *SubParams) AppendTo(body *form.Values, keyParts []string)

AppendTo implements custom encoding logic for SubParams so that the special "now" value for billing_cycle_anchor and trial_end can be implemented (they're otherwise timestamps rather than strings).

type SubStatus Uses

type SubStatus string

SubStatus is the list of allowed values for the subscription's status. Allowed values are "trialing", "active", "past_due", "canceled", "unpaid", "all".

type SupportedBackend Uses

type SupportedBackend string

SupportedBackend is an enumeration of supported Stripe endpoints. Currently supported values are "api" and "uploads".

type TOSAcceptanceParams Uses

type TOSAcceptanceParams struct {
    Date      int64  `json:"date" form:"date"`
    IP        string `json:"ip" form:"ip"`
    UserAgent string `json:"user_agent" form:"user_agent"`
}

TOSAcceptanceParams is the structure for TOS acceptance.

type ThreeDSecure Uses

type ThreeDSecure struct {
    Amount        uint64             `json:"amount"`
    Authenticated bool               `json:"authenticated"`
    Card          *Card              `json:"card"`
    Created       int64              `json:"created"`
    Currency      Currency           `json:"currency"`
    ID            string             `json:"id"`
    Live          bool               `json:"livemode"`
    RedirectURL   string             `json:"redirect_url"`
    Status        ThreeDSecureStatus `json:"status"`
    Supported     string             `json:"supported"`
}

ThreeDSecure is the resource representing a Stripe 3DS object For more details see https://stripe.com/docs/api#three_d_secure.

type ThreeDSecureParams Uses

type ThreeDSecureParams struct {
    Params    `form:"*"`
    Amount    uint64   `form:"amount"`
    Card      string   `form:"card"`
    Currency  Currency `form:"currency"`
    Customer  string   `form:"customer"`
    ReturnURL string   `form:"return_url"`
}

ThreeDSecureParams is the set of parameters that can be used when creating a 3DS object. For more details see https://stripe.com/docs/api#create_three_d_secure.

type ThreeDSecureStatus Uses

type ThreeDSecureStatus string

type Token Uses

type Token struct {
    Bank     *BankAccount `json:"bank_account"`
    Card     *Card        `json:"card"`
    ClientIP string       `json:"client_ip"`
    Created  int64        `json:"created"`

    // Email is an undocumented field but included for all tokens created
    // with Stripe Checkout.
    Email string `json:"email"`

    ID   string    `json:"id"`
    Live bool      `json:"livemode"`
    Type TokenType `json:"type"`
    Used bool      `json:"used"`
}

Token is the resource representing a Stripe token. For more details see https://stripe.com/docs/api#tokens.

type TokenParams Uses

type TokenParams struct {
    Params   `form:"*"`
    Bank     *BankAccountParams `form:"bank_account"`
    Card     *CardParams        `form:"card"`
    Customer string             `form:"customer"`

    // Email is an undocumented parameter used by Stripe Checkout
    // It may be removed from the API without notice.
    Email string `form:"email"`

    PII *PIIParams `form:"pii"`
}

TokenParams is the set of parameters that can be used when creating a token. For more details see https://stripe.com/docs/api#create_card_token and https://stripe.com/docs/api#create_bank_account_token.

type TokenType Uses

type TokenType string

TokenType is the list of allowed values for a token's type. Allowed values are "card", "bank_account".

type TokenizationMethod Uses

type TokenizationMethod string

TokenizationMethod is the list of allowed values for the card's tokenization method. Allowed values are "apple_pay", "android_pay".

type Transaction Uses

type Transaction struct {
    Amount     int64             `json:"amount"`
    Available  int64             `json:"available_on"`
    Created    int64             `json:"created"`
    Currency   Currency          `json:"currency"`
    Desc       string            `json:"description"`
    ID         string            `json:"id"`
    Fee        int64             `json:"fee"`
    FeeDetails []TxFee           `json:"fee_details"`
    Net        int64             `json:"net"`
    Recipient  string            `json:"recipient"`
    Src        TransactionSource `json:"source"`
    Status     TransactionStatus `json:"status"`
    Type       TransactionType   `json:"type"`
}

Transaction is the resource representing the balance transaction. For more details see https://stripe.com/docs/api/#balance.

func (*Transaction) UnmarshalJSON Uses

func (t *Transaction) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a Transaction. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type TransactionList Uses

type TransactionList struct {
    ListMeta
    Values []*Transaction `json:"data"`
}

TransactionList is a list of transactions as returned from a list endpoint.

type TransactionSource Uses

type TransactionSource struct {
    Charge            *Charge               `json:"-"`
    Dispute           *Dispute              `json:"-"`
    Fee               *Fee                  `json:"-"`
    ID                string                `json:"id"`
    Payout            *Payout               `json:"-"`
    RecipientTransfer *RecipientTransfer    `json:"-"`
    Refund            *Refund               `json:"-"`
    Reversal          *Reversal             `json:"-"`
    Transfer          *Transfer             `json:"-"`
    Type              TransactionSourceType `json:"object"`
}

TransactionSource describes the source of a balance Transaction. The Type should indicate which object is fleshed out. For more details see https://stripe.com/docs/api#retrieve_balance_transaction

func (*TransactionSource) MarshalJSON Uses

func (s *TransactionSource) MarshalJSON() ([]byte, error)

MarshalJSON handles serialization of a TransactionSource.

func (*TransactionSource) UnmarshalJSON Uses

func (s *TransactionSource) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a TransactionSource. This custom unmarshaling is needed because the specific type of transaction source it refers to is specified in the JSON

type TransactionSourceType Uses

type TransactionSourceType string

TransactionSourceType consts represent valid balance transaction sources.

const (
    // TransactionSourceCharge is a constant representing a transaction source of charge
    TransactionSourceCharge TransactionSourceType = "charge"

    // TransactionSourceDispute is a constant representing a transaction source of dispute
    TransactionSourceDispute TransactionSourceType = "dispute"

    // TransactionSourceFee is a constant representing a transaction source of application_fee
    TransactionSourceFee TransactionSourceType = "application_fee"

    // TransactionSourcePayout is a constant representing a transaction source of payout
    TransactionSourcePayout TransactionSourceType = "payout"

    // TransactionSourceRecipientTransfer is a constant representing a transaction source of recipient_transfer
    TransactionSourceRecipientTransfer TransactionSourceType = "recipient_transfer"

    // TransactionSourceRefund is a constant representing a transaction source of refund
    TransactionSourceRefund TransactionSourceType = "refund"

    // TransactionSourceReversal is a constant representing a transaction source of reversal
    TransactionSourceReversal TransactionSourceType = "reversal"

    // TransactionSourceTransfer is a constant representing a transaction source of transfer
    TransactionSourceTransfer TransactionSourceType = "transfer"
)

type TransactionStatus Uses

type TransactionStatus string

TransactionStatus is the list of allowed values for the transaction's status. Allowed values are "available", "pending".

type TransactionType Uses

type TransactionType string

TransactionType is the list of allowed values for the transaction's type. Allowed values are "charge", "refund", "adjustment", "application_fee", "application_fee_refund", "transfer", "transfer_cancel", "transfer_failure".

type Transfer Uses

type Transfer struct {
    Amount         int64               `json:"amount"`
    AmountReversed int64               `json:"amount_reversed"`
    Created        int64               `json:"created"`
    Currency       Currency            `json:"currency"`
    Dest           TransferDestination `json:"destination"`
    DestPayment    string              `json:"destination_payment"`
    ID             string              `json:"id"`
    Live           bool                `json:"livemode"`
    Meta           map[string]string   `json:"metadata"`
    Reversals      *ReversalList       `json:"reversals"`
    Reversed       bool                `json:"reversed"`
    SourceTx       *TransactionSource  `json:"source_transaction"`
    Statement      string              `json:"statement_descriptor"`
    TransferGroup  string              `json:"transfer_group"`
    Tx             *Transaction        `json:"balance_transaction"`
}

Transfer is the resource representing a Stripe transfer. For more details see https://stripe.com/docs/api#transfers.

func (*Transfer) UnmarshalJSON Uses

func (t *Transfer) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a Transfer. This custom unmarshaling is needed because the resulting property may be an id or the full struct if it was expanded.

type TransferDestination Uses

type TransferDestination struct {
    Account *Account `json:"-"`
    ID      string   `json:"id"`
}

TransferDestination describes the destination of a Transfer. The Type should indicate which object is fleshed out For more details see https://stripe.com/docs/api/go#transfer_object

func (*TransferDestination) MarshalJSON Uses

func (d *TransferDestination) MarshalJSON() ([]byte, error)

MarshalJSON handles serialization of a TransferDestination. This custom marshaling is needed because we can only send a string ID as a destination, even though it can be expanded to a full object when retrieving

func (*TransferDestination) UnmarshalJSON Uses

func (d *TransferDestination) UnmarshalJSON(data []byte) error

UnmarshalJSON handles deserialization of a TransferDestination. This custom unmarshaling is needed because the specific type of destination it refers to is specified in the JSON

type TransferList Uses

type TransferList struct {
    ListMeta
    Values []*Transfer `json:"data"`
}

TransferList is a list of transfers as retrieved from a list endpoint.

type TransferListParams Uses

type TransferListParams struct {
    ListParams    `form:"*"`
    Created       int64             `form:"created"`
    CreatedRange  *RangeQueryParams `form:"created"`
    Currency      Currency          `form:"currency"`
    Dest          string            `form:"destination"`
    TransferGroup string            `form:"transfer_group"`
}

TransferListParams is the set of parameters that can be used when listing transfers. For more details see https://stripe.com/docs/api#list_transfers.

type TransferParams Uses

type TransferParams struct {
    Params        `form:"*"`
    Amount        int64              `form:"amount"`
    Currency      Currency           `form:"currency"`
    Dest          string             `form:"destination"`
    SourceTx      string             `form:"source_transaction"`
    SourceType    TransferSourceType `form:"source_type"`
    TransferGroup string             `form:"transfer_group"`
}

TransferParams is the set of parameters that can be used when creating or updating a transfer. For more details see https://stripe.com/docs/api#create_transfer and https://stripe.com/docs/api#update_transfer.

type TransferSourceType Uses

type TransferSourceType string

TransferSourceType is the list of allowed values for the transfer's source_type field. Allowed values are "alipay_account", bank_account", "bitcoin_receiver", "card".

type TxFee Uses

type TxFee struct {
    Application string   `json:"application"`
    Amount      int64    `json:"amount"`
    Currency    Currency `json:"currency"`
    Desc        string   `json:"description"`
    Type        string   `json:"type"`
}

TxFee is a structure that breaks down the fees in a transaction.

type TxListParams Uses

type TxListParams struct {
    ListParams     `form:"*"`
    Available      int64             `form:"available_on"`
    AvailableRange *RangeQueryParams `form:"available_on"`
    Created        int64             `form:"created"`
    CreatedRange   *RangeQueryParams `form:"created"`
    Currency       string            `form:"currency"`
    Payout         string            `form:"payout"`
    Src            string            `form:"source"`
    Type           TransactionType   `form:"type"`
}

TxListParams is the set of parameters that can be used when listing balance transactions. For more details see https://stripe.com/docs/api/#balance_history.

type TxParams Uses

type TxParams struct {
    Params `form:"*"`
}

TxParams is the set of parameters that can be used when retrieving a transaction. For more details see https://stripe.com/docs/api#retrieve_balance_transaction.

type Verification Uses

type Verification string

Verification is the list of allowed verification responses. Allowed values are "pass", "fail", "unchecked", "unavailable".

type VerificationFieldsList Uses

type VerificationFieldsList struct {
    AdditionalFields []string `json:"additional"`
    MinimumFields    []string `json:"minimum"`
}

VerificationFieldsList lists the fields needed for an account verification. For more details see https://stripe.com/docs/api#country_spec_object-verification_fields.

type VerificationFlow Uses

type VerificationFlow struct {
    AttemptsRemaining uint64             `json:"attempts_remaining"`
    Status            RedirectFlowStatus `json:"status"`
}

ReceiverFlow informs of the state of a verification authentication flow.

type VerificationFlowStatus Uses

type VerificationFlowStatus string

VerificationFlowStatus represents the possible statuses of a verification flow.

const (
    VerificationFlowStatusFailed    VerificationFlowStatus = "failed"
    VerificationFlowStatusPending   VerificationFlowStatus = "pending"
    VerificationFlowStatusSucceeded VerificationFlowStatus = "succeeded"
)

Directories

PathSynopsis
accountPackage account provides the /account APIs
applepaydomainPackage applepaydomain provides the /apple_pay/domains APIs
balancePackage balance provides the /balance APIs
bankaccountPackage bankaccount provides the /bank_accounts APIs
bitcoinreceiverPackage bitcoinreceiver provides the /bitcoin/receivers APIs.
bitcointransactionPackage bitcointransaction provides the /bitcoin/transactions APIs.
cardPackage card provides the /cards APIs
chargePackage charge provides the /charges APIs
clientPackage client provides a Stripe client for invoking APIs across all resources
countryspecPackage countryspec provides the /country_specs APIs
couponPackage coupon provides the /coupons APIs
currencyPackage currency provides the list of currency codes
customerPackage customer provides the /customers APIs
discountPackage discount provides the discount-related APIs
disputePackage dispute provides the dispute-related APIs
ephemeralkeyPackage ephemeralkey provides the /ephemeral_keys APIs
eventPackage event provides the /events APIs
feePackage fee provides the /application_fees APIs
feerefundPackage feerefund provides the /application_fees/refunds APIs
fileuploadPackage fileupload provides the file upload related APIs
form
invoicePackage invoice provides the /invoices APIs
invoiceitemPackage invoiceitem provides the /invoiceitems APIs
loginlinkPackage loginlink provides the /login_links APIs
order
orderitem
orderreturn
paymentsourcePackage paymentsource provides the /sources APIs
payoutPackage payout provides the /payouts APIs
planPackage plan provides the /plans APIs
product
recipientPackage recipient provides the /recipients APIs
recipienttransferPackage recipienttransfer provides the /recipient_transfers APIs
refundPackage refund provides the /refunds APIs
reversalPackage reversal provides the /transfers/reversals APIs
sku
source
subPackage sub provides the /subscriptions APIs
subitemPackage sub provides the /subscriptions APIs
testing
threedsecurePackage threedsecure provides the /3d_secure APIs
tokenPackage token provides the /tokens APIs
transferPackage transfer provides the /transfers APIs
utilsPackage utils provides internal utilities
webhook

Package stripe imports 22 packages (graph) and is imported by 888 packages. Updated 2017-09-19. Refresh now. Tools for package owners.