Ruby
Official server-side SDK (wajub) for Ruby 3.1+ — payments, payouts, webhooks, and the full merchant API.
Ruby is Wajub's official server-side SDK for Rails, Sinatra, and any Ruby 3.1+ backend. It is published as the wajub gem on RubyGems.
Use it with your API key (pk_… / sk_… / rk_…, including test variants). Pair it with @wajub/js in the browser.
Browser vs server
@wajub/js runs in the browser with publishable keys.
wajub runs on the server — pass any merchant API key
(pk., sk., rk.) and use webhook verification for inbound
events. Never expose sk. keys to the client.
Install
gem install wajubOr in your Gemfile:
gem 'wajub', '~> 1.1'Requires Ruby 3.1+. Standard library only (net/http, openssl, json).
Quick start
require 'wajub'
client = Wajub::Client.new(api_key: ENV['WAJUB_SECRET_KEY'])
payment = client.payments.create(
'amount' => 15_000,
'currency' => 'XAF',
'email' => 'buyer@example.com',
'callback' => 'https://shop.example.com/order/complete'
)
puts payment['authorization_url']global is a Ruby keyword
Use client.global_ (with trailing underscore) to access ping, channels, countries,
and currencies.
Configuration
| Option | Description |
|---|---|
api_key | Merchant API key (pk.… / sk.… / rk.…, test or live) |
webhook_secret | Signing secret (whsec_…) for webhooks.construct_event() |
idempotency_key_prefix | Prefix for auto-generated Idempotency-Key headers |
The API base URL is fixed at https://api.wajub.com. Test mode is selected by your API key (sk_test.…), not by the URL.
Resources
| Property | Methods |
|---|---|
client.global_ | ping, channels, countries, currencies |
client.payments | create, initialize_payment, retrieve, list, cancel, process, process_split, list_refunds |
client.customers | CRUD + block, unblock, activate, deactivate, tax IDs |
client.refunds | CRUD + list |
client.transfers | CRUD + list |
client.beneficiaries | CRUD + list |
client.links | CRUD + list |
client.invoices | CRUD + send, mark_paid, cancel |
client.accounts | CRUD + regenerate_token |
client.webhook_endpoints | CRUD + rotate_secret |
client.balance | retrieve |
client.events | list, retrieve, resend |
client.disputes | list, retrieve, submit_evidence, accept, close, send_message |
client.identity | resolve, validate |
client.tax | settings, rates, calculate, reports, codes, registrations |
client.shield | settings, stats, blocklist |
client.listen | config, auth |
client.webhooks | construct_event |
Webhooks (Rails / Sinatra)
event = client.webhooks.construct_event(
request.body.read,
request.env['HTTP_X_WAJUB_SIGNATURE'],
request.env['HTTP_X_WAJUB_TIMESTAMP']
)
# Handle payment.succeeded, transfer.succeeded, etc.Sync (Connect)
client.payments.create(params, Wajub::RequestOptions.new(sync: 'acct_sync_ref'))Was this page helpful?