The Bleumi Pay SDK helps you integrate Algo, Algorand Standard Asset, Ethereum, ERC-20, RSK, RSK ERC-20 & xDai payments and 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.
Ruby 1.9+
Bleumi Pay SDK uses API keys to authenticate requests. You can obtain an API key through the Bleumi Pay Dashboard.
To install,
gem install bleumi_pay_sdk_ruby
Add the following in the Gemfile:
gem 'bleumi_pay_sdk_ruby', :git => 'https://github.com/bleumi/bleumi_pay_sdk_ruby.git'
The following code generates an unique checkout URL 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::HostedCheckoutsApi.new
create_checkout_url_request = BleumiPay::CreateCheckoutUrlRequest.new # CreateCheckoutUrlRequest | Specify checkout URL creation parameters.
begin
create_checkout_url_request = BleumiPay::CreateCheckoutUrlRequest.new # CreatePayoutRequest | Specify payout creation parameters.
create_checkout_url_request.id = '<ID>' # Eg. 1
create_checkout_url_request.currency = "<CURRENCY>" # Eg. USD
create_checkout_url_request.amount = "<AMOUNT>" # Eg. 10
create_checkout_url_request.success_url = "<SUCCESS_URL>" # Eg. https://demo.store/api/completeOrder
create_checkout_url_request.cancel_url = "<CANCEL_URL>" # Eg. https://demo.store/api/cancelOrder
create_checkout_url_request.token = '<TOKEN>' # Replace <TOKEN> by anyone of the following values: 'ETH' or 'XDAI' or 'XDAIT' or ECR-20 Contract Address or 'RBTC' or RSK ECR-20 Contract Address or 'Asset ID' of Algorand Standard Asset. | Optional
create_checkout_url_request.chain = BleumiPay::Chain::GOERLI # Replace with any Chain as required
#Generate a unique checkout URL to accept payment.
result = api_instance.create_checkout_url(create_checkout_url_request)
p result
rescue BleumiPay::ApiError => e
puts "Exception when calling HostedCheckoutsApi->create_checkout_url: #{e}"
end
More examples can be found under each method in SDK Classes section.
Class | Method | HTTP request | Description |
---|---|---|---|
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::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::PayoutsApi | create_payout | POST /v1/payout | Create a payout. |
BleumiPay::PayoutsApi | list_payouts | GET /v1/payout | Returns a list of payouts |
- BleumiPay::AlgorandAddress
- BleumiPay::AlgorandBalance
- BleumiPay::AlgorandWalletAddress
- BleumiPay::AlgorandWalletInputs
- BleumiPay::BadRequest
- BleumiPay::Chain
- BleumiPay::CheckoutToken
- BleumiPay::CreateCheckoutUrlRequest
- BleumiPay::CreateCheckoutUrlResponse
- BleumiPay::CreatePayoutRequest
- BleumiPay::CreatePayoutResponse
- BleumiPay::EthereumAddress
- 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::RskAddress
- BleumiPay::RskBalance
- BleumiPay::ValidateCheckoutRequest
- BleumiPay::ValidateCheckoutResponse
- BleumiPay::WalletBalance
Copyright 2019 Bleumi, Inc.
Code licensed under the MIT License.