Creating an Invoice
require 'chargeover_ruby'
# Initialize the client
client = ChargeOver::Client.new("https://your-chargeover-url.com", "your_api_key", "your_api_secret")
# Define invoice data
invoice_data = {
'customer_id' => "12345", # Replace with the actual customer ID
'line_items' => [
{
'description' => "Service Charge",
'amount' => 100.00,
'quantity' => 1
}
],
'due_date' => "2024-12-31"
}
# Create the invoice
response = client.create(:invoice, invoice_data)
# Check if successful
if response['status'] == 'success'
puts "Invoice created successfully: #{response['response']}"
else
puts "Error: #{response['error']}"
end