Class: Stripe::MarginService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::MarginService
- Defined in:
- lib/stripe/services/margin_service.rb
Defined Under Namespace
Classes: CreateParams, ListParams, RetrieveParams, UpdateParams
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Object
Create a margin object to be used with invoices, invoice items, and invoice line items for a customer to represent a partner discount.
-
#list(params = {}, opts = {}) ⇒ Object
Retrieve a list of your margins.
-
#retrieve(margin, params = {}, opts = {}) ⇒ Object
Retrieve a margin object with the given ID.
-
#update(margin, params = {}, opts = {}) ⇒ Object
Update the specified margin object.
Methods inherited from StripeService
#initialize, #request, #request_stream
Constructor Details
This class inherits a constructor from Stripe::StripeService
Instance Method Details
#create(params = {}, opts = {}) ⇒ Object
Create a margin object to be used with invoices, invoice items, and invoice line items for a customer to represent a partner discount. A margin has a percent_off which is the percent that will be taken off the subtotal after all items and other discounts and promotions) of any invoices for a customer. Calculation of prorations do not include any partner margins applied on the original invoice item.
76 77 78 79 80 81 82 83 84 |
# File 'lib/stripe/services/margin_service.rb', line 76 def create(params = {}, opts = {}) request( method: :post, path: "/v1/billing/margins", params: params, opts: opts, base_address: :api ) end |
#list(params = {}, opts = {}) ⇒ Object
Retrieve a list of your margins.
87 88 89 90 91 92 93 94 95 |
# File 'lib/stripe/services/margin_service.rb', line 87 def list(params = {}, opts = {}) request( method: :get, path: "/v1/billing/margins", params: params, opts: opts, base_address: :api ) end |
#retrieve(margin, params = {}, opts = {}) ⇒ Object
Retrieve a margin object with the given ID.
98 99 100 101 102 103 104 105 106 |
# File 'lib/stripe/services/margin_service.rb', line 98 def retrieve(margin, params = {}, opts = {}) request( method: :get, path: format("/v1/billing/margins/%<margin>s", { margin: CGI.escape(margin) }), params: params, opts: opts, base_address: :api ) end |
#update(margin, params = {}, opts = {}) ⇒ Object
Update the specified margin object. Certain fields of the margin object are not editable.
109 110 111 112 113 114 115 116 117 |
# File 'lib/stripe/services/margin_service.rb', line 109 def update(margin, params = {}, opts = {}) request( method: :post, path: format("/v1/billing/margins/%<margin>s", { margin: CGI.escape(margin) }), params: params, opts: opts, base_address: :api ) end |