All URIs are relative to https://komoju.com/api/v1
| Method | HTTP request | Description |
|---|---|---|
| create_customer | POST /customers | Customer: Create |
| create_subscription | POST /subscriptions | Subscription: Create |
| delete_customer | DELETE /customers/{id} | Customer: Destroy |
| delete_subscription | DELETE /subscriptions/{id} | Subscription: Destroy |
| list_customers | GET /customers | Customer: List |
| list_subscriptions | GET /subscriptions | Subscription: List |
| show_customer | GET /customers/{id} | Customer: Show |
| show_subscription | GET /subscriptions/{id} | Subscription: Show |
| update_customer | PATCH /customers/{id} | Customer: Update |
- CreateCustomerRequest — used by
create_customer - CreateSubscriptionRequest — used by
create_subscription - UpdateCustomerRequest — used by
update_customer
create_customer(create_customer_request)
Customer: Create
Creates a new customer with the specified payment_details. Customer payment details are stored in a secure, PCI DSS-compliant way. Once you have a customer, you may specify the customer's id instead of payment_details when creating a payment.
require 'time'
require 'komoju-sdk'
# setup authorization
Komoju.configure do |config|
# Configure your KOMOJU API key
config.api_key = 'YOUR_API_KEY'
end
api_instance = Komoju::SubscriptionsApi.new
create_customer_request = Komoju::CreateCustomerRequest.new # CreateCustomerRequest |
begin
# Customer: Create
result = api_instance.create_customer(create_customer_request)
p result
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->create_customer: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> create_customer_with_http_info(create_customer_request)
begin
# Customer: Create
data, status_code, headers = api_instance.create_customer_with_http_info(create_customer_request)
p status_code # => 2xx
p headers # => { ... }
p data # => <Customer>
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->create_customer_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| create_customer_request | CreateCustomerRequest |
- Content-Type: application/json
- Accept: application/json
create_subscription(create_subscription_request)
Subscription: Create
Create a new subscription. A subscription represents a recurring payment. Recurring payments may be on a weekly, monthly, or yearly basis, specified by the period parameter. In order to create a subscription, a customer ID must be supplied. The customer object contains saved payment info, which is regularly charged by the subscription. A subscription can't be modified once it's created. To change a subscription, you must delete it and create a new one.
require 'time'
require 'komoju-sdk'
# setup authorization
Komoju.configure do |config|
# Configure your KOMOJU API key
config.api_key = 'YOUR_API_KEY'
end
api_instance = Komoju::SubscriptionsApi.new
create_subscription_request = Komoju::CreateSubscriptionRequest.new({customer: 'customer_example', amount: 37, currency: Komoju::Currency::JPY, period: Komoju::SubscriptionPeriod::WEEKLY}) # CreateSubscriptionRequest |
begin
# Subscription: Create
result = api_instance.create_subscription(create_subscription_request)
p result
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->create_subscription: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> create_subscription_with_http_info(create_subscription_request)
begin
# Subscription: Create
data, status_code, headers = api_instance.create_subscription_with_http_info(create_subscription_request)
p status_code # => 2xx
p headers # => { ... }
p data # => <Subscription>
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->create_subscription_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| create_subscription_request | CreateSubscriptionRequest |
- Content-Type: application/json
- Accept: application/json
delete_customer(id)
Customer: Destroy
Deletes the customer with the given id. This complete erases the stored payment details from our database.
require 'time'
require 'komoju-sdk'
# setup authorization
Komoju.configure do |config|
# Configure your KOMOJU API key
config.api_key = 'YOUR_API_KEY'
end
api_instance = Komoju::SubscriptionsApi.new
id = 'id_example' # String |
begin
# Customer: Destroy
result = api_instance.delete_customer(id)
p result
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->delete_customer: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> delete_customer_with_http_info(id)
begin
# Customer: Destroy
data, status_code, headers = api_instance.delete_customer_with_http_info(id)
p status_code # => 2xx
p headers # => { ... }
p data # => <Customer>
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->delete_customer_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| id | String |
- Content-Type: Not defined
- Accept: application/json
delete_subscription(id)
Subscription: Destroy
Delete a subscription. Once deleted, the subscription's regular payments will stop.
require 'time'
require 'komoju-sdk'
# setup authorization
Komoju.configure do |config|
# Configure your KOMOJU API key
config.api_key = 'YOUR_API_KEY'
end
api_instance = Komoju::SubscriptionsApi.new
id = 'id_example' # String |
begin
# Subscription: Destroy
result = api_instance.delete_subscription(id)
p result
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->delete_subscription: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> delete_subscription_with_http_info(id)
begin
# Subscription: Destroy
data, status_code, headers = api_instance.delete_subscription_with_http_info(id)
p status_code # => 2xx
p headers # => { ... }
p data # => <Subscription>
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->delete_subscription_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| id | String |
- Content-Type: Not defined
- Accept: application/json
list_customers(opts)
Customer: List
Retrieves a paginated list of all previously-registered customers.
require 'time'
require 'komoju-sdk'
# setup authorization
Komoju.configure do |config|
# Configure your KOMOJU API key
config.api_key = 'YOUR_API_KEY'
end
api_instance = Komoju::SubscriptionsApi.new
opts = {
start_time: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Query for records created after this time.
end_time: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Query for records created before this time.
per_page: 56, # Integer | How many objects per page.
page: 56, # Integer | Page number to query for.
expiration: 'expiration_example' # String | The expiration of the customer's credit card in MMYY format.
}
begin
# Customer: List
result = api_instance.list_customers(opts)
p result
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->list_customers: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> list_customers_with_http_info(opts)
begin
# Customer: List
data, status_code, headers = api_instance.list_customers_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <CustomerList>
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->list_customers_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| start_time | Time | Query for records created after this time. | [optional] |
| end_time | Time | Query for records created before this time. | [optional] |
| per_page | Integer | How many objects per page. | [optional] |
| page | Integer | Page number to query for. | [optional] |
| expiration | String | The expiration of the customer's credit card in MMYY format. | [optional] |
- Content-Type: Not defined
- Accept: application/json
list_subscriptions(opts)
Subscription: List
List existing subscriptions.
require 'time'
require 'komoju-sdk'
# setup authorization
Komoju.configure do |config|
# Configure your KOMOJU API key
config.api_key = 'YOUR_API_KEY'
end
api_instance = Komoju::SubscriptionsApi.new
opts = {
start_time: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Query for records created after this time.
end_time: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Query for records created before this time.
per_page: 56, # Integer | How many objects per page.
page: 56 # Integer | Page number to query for.
}
begin
# Subscription: List
result = api_instance.list_subscriptions(opts)
p result
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->list_subscriptions: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> list_subscriptions_with_http_info(opts)
begin
# Subscription: List
data, status_code, headers = api_instance.list_subscriptions_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <SubscriptionList>
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->list_subscriptions_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| start_time | Time | Query for records created after this time. | [optional] |
| end_time | Time | Query for records created before this time. | [optional] |
| per_page | Integer | How many objects per page. | [optional] |
| page | Integer | Page number to query for. | [optional] |
- Content-Type: Not defined
- Accept: application/json
show_customer(id)
Customer: Show
Retrieves customer personal information.
require 'time'
require 'komoju-sdk'
# setup authorization
Komoju.configure do |config|
# Configure your KOMOJU API key
config.api_key = 'YOUR_API_KEY'
end
api_instance = Komoju::SubscriptionsApi.new
id = 'id_example' # String |
begin
# Customer: Show
result = api_instance.show_customer(id)
p result
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->show_customer: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> show_customer_with_http_info(id)
begin
# Customer: Show
data, status_code, headers = api_instance.show_customer_with_http_info(id)
p status_code # => 2xx
p headers # => { ... }
p data # => <Customer>
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->show_customer_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| id | String |
- Content-Type: Not defined
- Accept: application/json
show_subscription(id)
Subscription: Show
Show an existing subscription, including its customer and scrubbed payment details.
require 'time'
require 'komoju-sdk'
# setup authorization
Komoju.configure do |config|
# Configure your KOMOJU API key
config.api_key = 'YOUR_API_KEY'
end
api_instance = Komoju::SubscriptionsApi.new
id = 'id_example' # String |
begin
# Subscription: Show
result = api_instance.show_subscription(id)
p result
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->show_subscription: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> show_subscription_with_http_info(id)
begin
# Subscription: Show
data, status_code, headers = api_instance.show_subscription_with_http_info(id)
p status_code # => 2xx
p headers # => { ... }
p data # => <Subscription>
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->show_subscription_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| id | String |
- Content-Type: Not defined
- Accept: application/json
update_customer(id, update_customer_request)
Customer: Update
Updates the customer with the given id. A new set of payment_details may be specified.
require 'time'
require 'komoju-sdk'
# setup authorization
Komoju.configure do |config|
# Configure your KOMOJU API key
config.api_key = 'YOUR_API_KEY'
end
api_instance = Komoju::SubscriptionsApi.new
id = 'id_example' # String |
update_customer_request = Komoju::UpdateCustomerRequest.new # UpdateCustomerRequest |
begin
# Customer: Update
result = api_instance.update_customer(id, update_customer_request)
p result
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->update_customer: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> update_customer_with_http_info(id, update_customer_request)
begin
# Customer: Update
data, status_code, headers = api_instance.update_customer_with_http_info(id, update_customer_request)
p status_code # => 2xx
p headers # => { ... }
p data # => <Customer>
rescue Komoju::ApiError => e
puts "Error when calling SubscriptionsApi->update_customer_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| id | String | ||
| update_customer_request | UpdateCustomerRequest |
- Content-Type: application/json
- Accept: application/json