![]()
Bleumi Pay SDK for Ruby
The Bleumi Pay SDK is a one-stop shop to help you integrate Algorand, Ethereum, ERC-20 and xDai payments and/or payouts into your business or application. The SDK bundles Bleumi Pay API into one SDK to ease implementation and support.
bleumi-pay-sdk-ruby is a Ruby library that provides an interface between your Ruby application and Bleumi Pay API. This tutorial covers the basics, including examples, needed to use the SDK.
Getting Started
Pre-requisites
Development Environment
Ruby 1.9+
Obtain An API Key
Bleumi Pay SDK uses API keys to authenticate requests. You can obtain an API key through the Bleumi Pay Dashboard.
Install Package
To install,
gem install bleumi_pay_sdk_ruby
Install from Git
Add the following in the Gemfile:
gem 'bleumi_pay_sdk_ruby', :git => 'https://github.com/bleumi/bleumi_pay_sdk_ruby.git'
Run Sample Code
The following code generates a payment request to accept payment from the buyer:
# load the gem
require 'bleumi_pay_sdk_ruby'
# setup authorization
BleumiPay.configure do |config|
# Configure API key authorization: ApiKeyAuth
config.api_key['x-api-key'] = '<YOUR_API_KEY>'
end
api_instance = BleumiPay::PayoutsApi.new
create_payment_request = BleumiPay::CreatePaymentRequest.new # CreatePaymentRequest |
opts = {
chain: BleumiPay::Chain::GOERLI # Chain | Network in which payment is to be created. Please refer documentation for Supported Networks
}
begin
create_payment_request.id = '<ID>'
create_payment_request.buyer_address = '<BUYER_ADDR>' # Replace <BUYER_ADDR> with the Buyer's Network Address
create_payment_request.transfer_address = '<MERCHANT_ADDR>' # Replace <MERCHANT_ADDR> with the Merchant's Network Address
#Create a payout.
result = api_instance.create_payment(create_payment_request, opts)
p result
rescue BleumiPay::ApiError => e
puts "Exception when calling PayoutsApi->create_payment: #{e}"
end
More examples can be found under each method in SDK Classes section.
SDK Classes
| Class | Method | HTTP request | Description |
|---|---|---|---|
| BleumiPay::PaymentsApi | create_payment | POST /v1/payment | Generate a unique wallet address in the specified network to accept payment |
| BleumiPay::PaymentsApi | get_payment | GET /v1/payment/id | Retrieve the wallet addresses & token balances for a given payment |
| BleumiPay::PaymentsApi | list_payments | GET /v1/payment | Retrieve all payments created. |
| BleumiPay::PaymentsApi | settle_payment | POST /v1/payment/id/settle | Settle a specific amount of a token for a given payment to the transferAddress and remaining balance (if any) will be refunded to the buyerAddress |
| BleumiPay::PaymentsApi | refund_payment | POST /v1/payment/id/refund | Refund the balance of a token for a given payment to the buyerAddress |
| BleumiPay::PaymentsApi | get_payment_operation | GET /v1/payment/id/operation/txid | Retrieve a payment operation for a specific payment. |
| BleumiPay::PaymentsApi | list_payment_operations | GET /v1/payment/id/operation | Retrieve all payment operations for a specific payment. |
| BleumiPay::HostedCheckoutsApi | create_checkout_url | POST /v1/payment/hc | Generate a unique checkout URL to accept payment. |
| BleumiPay::HostedCheckoutsApi | list_tokens | GET /v1/payment/hc/tokens | Retrieve all tokens configured for the Hosted Checkout in your account in the Bleumi Pay Dashboard. |
| BleumiPay::HostedCheckoutsApi | validate_checkout_payment | POST /v1/payment/hc/validate | Validate the GET parameters passed by Hosted Checkout in successUrl upon successfully completing payment. |
| BleumiPay::PayoutsApi | create_payout | POST /v1/payout | Create a payout. |
| BleumiPay::PayoutsApi | list_payouts | GET /v1/payout | Returns a list of payouts |
Documentation for Models
- BleumiPay::AlgorandBalance
- BleumiPay::AlgorandWalletAddress
- BleumiPay::AlgorandWalletInputs
- BleumiPay::BadRequest
- BleumiPay::Chain
- BleumiPay::CheckoutToken
- BleumiPay::CreateCheckoutUrlRequest
- BleumiPay::CreateCheckoutUrlResponse
- BleumiPay::CreatePaymentRequest
- BleumiPay::CreatePaymentResponse
- BleumiPay::CreatePayoutRequest
- BleumiPay::CreatePayoutResponse
- BleumiPay::EthereumBalance
- BleumiPay::EthereumWalletAddress
- BleumiPay::EthereumWalletInputs
- BleumiPay::PaginatedPaymentOperations
- BleumiPay::PaginatedPayments
- BleumiPay::PaginatedPayoutItems
- BleumiPay::Payment
- BleumiPay::PaymentAddresses
- BleumiPay::PaymentBalances
- BleumiPay::PaymentOperation
- BleumiPay::PaymentOperationInputs
- BleumiPay::PaymentOperationResponse
- BleumiPay::PaymentRefundRequest
- BleumiPay::PaymentSettleRequest
- BleumiPay::Payout
- BleumiPay::PayoutItem
- BleumiPay::PayoutItemInputs
- BleumiPay::ValidateCheckoutRequest
- BleumiPay::ValidateCheckoutResponse
- BleumiPay::WalletBalance
Limitations
License
Copyright 2019 Bleumi, Inc.
Code licensed under the MIT License.