0.0
The project is in a healthy, maintained state
The easiest way to integrate your Ruby on Rails SDK base code to AbacatePay Gateway with support to coroutines.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 2.9
~> 7.0, >= 7.0.0
 Project Readme

AbacatePay SDK for Ruby on Rails

💻 Installation

Add this line to your application's Gemfile:

gem 'abacatepay-ruby'

And then execute:

bundle install

Or install it yourself as:

gem install abacatepay-ruby

🔧 Configuration

Configure your API token and environment in an initializer:

# config/initializers/abacatepay.rb
AbacatePay.configure do |config|
  config.api_token = ENV['ABACATEPAY_TOKEN']
  config.environment = :sandbox # or :production
end

🌟 Resources

Billing

Initialize the Billing Client

billing_client = AbacatePay::Clients::BillingClient.new

List Billings

Retrieve a list of all billings:

billing_client.list

Create a Billing

To create a billing, use the following code:

billing_client.create(
  AbacatePay::Resources::Billing.new(
    frequency: AbacatePay::Enums::Billing::Frequencies::ONE_TIME,
    methods: [AbacatePay::Enums::Billing::Methods::PIX],
    products: [
      AbacatePay::Resources::Billing::Product.new(
        external_id: 'abc_123',
        name: 'Product A',
        description: 'Description of product A',
        quantity: 1,
        price: 100 # Price in cents
      )
    ],
    metadata: AbacatePay::Resources::Billing::Metadata.new(
      return_url: 'https://www.abacatepay.com',
      completion_url: 'https://www.abacatepay.com'
    ),
    customer: AbacatePay::Resources::Customer.new(
      metadata: AbacatePay::Resources::Customer::Metadata.new(
        name: 'Abacate Lover',
        cellphone: '01912341234',
        email: 'lover@abacate.com',
        tax_id: '13827826837'
      )
    )
  )
)

Alternatively, you can use a previously created customer by specifying their ID:

AbacatePay::Resources::Customer.new(
  id: 'cust_DEbpqcN...'
)

Customer

Initialize the Customer Client

customer_client = AbacatePay::Clients::CustomerClient.new

List Customers

Retrieve a list of all customers:

customer_client.list

Create a Customer

To create a customer, use the following code:

customer_client.create(
  AbacatePay::Resources::Customer.new(
    metadata: AbacatePay::Resources::Customer::Metadata.new(
      name: 'Abacate Lover',
      cellphone: '01912341234',
      email: 'lover@abacate.com',
      tax_id: '13827826837'
    )
  )
)

📚 Documentation

For detailed information about the API and SDK, refer to the official documentation: https://abacatepay.readme.io/reference

🤝 Contribution

Contributions are welcome! If you wish to contribute:

  1. Fork the repository
  2. Create a new branch for your feature or fix:
git checkout -b feature/your-feature-name
  1. Make your changes and commit them:
git commit -m "Add your detailed commit message here"
  1. Push to your branch:
git push origin feature/your-feature-name
  1. Open a pull request with a clear description of your changes

Please ensure your code:

  • Includes proper documentation
  • Follows Ruby style guidelines
  • Includes appropriate tests
  • Passes all existing tests (bundle exec rspec)
  • Passes code style checks (bundle exec rubocop)

Happy coding! 🚀