A zero-dependency Ruby client for U.CASH Pay: create crypto + card checkouts and verify settlement webhooks. Non-custodial. Works in any Ruby app; idiomatic in Rails.
# Gemfile
gem 'ucashpay'bundle installclient = UcashPay::Client.new(ENV['UCASH_CLOUD_TOKEN'])
r = client.create_checkout(
amount: '10.00',
currency: 'USD',
external_reference: order.id, # idempotent; returned in the webhook
title: "Order ##{order.id}",
redirect_url: order_url(order),
)
redirect_to r[:payment_url] if r[:ok] # send the buyer to hosted checkout# config/routes.rb
post '/ucashpay/webhook', to: 'ucash_pay#webhook'# app/controllers/ucash_pay_controller.rb
class UcashPayController < ApplicationController
skip_before_action :verify_authenticity_token # verified by HMAC instead
def webhook
client = UcashPay::Client.new(ENV['UCASH_CLOUD_TOKEN'])
result = client.verify_webhook(
request.raw_post,
request.headers['X-Webhook-Signature'],
ENV['UCASH_WEBHOOK_SECRET'],
)
return render json: { error: result[:error] }, status: :unauthorized unless result[:verified]
tx = result[:transaction]
order = Order.find(tx['transaction']['external_reference'])
order.mark_paid!
render json: { ok: true }
end
endSet the webhook URL in pay.u.cash to https://your-app.com/ucashpay/webhook, save, then Test Webhook.
- Sign up at pay.u.cash with email + password, then click the verification link in the email.
- Set your receive addresses under Settings → Addresses (a wallet per coin, or ENS/Unstoppable/FIO names). Crypto settles here.
- Create a store at Account → Stores → + Add Store.
- Copy the Store Cloud Token + Store Webhook Secret into your env. Use the store-level token, not the account-wide one.
- Set the webhook URL as above, then Test Webhook.
MIT.