Project

xendit

0.01
No release in over 3 years
Low commit activity in last 3 years
There's a lot of open issues
Xendit Ruby API client library
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 13.0
~> 3.6
~> 1.9

Runtime

~> 1.3
 Project Readme

Xendit API Ruby Library

This library is the abstraction of Xendit API for access from applications written with Ruby/Rails.

  • API Documentation
  • Requirements
  • Installation
  • Usage
    • Invoice Service

API Documentation

Please check Xendit API Reference.

Requirements

  • Ruby 2.5+.

Installation

Add this line to your application’s Gemfile:

gem 'xendit'

And then execute:

$ bundle

Access the library in Ruby/Rails project:

require 'xendit'

Usage

First, start by setting up with your account's secret key obtained from your Xendit Dashboard. Once done, you are ready to use all services provided in this library.

require 'xendit'

# Provide api key
Xendit.api_key = 'xnd_...'

Invoice Service

Refer to Xendit API Reference for more info about methods' parameters

Create an invoice

# setup invoice details
invoice_params = {
    external_id: 'demo_147580196270',
    payer_email: 'sample_email@xendit.co',
    description: 'Trip to Bali',
    amount: 10_000_000
}
# create an invoice
created_invoice = Xendit::Invoice.create invoice_params

Get an invoice

# get an invoice
invoice = Xendit::Invoice.get '5efda8a20425db620ec35f43'

Get all invoices

# setup filters
filter_params = {
    limit: 3
}
# get invoices
invoices = Xendit::Invoice.get_all filter_params

Expire an invoice

# expire an invoice
expired_invoice = Xendit::Invoice.expire '5efda8a20425db620ec35f43'