Skip to main content

Creating a Payment

To create a payment:

require 'chargeover_ruby'

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

# Define transaction data
transaction_data = {
'customer_id' => "12345", # Replace with actual customer ID
'amount' => 50.00,
'payment_method_id' => "12", # Replace with actual payment method ID
'description' => "Payment for services"
}

# Create the transaction
response = client.create(:transaction, transaction_data)

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