> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fedapay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ruby SDK

FedaPay provides an integrated **Ruby library** to interact with its API, especially useful for projects built with Ruby on Rails.

### Installation

***Add the following gem to your Gemfile***

```ruby theme={null}
$ gem install fedapay-ruby
```

### Use Case

#### example for creating a customer

```ruby theme={null}
require 'fedapay';
# configure FedaPay library
FedaPay.api_key = '' # Your secret api key
FedaPay.environment = '' # sandbox or live
phone = {
  country: 'bj',
  number: '66000001'
};
customer = FedaPay::Customer.create(
  firstname: 'firstname',
  lastname: 'lastname',
  email: 'email@test.com',
  phone_number: phone
);
```

#### example for Creating a Transaction

```ruby theme={null}
require 'fedapay'

FedaPay.api_key = 'YOUR_SECRET_API_KEY'
FedaPay.environment = 'sandbox'

transaction = FedaPay::Transaction.create(
  amount: 1000,
  currency: { iso: 'XOF' },
  customer: { id: 1 },
  description: 'Payment for order #1234',
  callback_url: 'https://example.com/callback',
  mode: 'mtn_open'
)

puts "Transaction successfully created : #{transaction.inspect}"
```

<Note>
  To integrate FedaPay with Ruby, refer to the resources below:

  Official GitHub repository : [fedapay-ruby](https://github.com/FedaPay/fedapay-ruby)

  API Reference : [api-reference](https://docs.fedapay.com/api-reference/introduction)

  Demo app source code : [ruby-sample](https://github.com/fedapay-samples/sample-ruby)

  Live Demo : [rubysample](https://rubysample.fedapay.com)

  These resources provide real-world use cases to help you smoothly integrate FedaPay into your Ruby projects.
</Note>
