Documentation ¶
Index ¶
- Constants
- Variables
- func GetCardType(card string) string
- func IsLuhnValid(card string) (bool, error)
- func SetKey(key string)
- func SetKeyEnv() (err error)
- func SetUrl(url string)
- type Bool
- type Card
- type CardClient
- type CardData
- type CardParams
- type Charge
- type ChargeClient
- func (self *ChargeClient) Create(params *ChargeParams) (*Charge, error)
- func (self *ChargeClient) CustomerList(id string) ([]*Charge, error)
- func (self *ChargeClient) CustomerListN(id string, count int, offset int) ([]*Charge, error)
- func (self *ChargeClient) List() ([]*Charge, error)
- func (self *ChargeClient) ListN(count int, offset int) ([]*Charge, error)
- func (self *ChargeClient) Refund(id string) (*Charge, error)
- func (self *ChargeClient) RefundAmount(id string, amt int64) (*Charge, error)
- func (self *ChargeClient) Retrieve(id string) (*Charge, error)
- type ChargeParams
- type Coupon
- type CouponClient
- func (self *CouponClient) Create(params *CouponParams) (*Coupon, error)
- func (self *CouponClient) Delete(id string) (bool, error)
- func (self *CouponClient) List() ([]*Coupon, error)
- func (self *CouponClient) ListN(count int, offset int) ([]*Coupon, error)
- func (self *CouponClient) Retrieve(id string) (*Coupon, error)
- type CouponParams
- type Customer
- type CustomerClient
- func (self *CustomerClient) Create(c *CustomerParams) (*Customer, error)
- func (self *CustomerClient) Delete(id string) (bool, error)
- func (self *CustomerClient) List() ([]*Customer, error)
- func (self *CustomerClient) ListN(count int, offset int) ([]*Customer, error)
- func (self *CustomerClient) Retrieve(id string) (*Customer, error)
- func (self *CustomerClient) Update(id string, c *CustomerParams) (*Customer, error)
- type CustomerParams
- type DeleteResp
- type Discount
- type Error
- type FeeDetails
- type Int
- type Int64
- type Invoice
- type InvoiceClient
- func (self *InvoiceClient) CustomerList(id string) ([]*Invoice, error)
- func (self *InvoiceClient) CustomerListN(id string, count int, offset int) ([]*Invoice, error)
- func (self *InvoiceClient) List() ([]*Invoice, error)
- func (self *InvoiceClient) ListN(count int, offset int) ([]*Invoice, error)
- func (self *InvoiceClient) Retrieve(id string) (*Invoice, error)
- func (self *InvoiceClient) RetrieveCustomer(cid string) (*Invoice, error)
- type InvoiceItem
- type InvoiceItemClient
- func (self *InvoiceItemClient) Create(params *InvoiceItemParams) (*InvoiceItem, error)
- func (self *InvoiceItemClient) CustomerList(id string) ([]*InvoiceItem, error)
- func (self *InvoiceItemClient) CustomerListN(id string, count int, offset int) ([]*InvoiceItem, error)
- func (self *InvoiceItemClient) Delete(id string) (bool, error)
- func (self *InvoiceItemClient) List() ([]*InvoiceItem, error)
- func (self *InvoiceItemClient) ListN(count int, offset int) ([]*InvoiceItem, error)
- func (self *InvoiceItemClient) Retrieve(id string) (*InvoiceItem, error)
- func (self *InvoiceItemClient) Update(id string, params *InvoiceItemParams) (*InvoiceItem, error)
- type InvoiceItemParams
- type InvoiceLines
- type Period
- type Plan
- type PlanClient
- func (self *PlanClient) Create(params *PlanParams) (*Plan, error)
- func (self *PlanClient) Delete(id string) (bool, error)
- func (self *PlanClient) List() ([]*Plan, error)
- func (self *PlanClient) ListN(count int, offset int) ([]*Plan, error)
- func (self *PlanClient) Retrieve(id string) (*Plan, error)
- func (self *PlanClient) Update(id string, newName string) (*Plan, error)
- type PlanParams
- type String
- type Subscription
- type SubscriptionClient
- type SubscriptionItem
- type SubscriptionParams
- type Token
- type TokenClient
- type TokenParams
Constants ¶
const ( AmericanExpress = "American Express" DinersClub = "Diners Club" Discover = "Discover" JCB = "JCB" MasterCard = "MasterCard" Visa = "Visa" UnknownCard = "Unknown" )
Credit Card Types accepted by the Stripe API.
const ( USD = "usd" // US Dollar ($) EUR = "eur" // Euro (€) GBP = "gbp" // British Pound Sterling (UK£) JPY = "jpy" // Japanese Yen (¥) CAD = "cad" // Canadian Dollar (CA$) HKD = "hkd" // Hong Kong Dollar (HK$) CNY = "cny" // Chinese Yuan (CN¥) AUD = "aud" // Australian Dollar (A$) )
ISO 3-digit Currency Codes for major currencies (not the full list).
const ( DurationForever = "forever" DurationOnce = "once" DurationRepeating = "repeating" )
Coupon Durations
const ( ErrTypeInvalidRequest = "invalid_request_error" ErrTypeAPI = "api_error" ErrTypeCard = "card_error" ErrCodeIncorrectNumber = "incorrect_number" ErrCodeInvalidNumber = "invalid_number" ErrCodeInvalidExpiryMonth = "invalid_expiry_month" ErrCodeInvalidExpiryYear = "invalid_expiry_year" ErrCodeInvalidCVC = "invalid_cvc" ErrCodeExpiredCard = "expired_card" ErrCodeIncorrectCVC = "incorrect_cvc" ErrCodeIncorrectZIP = "incorrect_zip" ErrCodeCardDeclined = "card_declined" ErrCodeMissing = "missing" ErrCodeProcessingError = "processing_error" )
Stripe-provided error codes and types See https://stripe.com/docs/api#errors
const ( IntervalMonth = "month" IntervalYear = "year" )
Plan Intervals
const ( SubscriptionTrialing = "trialing" SubscriptionActive = "active" SubscriptionPastDue = "past_due" SubscriptionCanceled = "canceled" SubscriptionUnpaid = "unpaid" )
Subscription Statuses
Variables ¶
var ( Charges = new(ChargeClient) Coupons = new(CouponClient) Customers = new(CustomerClient) Invoices = new(InvoiceClient) InvoiceItems = new(InvoiceItemClient) Plans = new(PlanClient) Subscriptions = new(SubscriptionClient) Tokens = new(TokenClient) )
Available APIs
Functions ¶
func GetCardType ¶
GetCardType is a simple algorithm to determine the Card Type (ie Visa, Discover) based on the Credit Card Number. If the Number is not recognized, a value of "Unknown" will be returned.
func IsLuhnValid ¶
IsLuhnValid uses the Luhn Algorithm (also known as the Mod 10 algorithm) to verify a credit cards checksum, which helps flag accidental data entry errors.
func SetKey ¶
func SetKey(key string)
SetKey will set the default Stripe API key used to authenticate all Stripe API requests.
Types ¶
type Bool ¶
type Bool bool
Bool is a special type of bool that can unmarshall a JSON value of "null", which cannot be parsed by the Go JSON parser as of Go v1.
see http://code.google.com/p/go/issues/detail?id=2540
func (*Bool) UnmarshalJSON ¶
type Card ¶
type Card struct { Id string `json:"id"` Name String `json:"name,omitempty"` Type string `json:"type"` ExpMonth int `json:"exp_month"` ExpYear int `json:"exp_year"` Last4 string `json:"last4"` Fingerprint string `json:"fingerprint"` Country String `json:"country,omitempty"` Address1 String `json:"address_line1,omitempty"` Address2 String `json:"address_line2,omitempty"` AddressCountry String `json:"address_country,omitempty"` AddressState String `json:"address_state,omitempty"` AddressZip String `json:"address_zip,omitempty"` AddressCity String `json:"address_city"` AddressLine1Check String `json:"address_line1_check,omitempty"` AddressZipCheck String `json:"address_zip_check,omitempty"` CVCCheck String `json:"cvc_check,omitempty"` }
Card represents details about a Credit Card entered into Stripe.
type CardClient ¶
type CardClient struct{}
CardClient encapsulates operations for creating, updating, deleting and querying cards using the Stripe REST API.
func (*CardClient) Create ¶
func (self *CardClient) Create(c *CardParams, customerId string) (*Card, error)
func (*CardClient) Delete ¶
func (self *CardClient) Delete(cardId string, customerId string) (*DeleteResp, error)
type CardParams ¶
type CardParams struct { // (Optional) Cardholder's full name. Name string // The card number, as a string without any separators. Number string // Two digit number representing the card's expiration month. ExpMonth int // Four digit number representing the card's expiration year. ExpYear int // Card security code CVC string // (Optional) Billing address line 1 Address1 string // (Optional) Billing address line 2 Address2 string // (Optional) Billing address country AddressCountry string // (Optional) Billing address state AddressState string // (Optional) Billing address zip code AddressZip string }
CardParams encapsulates options for Creating or Updating Credit Cards.
type Charge ¶
type Charge struct { Id string `json:"id"` Desc String `json:"description"` Amount int64 `json:"amount"` Card *Card `json:"card"` Currency string `json:"currency"` Created int64 `json:"created"` Customer String `json:"customer"` Invoice String `json:"invoice"` Fee int64 `json:"fee"` Paid bool `json:"paid"` Details []*FeeDetails `json:"fee_details"` Refunded bool `json:"refunded"` AmountRefunded Int64 `json:"amount_refunded"` FailureMessage String `json:"failure_message"` Disputed bool `json:"disputed"` Livemode bool `json:"livemode"` StatementDescription string `json:"statement_description"` }
Charge represents details about a credit card charge in Stripe.
type ChargeClient ¶
type ChargeClient struct{}
ChargeClient encapsulates operations for creating, updating, deleting and querying charges using the Stripe REST API.
func (*ChargeClient) Create ¶
func (self *ChargeClient) Create(params *ChargeParams) (*Charge, error)
Creates a new credit card Charge.
func (*ChargeClient) CustomerList ¶
func (self *ChargeClient) CustomerList(id string) ([]*Charge, error)
Returns a list of your Charges with the given Customer ID.
func (*ChargeClient) CustomerListN ¶
Returns a list of your Charges with the given Customer ID and range.
func (*ChargeClient) List ¶
func (self *ChargeClient) List() ([]*Charge, error)
Returns a list of your Charges.
func (*ChargeClient) ListN ¶
func (self *ChargeClient) ListN(count int, offset int) ([]*Charge, error)
Returns a list of your Charges with the specified range.
func (*ChargeClient) Refund ¶
func (self *ChargeClient) Refund(id string) (*Charge, error)
Refunds a charge for the full amount.
func (*ChargeClient) RefundAmount ¶
func (self *ChargeClient) RefundAmount(id string, amt int64) (*Charge, error)
Refunds a charge for the specified amount.
type ChargeParams ¶
type ChargeParams struct { // A positive integer in cents representing how much to charge the card. // The minimum amount is 50 cents. Amount int64 // 3-letter ISO code for currency. Refer to the Stripe docs for currently // supported currencies: https://support.stripe.com/questions/which-currencies-does-stripe-support Currency string // (Optional) Either customer or card is required, but not both The ID of an // existing customer that will be charged in this request. Customer string // (Optional) Credit Card that should be charged. Card *CardParams // (Optional) Credit Card token that should be charged. Token string // An arbitrary string which you can attach to a charge object. It is // displayed when in the web interface alongside the charge. It's often a // good idea to use an email address as a description for tracking later. Desc string // An arbitrary string to be displayed alongside your company name on your // customer's credit card statement. This may be up to 15 characters. As an // example, if your website is RunClub and you specify 5K Race Ticket, the // user will see: // RUNCLUB 5K RACE TICKET. // The statement description may not include <>"' characters. While most // banks display this information consistently, some may display it // incorrectly or not at all. StatementDescription string }
ChargeParams encapsulates options for creating a new Charge.
type Coupon ¶
type Coupon struct { Id string `json:"id"` Duration string `json:"duration"` PercentOff int `json:"percent_off"` DurationInMonths Int `json:"duration_in_months,omitempty"` MaxRedemptions Int `json:"max_redemptions,omitempty"` RedeemBy Int64 `json:"redeem_by,omitempty"` TimesRedeemed int `json:"times_redeemed,omitempty"` Livemode bool `json:"livemode"` }
Coupon represents percent-off discount you might want to apply to a customer.
type CouponClient ¶
type CouponClient struct{}
CouponClient encapsulates operations for creating, updating, deleting and querying coupons using the Stripe REST API.
func (*CouponClient) Create ¶
func (self *CouponClient) Create(params *CouponParams) (*Coupon, error)
Creates a new Coupon.
func (*CouponClient) Delete ¶
func (self *CouponClient) Delete(id string) (bool, error)
Deletes the coupon with the given ID.
func (*CouponClient) List ¶
func (self *CouponClient) List() ([]*Coupon, error)
Returns a list of your coupons.
func (*CouponClient) ListN ¶
func (self *CouponClient) ListN(count int, offset int) ([]*Coupon, error)
Returns a list of your coupons at the specified range.
type CouponParams ¶
type CouponParams struct { // (Optional) Unique string of your choice that will be used to identify // this coupon when applying it a customer. Id string // A positive integer between 1 and 100 that represents the discount the // coupon will apply. PercentOff int // Specifies how long the discount will be in effect. Can be forever, once, // or repeating. Duration string // (Optional) If duration is repeating, a positive integer that specifies // the number of months the discount will be in effect. DurationInMonths int // (Optional) A positive integer specifying the number of times the coupon // can be redeemed before it's no longer valid. For example, you might have // a 50% off coupon that the first 20 readers of your blog can use. MaxRedemptions int // (Optional) UTC timestamp specifying the last time at which the coupon can // be redeemed. After the redeem_by date, the coupon can no longer be // applied to new customers. RedeemBy int64 }
CouponParams encapsulates options for creating a new Coupon.
type Customer ¶
type Customer struct { Id string `json:"id"` Desc String `json:"description,omitempty"` Email String `json:"email,omitempty"` Created int64 `json:"created"` Balance int64 `json:"account_balance"` Delinquent bool `json:"delinquent"` Cards CardData `json:"cards,omitempty"` Discount *Discount `json:"discount,omitempty"` Subscription *Subscription `json:"subscription,omitempty"` Livemode bool `json:"livemode"` DefaultCard String `json:"default_card"` }
Customer encapsulates details about a Customer registered in Stripe.
type CustomerClient ¶
type CustomerClient struct{}
CustomerClient encapsulates operations for creating, updating, deleting and querying customers using the Stripe REST API.
func (*CustomerClient) Create ¶
func (self *CustomerClient) Create(c *CustomerParams) (*Customer, error)
Creates a new Customer.
func (*CustomerClient) Delete ¶
func (self *CustomerClient) Delete(id string) (bool, error)
Deletes a Customer (permanently) with the given ID.
func (*CustomerClient) List ¶
func (self *CustomerClient) List() ([]*Customer, error)
Returns a list of your Customers.
func (*CustomerClient) ListN ¶
func (self *CustomerClient) ListN(count int, offset int) ([]*Customer, error)
Returns a list of your Customers at the specified range.
func (*CustomerClient) Retrieve ¶
func (self *CustomerClient) Retrieve(id string) (*Customer, error)
Retrieves a Customer with the given ID.
func (*CustomerClient) Update ¶
func (self *CustomerClient) Update(id string, c *CustomerParams) (*Customer, error)
Updates a Customer with the given ID.
type CustomerParams ¶
type CustomerParams struct { // (Optional) The customer's email address. Email string // (Optional) An arbitrary string which you can attach to a customer object. Desc string // (Optional) Customer's Active Credit Card Card *CardParams // (Optional) Customer's Active Credid Card, using a Card Token Token string // (Optional) If you provide a coupon code, the customer will have a // discount applied on all recurring charges. Coupon string // (Optional) The identifier of the plan to subscribe the customer to. If // provided, the returned customer object has a 'subscription' attribute // describing the state of the customer's subscription. Plan string // (Optional) UTC integer timestamp representing the end of the trial period // the customer will get before being charged for the first time. TrialEnd int64 // (Optional) An integer amount in cents that is the starting account // balance for your customer. AccountBalance int64 // (Optional) A set of key/value pairs that you can attach to a customer // object. Metadata map[string]string // (Optional) The quantity you’d like to apply to the subscription you’re // creating. Quantity int64 }
CustomerParams encapsulates options for creating and updating Customers.
type DeleteResp ¶
type DeleteResp struct { // ID of the Object that was deleted Id string `json:"id"` // Boolean value indicating object was successfully deleted. Deleted bool `json:"deleted"` }
Response to a Deletion request.
type Discount ¶
type Discount struct { Id string `json:"id"` Customer string `json:"customer"` Start Int64 `json:"start"` End Int64 `json:"end"` Coupon *Coupon `json:"coupon"` }
Discount represents the actual application of a coupon to a particular customer.
type Error ¶
type Error struct { Code int Detail struct { Type string `json:"type"` Message string `json:"message"` Code string `json:"code,omitempty"` Param string `json:"param,omitempty"` } `json:"error"` }
Error encapsulates an error returned by the Stripe REST API. Detail.Code and Detail.Param may be empty.
type FeeDetails ¶
type FeeDetails struct { Amount int64 `json:"amount"` Currency string `json:"currency"` Type string `json:"type"` Application String `json:"application"` }
FeeDetails represents a single fee associated with a Charge.
type Int ¶
type Int int
Int is a special type of integer that can unmarshall a JSON value of "null", which cannot be parsed by the Go JSON parser as of Go v1.
see http://code.google.com/p/go/issues/detail?id=2540
func (*Int) UnmarshalJSON ¶
type Int64 ¶
type Int64 int64
Int64 is a special type of int64 that can unmarshall a JSON value of "null", which cannot be parsed by the Go JSON parser as of Go v1.
see http://code.google.com/p/go/issues/detail?id=2540
func (*Int64) UnmarshalJSON ¶
type Invoice ¶
type Invoice struct { Id string `json:"id"` AmountDue int64 `json:"amount_due"` AttemptCount int `json:"attempt_count"` Attempted bool `json:"attempted"` Closed bool `json:"closed"` Paid bool `json:"paid"` PeriodEnd int64 `json:"period_end"` PeriodStart int64 `json:"period_start"` Subtotal int64 `json:"subtotal"` Total int64 `json:"total"` Charge String `json:"charge"` Customer string `json:"customer"` Date int64 `json:"date"` Discount *Discount `json:"discount"` Lines *InvoiceLines `json:"lines"` StartingBalance int64 `json:"starting_balance"` EndingBalance Int64 `json:"ending_balance"` NextPayment Int64 `json:"next_payment_attempt"` Livemode bool `json:"livemode"` }
Invoice represents statements of what a customer owes for a particular billing period, including subscriptions, invoice items, and any automatic proration adjustments if necessary.
type InvoiceClient ¶
type InvoiceClient struct{}
InvoiceClient encapsulates operations for querying invoices using the Stripe REST API.
func (*InvoiceClient) CustomerList ¶
func (self *InvoiceClient) CustomerList(id string) ([]*Invoice, error)
Returns a list of Invoices with the given Customer ID.
func (*InvoiceClient) CustomerListN ¶
Returns a list of Invoices with the given Customer ID, at the specified range.
func (*InvoiceClient) List ¶
func (self *InvoiceClient) List() ([]*Invoice, error)
Returns a list of Invoices.
func (*InvoiceClient) ListN ¶
func (self *InvoiceClient) ListN(count int, offset int) ([]*Invoice, error)
Returns a list of Invoices at the specified range.
func (*InvoiceClient) Retrieve ¶
func (self *InvoiceClient) Retrieve(id string) (*Invoice, error)
Retrieves the invoice with the given ID.
func (*InvoiceClient) RetrieveCustomer ¶
func (self *InvoiceClient) RetrieveCustomer(cid string) (*Invoice, error)
Retrieves the upcoming invoice the given customer ID.
type InvoiceItem ¶
type InvoiceItem struct { Id string `json:"id"` Amount int64 `json:"amount"` Currency string `json:"currency"` Customer string `json:"customer"` Date int64 `json:"date"` Desc String `json:"description"` Invoice String `json:"invoice"` Livemode bool `json:"livemode"` }
InvoiceItem represents a charge (or credit) that should be applied to the customer at the end of a billing cycle.
type InvoiceItemClient ¶
type InvoiceItemClient struct{}
InvoiceItemClient encapsulates operations for creating, updating, deleting and querying invoices using the Stripe REST API.
func (*InvoiceItemClient) Create ¶
func (self *InvoiceItemClient) Create(params *InvoiceItemParams) (*InvoiceItem, error)
Create adds an arbitrary charge or credit to the customer's upcoming invoice.
func (*InvoiceItemClient) CustomerList ¶
func (self *InvoiceItemClient) CustomerList(id string) ([]*InvoiceItem, error)
Returns a list of Invoice Items for the specified Customer ID.
func (*InvoiceItemClient) CustomerListN ¶
func (self *InvoiceItemClient) CustomerListN(id string, count int, offset int) ([]*InvoiceItem, error)
Returns a list of Invoice Items for the specified Customer ID, at the specified range.
func (*InvoiceItemClient) Delete ¶
func (self *InvoiceItemClient) Delete(id string) (bool, error)
Removes an Invoice Item with the given ID.
func (*InvoiceItemClient) List ¶
func (self *InvoiceItemClient) List() ([]*InvoiceItem, error)
Returns a list of Invoice Items.
func (*InvoiceItemClient) ListN ¶
func (self *InvoiceItemClient) ListN(count int, offset int) ([]*InvoiceItem, error)
Returns a list of Invoice Items at the specified range.
func (*InvoiceItemClient) Retrieve ¶
func (self *InvoiceItemClient) Retrieve(id string) (*InvoiceItem, error)
Retrieves the Invoice Item with the given ID.
func (*InvoiceItemClient) Update ¶
func (self *InvoiceItemClient) Update(id string, params *InvoiceItemParams) (*InvoiceItem, error)
Update changes the amount or description of an Invoice Item on an upcoming invoice, using the given Invoice Item ID.
type InvoiceItemParams ¶
type InvoiceItemParams struct { // The ID of the customer who will be billed when this invoice item is // billed. Customer string // The integer amount in cents of the charge to be applied to the upcoming // invoice. If you want to apply a credit to the customer's account, pass a // negative amount. Amount int64 // 3-letter ISO code for currency. Currently, only 'usd' is supported. Currency string // (Optional) An arbitrary string which you can attach to the invoice item. // The description is displayed in the invoice for easy tracking. Desc string // (Optional) The ID of an existing invoice to add this invoice item to. // When left blank, the invoice item will be added to the next upcoming // scheduled invoice. Invoice string }
InvoiceItemParams encapsulates options for creating a new Invoice Items.
type InvoiceLines ¶
type InvoiceLines struct { InvoiceItems []*InvoiceItem `json:"invoiceitems"` Prorations []*InvoiceItem `json:"prorations"` Subscriptions []*SubscriptionItem `json:"subscriptions"` }
InvoiceLines represents an individual line items that is part of an invoice.
type Plan ¶
type Plan struct { Id string `json:"id"` Name string `json:"name"` Amount int64 `json:"amount"` Interval string `json:"interval"` IntervalCount int `json:"interval_count"` Currency string `json:"currency"` TrialPeriodDays Int `json:"trial_period_days"` Livemode bool `json:"livemode"` }
Plan holds details about pricing information for different products and feature levels on your site. For example, you might have a $10/month plan for basic features and a different $20/month plan for premium features.
type PlanClient ¶
type PlanClient struct{}
PlanClient encapsulates operations for creating, updating, deleting and querying plans using the Stripe REST API.
func (*PlanClient) Create ¶
func (self *PlanClient) Create(params *PlanParams) (*Plan, error)
Creates a new Plan.
func (*PlanClient) Delete ¶
func (self *PlanClient) Delete(id string) (bool, error)
Deletes a plan with the given ID.
func (*PlanClient) List ¶
func (self *PlanClient) List() ([]*Plan, error)
Returns a list of your Plans.
func (*PlanClient) ListN ¶
func (self *PlanClient) ListN(count int, offset int) ([]*Plan, error)
Returns a list of your Plans at the specified range.
func (*PlanClient) Retrieve ¶
func (self *PlanClient) Retrieve(id string) (*Plan, error)
Retrieves the plan with the given ID.
type PlanParams ¶
type PlanParams struct { // Unique string of your choice that will be used to identify this plan // when subscribing a customer. Id string // A positive integer in cents (or 0 for a free plan) representing how much // to charge (on a recurring basis) Amount int64 // 3-letter ISO code for currency. Currently, only 'usd' is supported. Currency string // Specifies billing frequency. Either month or year. Interval string // Name of the plan, to be displayed on invoices and in the web interface. Name string // (Optional) Specifies a trial period in (an integer number of) days. If // you include a trial period, the customer won't be billed for the first // time until the trial period ends. If the customer cancels before the // trial period is over, she'll never be billed at all. TrialPeriodDays int }
PlanParams encapsulates options for creating a new Plan.
type String ¶
type String string
String is a special type of string that can unmarshall a JSON value of "null", which cannot be parsed by the Go JSON parser as of Go v1.
see http://code.google.com/p/go/issues/detail?id=2540
func (*String) UnmarshalJSON ¶
type Subscription ¶
type Subscription struct { Customer string `json:"customer"` Status string `json:"status"` Plan *Plan `json:"plan"` Start int64 `json:"start"` EndedAt Int64 `json:"ended_at"` CurrentPeriodStart Int64 `json:"current_period_start"` CurrentPeriodEnd Int64 `json:"current_period_end"` TrialStart Int64 `json:"trial_start"` TrialEnd Int64 `json:"trial_end"` CanceledAt Int64 `json:"canceled_at"` CancelAtPeriodEnd bool `json:"cancel_at_period_end"` Quantity int64 `json"quantity"` }
Subscriptions represents a recurring charge a customer's card.
type SubscriptionClient ¶
type SubscriptionClient struct{}
SubscriptionClient encapsulates operations for updating and canceling customer subscriptions using the Stripe REST API.
func (*SubscriptionClient) Cancel ¶
func (self *SubscriptionClient) Cancel(customerId string) (*Subscription, error)
Cancels the customer's subscription if it exists. It cancels the subscription immediately.
func (*SubscriptionClient) CancelAtPeriodEnd ¶
func (self *SubscriptionClient) CancelAtPeriodEnd(customerId string) (*Subscription, error)
Cancels the customer's subscription at the end of the billing period.
func (*SubscriptionClient) Update ¶
func (self *SubscriptionClient) Update(customerId string, params *SubscriptionParams) (*Subscription, error)
Subscribes a customer to a new plan.
type SubscriptionItem ¶
type SubscriptionParams ¶
type SubscriptionParams struct { // The identifier of the plan to subscribe the customer to. Plan string // (Optional) The code of the coupon to apply to the customer if you would // like to apply it at the same time as creating the subscription. Coupon string // (Optional) Flag telling us whether to prorate switching plans during a // billing cycle Prorate bool // (Optional) UTC integer timestamp representing the end of the trial period // the customer will get before being charged for the first time. If set, // trial_end will override the default trial period of the plan the customer // is being subscribed to. TrialEnd int64 // (Optional) A new card to attach to the customer. Card *CardParams // (Optional) A new card Token to attach to the customer. Token string // (Optional) The quantity you'd like to apply to the subscription you're creating. Quantity int64 }
SubscriptionParams encapsulates options for updating a Customer's subscription.
type Token ¶
type Token struct { Id string `json:"id"` Amount int64 `json:"amount"` Currency string `json:"currency"` Created int64 `json:"created"` Used bool `json:"used"` Livemode bool `json:"livemode"` Type string `json:"type"` Card *Card `json:"card"` }
Token represents a unique identifier for a credit card that can be safely stored without having to hold sensitive card information on your own servers.
type TokenClient ¶
type TokenClient struct{}
TokenClient encapsulates operations for creating and querying tokens using the Stripe REST API.
func (*TokenClient) Create ¶
func (self *TokenClient) Create(params *TokenParams) (*Token, error)
Creates a single use token that wraps the details of a credit card. This token can be used in place of a credit card hash with any API method. These tokens can only be used once: by creating a new charge object, or attaching them to a customer.
type TokenParams ¶
type TokenParams struct { //Currency string REMOVED! no longer part of the API Card *CardParams }
TokenParams encapsulates options for creating a new Card Token.