class Stripe::CouponsApi
- Stripe::CouponsApi
- Reference
- Object
Defined in:
stripe/api/coupons_api.crConstant Summary
-
DELETE_COUPONS_COUPON_MAX_LENGTH_FOR_COUPON =
5000
-
GET_COUPONS_COUPON_MAX_LENGTH_FOR_COUPON =
5000
-
GET_COUPONS_MAX_LENGTH_FOR_ENDING_BEFORE =
5000
-
GET_COUPONS_MAX_LENGTH_FOR_STARTING_AFTER =
5000
-
POST_COUPONS_COUPON_MAX_LENGTH_FOR_COUPON =
5000
-
POST_COUPONS_COUPON_MAX_LENGTH_FOR_NAME =
40
-
POST_COUPONS_MAX_LENGTH_FOR_ID =
5000
-
POST_COUPONS_MAX_LENGTH_FOR_NAME =
40
-
POST_COUPONS_VALID_VALUES_FOR_DURATION =
String.static_array("forever", "once", "repeating")
Constructors
Instance Method Summary
- #api_client : ApiClient
- #api_client=(api_client : ApiClient)
-
#build_api_request_for_delete_coupons_coupon(*, coupon : String | Nil = nil) : Crest::Request
@return Crest::Request
-
#build_api_request_for_get_coupons(*, ending_before : String | Nil = nil, starting_after : String | Nil = nil, created : Stripe::GetAccountsCreatedParameter | Nil = nil, limit : Int64 | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Crest::Request
@return Crest::Request
-
#build_api_request_for_get_coupons_coupon(*, coupon : String | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Crest::Request
@return Crest::Request
-
#build_api_request_for_post_coupons(*, amount_off : Int64 | Nil = nil, applies_to : Stripe::AppliesToParams | Nil = nil, currency : String | Nil = nil, currency_options : Hash(String, Stripe::CurrencyOption) | Nil = nil, duration : String | Nil = nil, duration_in_months : Int64 | Nil = nil, expand : Array(String) | Nil = nil, id : String | Nil = nil, max_redemptions : Int64 | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, name : String | Nil = nil, percent_off : Float64 | Nil = nil, redeem_by : Int64 | Nil = nil) : Crest::Request
@return Crest::Request
-
#build_api_request_for_post_coupons_coupon(*, coupon : String | Nil = nil, currency_options : Hash(String, Stripe::CurrencyOption) | Nil = nil, expand : Array(String) | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, name : String | Nil = nil) : Crest::Request
@return Crest::Request
- #client_side_validation?(*args, **options)
- #client_side_validation?(*args, **options, &)
- #debugging?(*args, **options)
- #debugging?(*args, **options, &)
-
#delete_coupons_coupon(*, coupon : String | Nil = nil) : Stripe::DeletedCoupon
You can delete coupons via the coupon management page of the Stripe dashboard.
-
#delete_coupons_coupon(*, coupon : String | Nil = nil, &block : Crest::Response -> ) : Nil
<p>You can delete coupons via the <a href="https://dashboard.stripe.com/coupons">coupon management</a> page of the Stripe dashboard.
-
#delete_coupons_coupon_with_http_info(*, coupon : String | Nil = nil) : Tuple(Stripe::DeletedCoupon, Int32, Hash(String, Array(String) | String))
<p>You can delete coupons via the <a href="https://dashboard.stripe.com/coupons">coupon management</a> page of the Stripe dashboard.
-
#get_coupons(*, ending_before : String | Nil = nil, starting_after : String | Nil = nil, created : Stripe::GetAccountsCreatedParameter | Nil = nil, limit : Int64 | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Stripe::CouponsResourceCouponList
Returns a list of your coupons.
@optional @param ending_before [String?] A cursor for use in pagination. -
#get_coupons(*, ending_before : String | Nil = nil, starting_after : String | Nil = nil, created : Stripe::GetAccountsCreatedParameter | Nil = nil, limit : Int64 | Nil = nil, expand : Array(Array(String)) | Nil = nil, &block : Crest::Response -> ) : Nil
<p>Returns a list of your coupons.</p> @optional @param ending_before [String?] A cursor for use in pagination.
-
#get_coupons_coupon(*, coupon : String | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Stripe::Coupon
Retrieves the coupon with the given ID.
@required @param coupon [String?] @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. -
#get_coupons_coupon(*, coupon : String | Nil = nil, expand : Array(Array(String)) | Nil = nil, &block : Crest::Response -> ) : Nil
<p>Retrieves the coupon with the given ID.</p> @required @param coupon [String?] @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded.
-
#get_coupons_coupon_with_http_info(*, coupon : String | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Tuple(Stripe::Coupon, Int32, Hash(String, Array(String) | String))
<p>Retrieves the coupon with the given ID.</p> @required @param coupon [String?] @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded.
-
#get_coupons_with_http_info(*, ending_before : String | Nil = nil, starting_after : String | Nil = nil, created : Stripe::GetAccountsCreatedParameter | Nil = nil, limit : Int64 | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Tuple(Stripe::CouponsResourceCouponList, Int32, Hash(String, Array(String) | String))
<p>Returns a list of your coupons.</p> @optional @param ending_before [String?] A cursor for use in pagination.
-
#post_coupons(*, amount_off : Int64 | Nil = nil, applies_to : Stripe::AppliesToParams | Nil = nil, currency : String | Nil = nil, currency_options : Hash(String, Stripe::CurrencyOption) | Nil = nil, duration : String | Nil = nil, duration_in_months : Int64 | Nil = nil, expand : Array(String) | Nil = nil, id : String | Nil = nil, max_redemptions : Int64 | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, name : String | Nil = nil, percent_off : Float64 | Nil = nil, redeem_by : Int64 | Nil = nil) : Stripe::Coupon
You can create coupons easily via the coupon management page of the Stripe dashboard.
-
#post_coupons(*, amount_off : Int64 | Nil = nil, applies_to : Stripe::AppliesToParams | Nil = nil, currency : String | Nil = nil, currency_options : Hash(String, Stripe::CurrencyOption) | Nil = nil, duration : String | Nil = nil, duration_in_months : Int64 | Nil = nil, expand : Array(String) | Nil = nil, id : String | Nil = nil, max_redemptions : Int64 | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, name : String | Nil = nil, percent_off : Float64 | Nil = nil, redeem_by : Int64 | Nil = nil, &block : Crest::Response -> ) : Nil
<p>You can create coupons easily via the <a href="https://dashboard.stripe.com/coupons">coupon management</a> page of the Stripe dashboard.
-
#post_coupons_coupon(*, coupon : String | Nil = nil, currency_options : Hash(String, Stripe::CurrencyOption) | Nil = nil, expand : Array(String) | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, name : String | Nil = nil) : Stripe::Coupon
Updates the metadata of a coupon.
-
#post_coupons_coupon(*, coupon : String | Nil = nil, currency_options : Hash(String, Stripe::CurrencyOption) | Nil = nil, expand : Array(String) | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, name : String | Nil = nil, &block : Crest::Response -> ) : Nil
<p>Updates the metadata of a coupon.
-
#post_coupons_coupon_with_http_info(*, coupon : String | Nil = nil, currency_options : Hash(String, Stripe::CurrencyOption) | Nil = nil, expand : Array(String) | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, name : String | Nil = nil) : Tuple(Stripe::Coupon, Int32, Hash(String, Array(String) | String))
<p>Updates the metadata of a coupon.
-
#post_coupons_with_http_info(*, amount_off : Int64 | Nil = nil, applies_to : Stripe::AppliesToParams | Nil = nil, currency : String | Nil = nil, currency_options : Hash(String, Stripe::CurrencyOption) | Nil = nil, duration : String | Nil = nil, duration_in_months : Int64 | Nil = nil, expand : Array(String) | Nil = nil, id : String | Nil = nil, max_redemptions : Int64 | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, name : String | Nil = nil, percent_off : Float64 | Nil = nil, redeem_by : Int64 | Nil = nil) : Tuple(Stripe::Coupon, Int32, Hash(String, Array(String) | String))
<p>You can create coupons easily via the <a href="https://dashboard.stripe.com/coupons">coupon management</a> page of the Stripe dashboard.
Constructor Detail
Instance Method Detail
@return Crest::Request
@return Crest::Request
@return Crest::Request
@return Crest::Request
@return Crest::Request
You can delete coupons via the coupon management 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.
@required @param coupon [String?] @return [Stripe::DeletedCoupon]<p>You can delete coupons via the <a href="https://dashboard.stripe.com/coupons">coupon management</a> 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.</p> @required @param coupon [String?] @return nil
<p>You can delete coupons via the <a href="https://dashboard.stripe.com/coupons">coupon management</a> 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.</p> @required @param coupon [String?] @return [Tuple(Stripe::DeletedCoupon, Integer, Hash)] Stripe::DeletedCoupon, response status code and response headers
Returns a list of your coupons.
@optional @param ending_before [String?] A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @optional @param starting_after [String?] A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. @optional @param created [Stripe::GetAccountsCreatedParameter?] A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. @optional @param limit [Int32?] A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return [Stripe::CouponsResourceCouponList]<p>Returns a list of your coupons.</p>
@optional @param ending_before [String?] A cursor for use in pagination. ending_before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar
, your subsequent call can include ending_before=obj_bar
in order to fetch the previous page of the list.
@optional @param starting_after [String?] A cursor for use in pagination. starting_after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo
, your subsequent call can include starting_after=obj_foo
in order to fetch the next page of the list.
@optional @param created [Stripe::GetAccountsCreatedParameter?] A filter on the list, based on the object created
field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.
@optional @param limit [Int32?] A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
@optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded.
@return nil
Retrieves the coupon with the given ID.
@required @param coupon [String?] @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return [Stripe::Coupon]<p>Retrieves the coupon with the given ID.</p> @required @param coupon [String?] @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return nil
<p>Retrieves the coupon with the given ID.</p> @required @param coupon [String?] @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return [Tuple(Stripe::Coupon, Integer, Hash)] Stripe::Coupon, response status code and response headers
<p>Returns a list of your coupons.</p>
@optional @param ending_before [String?] A cursor for use in pagination. ending_before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar
, your subsequent call can include ending_before=obj_bar
in order to fetch the previous page of the list.
@optional @param starting_after [String?] A cursor for use in pagination. starting_after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo
, your subsequent call can include starting_after=obj_foo
in order to fetch the next page of the list.
@optional @param created [Stripe::GetAccountsCreatedParameter?] A filter on the list, based on the object created
field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.
@optional @param limit [Int32?] A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
@optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded.
@return [Tuple(Stripe::CouponsResourceCouponList, Integer, Hash)] Stripe::CouponsResourceCouponList, response status code and response headers
You can create coupons easily via the coupon management 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 amount_off
of amount_off
of
<p>You can create coupons easily via the <a href="https://dashboard.stripe.com/coupons">coupon management</a> page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.</p> <p>A coupon has either a <code>percent_off</code> or an <code>amount_off</code> and <code>currency</code>. If you set an <code>amount_off</code>, that amount will be subtracted from any invoice’s subtotal. For example, an invoice with a subtotal of <currency>100</currency> will have a final total of <currency>0</currency> if a coupon with an <code>amount_off</code> of <amount>200</amount> is applied to it and an invoice with a subtotal of <currency>300</currency> will have a final total of <currency>100</currency> if a coupon with an <code>amount_off</code> of <amount>200</amount> is applied to it.</p>
@optional @param amount_off [Int32?] A positive integer representing the amount to subtract from an invoice total (required if percent_off
is not passed).
@optional @param applies_to [Stripe::AppliesToParams?]
@optional @param currency [String?] Three-letter ISO code for the currency of the amount_off
parameter (required if amount_off
is passed).
@optional @param currency_options [Hash(String, Stripe::CurrencyOption)?]
@optional @param duration [String?] Specifies how long the discount will be in effect if used on a subscription. Defaults to once
.
@optional @param duration_in_months [Int32?] Required only if duration
is repeating
, in which case it must be a positive integer that specifies the number of months the discount will be in effect.
@optional @param expand [Array(String)?] Specifies which fields in the response should be expanded.
@optional @param id [String?] Unique string of your choice that will be used to identify this coupon when applying it to a customer. If you don't want to specify a particular code, you can leave the ID blank and we'll generate a random code for you.
@optional @param max_redemptions [Int32?] 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.
@optional @param metadata [Stripe::PostAccountsRequestMetadata?]
@optional @param name [String?] Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the id
is shown if name
is not set.
@optional @param percent_off [Float64?] A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if amount_off
is not passed).
@optional @param redeem_by [Int32?] Unix 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.
@return nil
Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.
@required @param coupon [String?] @optional @param currency_options [Hash(String, Stripe::CurrencyOption)?] @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param metadata [Stripe::PostAccountsRequestMetadata?] @optional @param name [String?] Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the `id` is shown if `name` is not set. @return [Stripe::Coupon]<p>Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.</p>
@required @param coupon [String?]
@optional @param currency_options [Hash(String, Stripe::CurrencyOption)?]
@optional @param expand [Array(String)?] Specifies which fields in the response should be expanded.
@optional @param metadata [Stripe::PostAccountsRequestMetadata?]
@optional @param name [String?] Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the id
is shown if name
is not set.
@return nil
<p>Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.</p>
@required @param coupon [String?]
@optional @param currency_options [Hash(String, Stripe::CurrencyOption)?]
@optional @param expand [Array(String)?] Specifies which fields in the response should be expanded.
@optional @param metadata [Stripe::PostAccountsRequestMetadata?]
@optional @param name [String?] Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the id
is shown if name
is not set.
@return [Tuple(Stripe::Coupon, Integer, Hash)] Stripe::Coupon, response status code and response headers
<p>You can create coupons easily via the <a href="https://dashboard.stripe.com/coupons">coupon management</a> page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.</p> <p>A coupon has either a <code>percent_off</code> or an <code>amount_off</code> and <code>currency</code>. If you set an <code>amount_off</code>, that amount will be subtracted from any invoice’s subtotal. For example, an invoice with a subtotal of <currency>100</currency> will have a final total of <currency>0</currency> if a coupon with an <code>amount_off</code> of <amount>200</amount> is applied to it and an invoice with a subtotal of <currency>300</currency> will have a final total of <currency>100</currency> if a coupon with an <code>amount_off</code> of <amount>200</amount> is applied to it.</p>
@optional @param amount_off [Int32?] A positive integer representing the amount to subtract from an invoice total (required if percent_off
is not passed).
@optional @param applies_to [Stripe::AppliesToParams?]
@optional @param currency [String?] Three-letter ISO code for the currency of the amount_off
parameter (required if amount_off
is passed).
@optional @param currency_options [Hash(String, Stripe::CurrencyOption)?]
@optional @param duration [String?] Specifies how long the discount will be in effect if used on a subscription. Defaults to once
.
@optional @param duration_in_months [Int32?] Required only if duration
is repeating
, in which case it must be a positive integer that specifies the number of months the discount will be in effect.
@optional @param expand [Array(String)?] Specifies which fields in the response should be expanded.
@optional @param id [String?] Unique string of your choice that will be used to identify this coupon when applying it to a customer. If you don't want to specify a particular code, you can leave the ID blank and we'll generate a random code for you.
@optional @param max_redemptions [Int32?] 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.
@optional @param metadata [Stripe::PostAccountsRequestMetadata?]
@optional @param name [String?] Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the id
is shown if name
is not set.
@optional @param percent_off [Float64?] A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if amount_off
is not passed).
@optional @param redeem_by [Int32?] Unix 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.
@return [Tuple(Stripe::Coupon, Integer, Hash)] Stripe::Coupon, response status code and response headers