RazorpayEx.Client (razorpay_ex v0.1.3)

Copy Markdown View Source

HTTP client for making requests to the Razorpay API.

This module handles all HTTP communication with Razorpay's servers, including authentication, request formatting, and response parsing.

Usage

# Using the default client
{:ok, response} = RazorpayEx.Client.request(:get, "/payments/pay_123")

# With custom options
{:ok, response} = RazorpayEx.Client.request(:post, "/orders", %{amount: 50000}, timeout: 60000)

Summary

Functions

Makes a raw HTTP request without automatic entity transformation.

Types

http_method()

@type http_method() :: :get | :post | :put | :patch | :delete

request_options()

@type request_options() :: keyword()

response()

@type response() :: {:ok, map() | list()} | {:error, RazorpayEx.Error.t()}

Functions

raw_request(method, path, data \\ %{}, opts \\ [])

@spec raw_request(http_method(), String.t(), map(), request_options()) ::
  {:ok, map()} | {:error, RazorpayEx.Error.t()}

Makes a raw HTTP request without automatic entity transformation.

This is useful when you need access to the raw HTTP response.

Examples

{:ok, response} =
  RazorpayEx.Client.raw_request(:get, "/payments/pay_123")

request(method, path, data \\ %{}, opts \\ [])

@spec request(http_method(), String.t(), map(), request_options()) :: response()