Skip to main content

Creating a New Customer

require 'chargeover_ruby'

# Initialize the client
client = ChargeOver::Client.new("https://your-chargeover-url.com", "your_api_key", "your_api_secret")

# Define customer data
customer_data = {
'company' => "Sample Company",
'email' => "email@example.com",
'first_name' => "John",
'last_name' => "Doe",
'phone' => "123-456-7890"
}

# Create the customer
response = client.create(:customer, customer_data)

# Check if successful
if response['status'] == 'success'
puts "Customer created successfully: #{response['response']}"
else
puts "Error: #{response['error']}"
end