Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/user-matth/abacatepay-rails-sdk
AbacatePay Ruby on Rails SDK for you to start receiving payments in seconds
https://github.com/user-matth/abacatepay-rails-sdk
abacatepay abacatepay-sdk
Last synced: 21 days ago
JSON representation
AbacatePay Ruby on Rails SDK for you to start receiving payments in seconds
- Host: GitHub
- URL: https://github.com/user-matth/abacatepay-rails-sdk
- Owner: user-matth
- License: mit
- Created: 2024-12-11T04:09:15.000Z (30 days ago)
- Default Branch: main
- Last Pushed: 2024-12-11T15:54:46.000Z (29 days ago)
- Last Synced: 2024-12-11T16:43:43.437Z (29 days ago)
- Topics: abacatepay, abacatepay-sdk
- Language: Ruby
- Homepage: https://www.abacatepay.com/
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# AbacatePay SDK for Ruby on Rails
## 💻 Installation
Add this line to your application's Gemfile:
```ruby
gem 'abacatepay-rails'
```And then execute:
```bash
bundle install
```Or install it yourself as:
```bash
gem install abacatepay-rails
```## 🔧 Configuration
Configure your API token and environment in an initializer:
```ruby
# 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**
```ruby
billing_client = AbacatePay::Clients::BillingClient.new
```**List Billings**
Retrieve a list of all billings:
```ruby
billing_client.list
```**Create a Billing**
To create a billing, use the following code:
```ruby
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: '[email protected]',
tax_id: '13827826837'
)
)
)
)
```Alternatively, you can use a previously created customer by specifying their ID:
```ruby
AbacatePay::Resources::Customer.new(
id: 'cust_DEbpqcN...'
)
```### Customer
**Initialize the Customer Client**
```ruby
customer_client = AbacatePay::Clients::CustomerClient.new
```**List Customers**
Retrieve a list of all customers:
```ruby
customer_client.list
```**Create a Customer**
To create a customer, use the following code:
```ruby
customer_client.create(
AbacatePay::Resources::Customer.new(
metadata: AbacatePay::Resources::Customer::Metadata.new(
name: 'Abacate Lover',
cellphone: '01912341234',
email: '[email protected]',
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:```bash
git checkout -b feature/your-feature-name
```3. Make your changes and commit them:
```bash
git commit -m "Add your detailed commit message here"
```4. Push to your branch:
```bash
git push origin feature/your-feature-name
```5. 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! 🚀