coupon

package
v78.7.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package coupon provides the /coupons APIs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Del

func Del(id string, params *stripe.CouponParams) (*stripe.Coupon, error)

You can delete coupons via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can't redeem the coupon. You can also delete coupons via the API.

func Get

func Get(id string, params *stripe.CouponParams) (*stripe.Coupon, error)

Retrieves the coupon with the given ID.

func New

func New(params *stripe.CouponParams) (*stripe.Coupon, error)

You can create coupons easily via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.

A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice's subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it.

func Update

func Update(id string, params *stripe.CouponParams) (*stripe.Coupon, error)

Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.

Types

type Client

type Client struct {
	B   stripe.Backend
	Key string
}

Client is used to invoke /coupons APIs.

func (Client) Del

func (c Client) Del(id string, params *stripe.CouponParams) (*stripe.Coupon, error)

You can delete coupons via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can't redeem the coupon. You can also delete coupons via the API.

func (Client) Get

func (c Client) Get(id string, params *stripe.CouponParams) (*stripe.Coupon, error)

Retrieves the coupon with the given ID.

func (Client) List

func (c Client) List(listParams *stripe.CouponListParams) *Iter

Returns a list of your coupons.

func (Client) New

func (c Client) New(params *stripe.CouponParams) (*stripe.Coupon, error)

You can create coupons easily via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.

A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice's subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it.

func (Client) Update

func (c Client) Update(id string, params *stripe.CouponParams) (*stripe.Coupon, error)

Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.

type Iter

type Iter struct {
	*stripe.Iter
}

Iter is an iterator for coupons.

func List

func List(params *stripe.CouponListParams) *Iter

Returns a list of your coupons.

func (*Iter) Coupon

func (i *Iter) Coupon() *stripe.Coupon

Coupon returns the coupon which the iterator is currently pointing to.

func (*Iter) CouponList

func (i *Iter) CouponList() *stripe.CouponList

CouponList returns the current list object which the iterator is currently using. List objects will change as new API calls are made to continue pagination.

Jump to

Keyboard shortcuts

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