Razorpay Elixir SDK - Unofficial Elixir client for Razorpay API.
This library is modeled after the official Razorpay Ruby SDK (https://github.com/razorpay/razorpay-ruby) and provides a similar API experience for Elixir developers.
Setup
# Basic authentication (like Ruby's Razorpay.setup)
RazorpayEx.setup("your_key_id", "your_key_secret")
# OAuth authentication (like Ruby's Razorpay.setup_with_oauth)
RazorpayEx.setup_with_oauth("your_access_token")
# Set custom headers (like Ruby's Razorpay.headers=)
RazorpayEx.headers(%{"X-Custom-Header" => "value"})Usage
# Create an order (similar to Razorpay::Order.create)
{:ok, order} = RazorpayEx.Order.create(%{
amount: 50000,
currency: "INR",
receipt: "order_123"
})
# Fetch a payment (similar to Razorpay::Payment.fetch)
{:ok, payment} = RazorpayEx.Payment.fetch("pay_123456")Supported Resources
This SDK supports all resources from the official Ruby SDK:
- Account
- Customer
- Token
- Order
- Payment
- Refund
- Invoice
- Plan
- Item
- Subscription
- AddOn
- PaymentLink
- Card
- UPI
- QRCode
- Dispute
- Document
- ... and more
Summary
Functions
Set custom headers for all requests - equivalent to Ruby's Razorpay.headers=
Setup basic authentication - equivalent to Ruby's Razorpay.setup(key_id, key_secret)
Setup OAuth authentication - equivalent to Ruby's Razorpay.setup_with_oauth(access_token)
Test API connectivity - useful for debugging setup.
Verify webhook signature - equivalent to Ruby's webhook verification
Returns the library version.
Functions
@spec headers(map()) :: :ok
Set custom headers for all requests - equivalent to Ruby's Razorpay.headers=
Setup basic authentication - equivalent to Ruby's Razorpay.setup(key_id, key_secret)
@spec setup_with_oauth(String.t()) :: :ok
Setup OAuth authentication - equivalent to Ruby's Razorpay.setup_with_oauth(access_token)
@spec test_connection() :: {:ok, map()} | {:error, RazorpayEx.Error.t()}
Test API connectivity - useful for debugging setup.
Verify webhook signature - equivalent to Ruby's webhook verification
@spec version() :: String.t()
Returns the library version.