Class: Creem::Resources::Checkouts

Inherits:
Base
  • Object
show all
Defined in:
lib/creem/resources/checkouts.rb

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Creem::Resources::Base

Instance Method Details

#create(product_id:, success_url: nil, request_id: nil, units: nil, discount_code: nil, customer: nil, custom_fields: nil, metadata: nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/creem/resources/checkouts.rb', line 8

def create(product_id:, success_url: nil, request_id: nil, units: nil, discount_code: nil,
           customer: nil, custom_fields: nil, metadata: nil)
  body = { product_id: product_id }
  body[:success_url] = success_url if success_url
  body[:request_id] = request_id if request_id
  body[:units] = units if units
  body[:discount_code] = discount_code if discount_code
  body[:customer] = customer if customer
  body[:custom_fields] = custom_fields if custom_fields
  body[:metadata] =  if 
  post("/checkouts", body)
end