class Stripe::PromotionCodesApi

Defined in:

stripe/api/promotion_codes_api.cr

Constant Summary

GET_PROMOTION_CODES_MAX_LENGTH_FOR_CODE = 5000
GET_PROMOTION_CODES_MAX_LENGTH_FOR_COUPON = 5000
GET_PROMOTION_CODES_MAX_LENGTH_FOR_CUSTOMER = 5000
GET_PROMOTION_CODES_MAX_LENGTH_FOR_ENDING_BEFORE = 5000
GET_PROMOTION_CODES_MAX_LENGTH_FOR_STARTING_AFTER = 5000
GET_PROMOTION_CODES_PROMOTION_CODE_MAX_LENGTH_FOR_PROMOTION_CODE = 5000
POST_PROMOTION_CODES_MAX_LENGTH_FOR_CODE = 500
POST_PROMOTION_CODES_MAX_LENGTH_FOR_COUPON = 5000
POST_PROMOTION_CODES_MAX_LENGTH_FOR_CUSTOMER = 5000
POST_PROMOTION_CODES_PROMOTION_CODE_MAX_LENGTH_FOR_PROMOTION_CODE = 5000

Constructors

Instance Method Summary

Constructor Detail

def self.new(api_client : Stripe::ApiClient = ApiClient.default) #

[View source]

Instance Method Detail

def api_client : ApiClient #

[View source]
def api_client=(api_client : ApiClient) #

[View source]
def build_api_request_for_get_promotion_codes(*, ending_before : String | Nil = nil, starting_after : String | Nil = nil, created : Stripe::GetAccountsCreatedParameter | Nil = nil, limit : Int64 | Nil = nil, active : Bool | Nil = nil, coupon : String | Nil = nil, customer : String | Nil = nil, code : String | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Crest::Request #

@return Crest::Request


[View source]
def build_api_request_for_get_promotion_codes_promotion_code(*, promotion_code : String | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Crest::Request #

@return Crest::Request


[View source]
def build_api_request_for_post_promotion_codes(*, coupon : String | Nil = nil, active : Bool | Nil = nil, code : String | Nil = nil, customer : String | Nil = nil, expand : Array(String) | Nil = nil, expires_at : Int64 | Nil = nil, max_redemptions : Int64 | Nil = nil, metadata : Hash(String, String) | Nil = nil, restrictions : Stripe::RestrictionsParams | Nil = nil) : Crest::Request #

@return Crest::Request


[View source]
def build_api_request_for_post_promotion_codes_promotion_code(*, promotion_code : String | Nil = nil, active : Bool | Nil = nil, expand : Array(String) | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, restrictions : Stripe::RestrictionsParams | Nil = nil) : Crest::Request #

@return Crest::Request


[View source]
def client_side_validation?(*args, **options) #

[View source]
def client_side_validation?(*args, **options, &) #

[View source]
def debugging?(*args, **options) #

[View source]
def debugging?(*args, **options, &) #

[View source]
def get_promotion_codes(*, ending_before : String | Nil = nil, starting_after : String | Nil = nil, created : Stripe::GetAccountsCreatedParameter | Nil = nil, limit : Int64 | Nil = nil, active : Bool | Nil = nil, coupon : String | Nil = nil, customer : String | Nil = nil, code : String | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Stripe::PromotionCodesResourcePromotionCodeList #

Returns a list of your promotion codes.

@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 active [Bool?] Filter promotion codes by whether they are active. @optional @param coupon [String?] Only return promotion codes for this coupon. @optional @param customer [String?] Only return promotion codes that are restricted to this customer. @optional @param code [String?] Only return promotion codes that have this case-insensitive code. @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return [Stripe::PromotionCodesResourcePromotionCodeList]

[View source]
def get_promotion_codes(*, ending_before : String | Nil = nil, starting_after : String | Nil = nil, created : Stripe::GetAccountsCreatedParameter | Nil = nil, limit : Int64 | Nil = nil, active : Bool | Nil = nil, coupon : String | Nil = nil, customer : String | Nil = nil, code : String | Nil = nil, expand : Array(Array(String)) | Nil = nil, &block : Crest::Response -> ) : Nil #

<p>Returns a list of your promotion codes.</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 active [Bool?] Filter promotion codes by whether they are active. @optional @param coupon [String?] Only return promotion codes for this coupon. @optional @param customer [String?] Only return promotion codes that are restricted to this customer. @optional @param code [String?] Only return promotion codes that have this case-insensitive code. @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return nil


[View source]
def get_promotion_codes_promotion_code(*, promotion_code : String | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Stripe::PromotionCode #

Retrieves the promotion code with the given ID. In order to retrieve a promotion code by the customer-facing code use list with the desired code.

@required @param promotion_code [String?] @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return [Stripe::PromotionCode]

[View source]
def get_promotion_codes_promotion_code(*, promotion_code : String | Nil = nil, expand : Array(Array(String)) | Nil = nil, &block : Crest::Response -> ) : Nil #

<p>Retrieves the promotion code with the given ID. In order to retrieve a promotion code by the customer-facing <code>code</code> use <a href=&quot;/docs/api/promotion_codes/list&quot;>list</a> with the desired <code>code</code>.</p> @required @param promotion_code [String?] @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return nil


[View source]
def get_promotion_codes_promotion_code_with_http_info(*, promotion_code : String | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Tuple(Stripe::PromotionCode, Int32, Hash(String, Array(String) | String)) #

<p>Retrieves the promotion code with the given ID. In order to retrieve a promotion code by the customer-facing <code>code</code> use <a href=&quot;/docs/api/promotion_codes/list&quot;>list</a> with the desired <code>code</code>.</p> @required @param promotion_code [String?] @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return [Tuple(Stripe::PromotionCode, Integer, Hash)] Stripe::PromotionCode, response status code and response headers


[View source]
def get_promotion_codes_with_http_info(*, ending_before : String | Nil = nil, starting_after : String | Nil = nil, created : Stripe::GetAccountsCreatedParameter | Nil = nil, limit : Int64 | Nil = nil, active : Bool | Nil = nil, coupon : String | Nil = nil, customer : String | Nil = nil, code : String | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Tuple(Stripe::PromotionCodesResourcePromotionCodeList, Int32, Hash(String, Array(String) | String)) #

<p>Returns a list of your promotion codes.</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 active [Bool?] Filter promotion codes by whether they are active. @optional @param coupon [String?] Only return promotion codes for this coupon. @optional @param customer [String?] Only return promotion codes that are restricted to this customer. @optional @param code [String?] Only return promotion codes that have this case-insensitive code. @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return [Tuple(Stripe::PromotionCodesResourcePromotionCodeList, Integer, Hash)] Stripe::PromotionCodesResourcePromotionCodeList, response status code and response headers


[View source]
def post_promotion_codes(*, coupon : String | Nil = nil, active : Bool | Nil = nil, code : String | Nil = nil, customer : String | Nil = nil, expand : Array(String) | Nil = nil, expires_at : Int64 | Nil = nil, max_redemptions : Int64 | Nil = nil, metadata : Hash(String, String) | Nil = nil, restrictions : Stripe::RestrictionsParams | Nil = nil) : Stripe::PromotionCode #

A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.

@required @param coupon [String?] The coupon for this promotion code. @optional @param active [Bool?] Whether the promotion code is currently active. @optional @param code [String?] The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. If left blank, we will generate one automatically. @optional @param customer [String?] The customer that this promotion code can be used by. If not set, the promotion code can be used by all customers. @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param expires_at [Int32?] The timestamp at which this promotion code will expire. If the coupon has specified a `redeems_by`, then this value cannot be after the coupon's `redeems_by`. @optional @param max_redemptions [Int32?] A positive integer specifying the number of times the promotion code can be redeemed. If the coupon has specified a `max_redemptions`, then this value cannot be greater than the coupon's `max_redemptions`. @optional @param metadata [Hash(String, String)?] @optional @param restrictions [Stripe::RestrictionsParams?] @return [Stripe::PromotionCode]

[View source]
def post_promotion_codes(*, coupon : String | Nil = nil, active : Bool | Nil = nil, code : String | Nil = nil, customer : String | Nil = nil, expand : Array(String) | Nil = nil, expires_at : Int64 | Nil = nil, max_redemptions : Int64 | Nil = nil, metadata : Hash(String, String) | Nil = nil, restrictions : Stripe::RestrictionsParams | Nil = nil, &block : Crest::Response -> ) : Nil #

<p>A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.</p> @required @param coupon [String?] The coupon for this promotion code. @optional @param active [Bool?] Whether the promotion code is currently active. @optional @param code [String?] The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. If left blank, we will generate one automatically. @optional @param customer [String?] The customer that this promotion code can be used by. If not set, the promotion code can be used by all customers. @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param expires_at [Int32?] The timestamp at which this promotion code will expire. If the coupon has specified a redeems_by, then this value cannot be after the coupon's redeems_by. @optional @param max_redemptions [Int32?] A positive integer specifying the number of times the promotion code can be redeemed. If the coupon has specified a max_redemptions, then this value cannot be greater than the coupon's max_redemptions. @optional @param metadata [Hash(String, String)?] @optional @param restrictions [Stripe::RestrictionsParams?] @return nil


[View source]
def post_promotion_codes_promotion_code(*, promotion_code : String | Nil = nil, active : Bool | Nil = nil, expand : Array(String) | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, restrictions : Stripe::RestrictionsParams | Nil = nil) : Stripe::PromotionCode #

Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.

@required @param promotion_code [String?] @optional @param active [Bool?] Whether the promotion code is currently active. A promotion code can only be reactivated when the coupon is still valid and the promotion code is otherwise redeemable. @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param metadata [Stripe::PostAccountsRequestMetadata?] @optional @param restrictions [Stripe::RestrictionsParams?] @return [Stripe::PromotionCode]

[View source]
def post_promotion_codes_promotion_code(*, promotion_code : String | Nil = nil, active : Bool | Nil = nil, expand : Array(String) | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, restrictions : Stripe::RestrictionsParams | Nil = nil, &block : Crest::Response -> ) : Nil #

<p>Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.</p> @required @param promotion_code [String?] @optional @param active [Bool?] Whether the promotion code is currently active. A promotion code can only be reactivated when the coupon is still valid and the promotion code is otherwise redeemable. @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param metadata [Stripe::PostAccountsRequestMetadata?] @optional @param restrictions [Stripe::RestrictionsParams?] @return nil


[View source]
def post_promotion_codes_promotion_code_with_http_info(*, promotion_code : String | Nil = nil, active : Bool | Nil = nil, expand : Array(String) | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, restrictions : Stripe::RestrictionsParams | Nil = nil) : Tuple(Stripe::PromotionCode, Int32, Hash(String, Array(String) | String)) #

<p>Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.</p> @required @param promotion_code [String?] @optional @param active [Bool?] Whether the promotion code is currently active. A promotion code can only be reactivated when the coupon is still valid and the promotion code is otherwise redeemable. @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param metadata [Stripe::PostAccountsRequestMetadata?] @optional @param restrictions [Stripe::RestrictionsParams?] @return [Tuple(Stripe::PromotionCode, Integer, Hash)] Stripe::PromotionCode, response status code and response headers


[View source]
def post_promotion_codes_with_http_info(*, coupon : String | Nil = nil, active : Bool | Nil = nil, code : String | Nil = nil, customer : String | Nil = nil, expand : Array(String) | Nil = nil, expires_at : Int64 | Nil = nil, max_redemptions : Int64 | Nil = nil, metadata : Hash(String, String) | Nil = nil, restrictions : Stripe::RestrictionsParams | Nil = nil) : Tuple(Stripe::PromotionCode, Int32, Hash(String, Array(String) | String)) #

<p>A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.</p> @required @param coupon [String?] The coupon for this promotion code. @optional @param active [Bool?] Whether the promotion code is currently active. @optional @param code [String?] The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. If left blank, we will generate one automatically. @optional @param customer [String?] The customer that this promotion code can be used by. If not set, the promotion code can be used by all customers. @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param expires_at [Int32?] The timestamp at which this promotion code will expire. If the coupon has specified a redeems_by, then this value cannot be after the coupon's redeems_by. @optional @param max_redemptions [Int32?] A positive integer specifying the number of times the promotion code can be redeemed. If the coupon has specified a max_redemptions, then this value cannot be greater than the coupon's max_redemptions. @optional @param metadata [Hash(String, String)?] @optional @param restrictions [Stripe::RestrictionsParams?] @return [Tuple(Stripe::PromotionCode, Integer, Hash)] Stripe::PromotionCode, response status code and response headers


[View source]