Skip to content

AbacatePay Ruby SDK for you to start receiving payments in seconds

License

Notifications You must be signed in to change notification settings

AbacatePay/abacatepay-ruby-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

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::Billings.new(
    frequency: AbacatePay::Enums::Billings::Frequencies::ONE_TIME,
    methods: [AbacatePay::Enums::Billings::Methods::PIX],
    products: [
      AbacatePay::Resources::Billings::Product.new(
        external_id: 'abc_123',
        name: 'Product A',
        description: 'Description of product A',
        quantity: 1,
        price: 100 # Price in cents
      )
    ],
    metadata: AbacatePay::Resources::Billings::Metadata.new(
      return_url: 'https://www.abacatepay.com',
      completion_url: 'https://www.abacatepay.com'
    ),
    customer: AbacatePay::Resources::Customers.new(
      metadata: AbacatePay::Resources::Customers::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::Customers.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::Customers.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! πŸš€

About

AbacatePay Ruby SDK for you to start receiving payments in seconds

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 3

  •  
  •  
  •