Documentation
¶
Overview ¶
Package setu is the root of the Setu Go SDK.
Products covered ¶
- UPI Setu (UMAP): Flash/DQR/SQR payment links, Collect (VPA-push), TPV (Third Party Validation), Refunds, Disputes, UPI Mandates (Recurring, One-time, Single Block Multi-Debit), Mandate operations (Update, Revoke, Pause, Unpause), Merchant onboarding for aggregators.
- BBPS BillCollect: biller-side bill-fetch/receipt APIs, settlement.
- BBPS BillPay: agent-side bill-fetch and bill-payment.
- WhatsApp Collect: send payment reminders via WhatsApp.
- Account Aggregator: full FIU consent + data-fetch flow, multi-consent, revoke, last fetch status, data session management.
- PAN Verification (NSDL).
- Bank Account Verification — penny drop, sync and async.
- GST / GSTIN Verification.
- DigiLocker — consent session + document fetch.
- Aadhaar eKYC.
- Name Match — optimistic and pessimistic scoring.
- Aadhaar eSign — create, get, download signed PDF.
Quick start ¶
client, err := setu.New(
setu.WithClientID("your-client-id"),
setu.WithClientSecret("your-client-secret"),
setu.WithEnvironment(setu.Sandbox),
)
Error handling ¶
All errors implement setuerrors.Error and are compatible with errors.As. Use setuerrors.IsNotFound, setuerrors.IsRateLimit, setuerrors.GetTraceID, etc.
Index ¶
- Constants
- type Client
- type DataClient
- type KYCClient
- type Option
- func WithClientID(id string) Option
- func WithClientSecret(secret string) Option
- func WithEnvironment(env types.Environment) Option
- func WithHTTPTransport(t http.RoundTripper) Option
- func WithMaxAttempts(n int) Option
- func WithProductInstanceID(id string) Option
- func WithRateLimit(rps float64, burst int) Option
- func WithRetryWait(base, max time.Duration) Option
- func WithTimeout(d time.Duration) Option
- func WithUserAgent(ua string) Option
- type PaymentsClient
Constants ¶
const ( Sandbox = types.Sandbox Production = types.Production )
Environment aliases — re-exported for convenience.
const SDKVersion = "1.0.2"
SDKVersion is the current semantic version of this SDK.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// Payments exposes all payments-product clients.
Payments *PaymentsClient
// Data exposes all data-product clients.
Data *DataClient
// contains filtered or unexported fields
}
Client is the root Setu SDK client. Construct with New. All sub-clients share the underlying transport, rate limiter, and token manager.
func New ¶
New constructs a *Client using the provided options.
Required: WithClientID, WithClientSecret.
client, err := setu.New(
setu.WithClientID("your-id"),
setu.WithClientSecret("your-secret"),
setu.WithEnvironment(setu.Production),
setu.WithProductInstanceID("your-pid"), // for KYC / AA
)
func (*Client) Environment ¶
func (c *Client) Environment() types.Environment
Environment returns the environment the client targets.
type DataClient ¶
type DataClient struct {
// AA is the Account Aggregator FIU client.
AA *aa.Client
// KYC groups all identity verification clients.
KYC *KYCClient
// ESign is the Aadhaar eSign client.
ESign *esign.Client
}
DataClient groups all data-product sub-clients.
type KYCClient ¶
type KYCClient struct {
PAN *pan.Client
BAV *bav.Client
GST *gst.Client
DigiLocker *digilocker.Client
EKYC *ekyc.Client
NameMatch *namematch.Client
}
KYCClient groups identity and verification sub-clients.
type Option ¶
type Option func(*config)
Option is a functional option for configuring a Client.
func WithClientID ¶
WithClientID sets the Setu API client ID. Required.
func WithClientSecret ¶
WithClientSecret sets the Setu API client secret. Required.
func WithEnvironment ¶
func WithEnvironment(env types.Environment) Option
WithEnvironment selects types.Sandbox or types.Production. Defaults to types.Sandbox.
func WithHTTPTransport ¶
func WithHTTPTransport(t http.RoundTripper) Option
WithHTTPTransport replaces the default HTTP transport. Useful for custom TLS, proxies, or test mocks.
func WithMaxAttempts ¶
WithMaxAttempts sets the total attempt count (1 = no retries). Default: 4.
func WithProductInstanceID ¶
WithProductInstanceID sets the x-product-instance-id header used by KYC and Account Aggregator APIs.
func WithRateLimit ¶
WithRateLimit configures the client-side token-bucket rate limiter. rps = sustained requests/second; burst = maximum burst capacity. Default: 100 RPS, burst 20.
func WithRetryWait ¶
WithRetryWait sets the base and maximum backoff duration. Default: 500ms / 10s.
func WithTimeout ¶
WithTimeout sets the per-request HTTP timeout. Default: 30s.
func WithUserAgent ¶
WithUserAgent overrides the SDK User-Agent header.
type PaymentsClient ¶
type PaymentsClient struct {
// UPI covers Flash/DQR/SQR, Collect, TPV, Mandates, Refunds, Disputes.
UPI *upi.Client
// BBPS covers BillCollect biller-side APIs.
BBPS *bbps.Client
// BillPay covers BBPS agent-side bill-payment APIs.
BillPay *billpay.Client
// WhatsApp covers WhatsApp Collect reminder APIs.
WhatsApp *whatsapp.Client
}
PaymentsClient groups all payments-product sub-clients.
Directories
¶
| Path | Synopsis |
|---|---|
|
data
|
|
|
aa
Package aa provides the Setu Account Aggregator FIU API client.
|
Package aa provides the Setu Account Aggregator FIU API client. |
|
esign
Package esign provides the Setu Aadhaar eSign API client.
|
Package esign provides the Setu Aadhaar eSign API client. |
|
kyc/bav
Package bav provides the Setu Bank Account Verification (BAV / penny-drop) client.
|
Package bav provides the Setu Bank Account Verification (BAV / penny-drop) client. |
|
kyc/digilocker
Package digilocker provides the Setu DigiLocker API client.
|
Package digilocker provides the Setu DigiLocker API client. |
|
kyc/ekyc
Package ekyc provides the Setu Aadhaar eKYC API client.
|
Package ekyc provides the Setu Aadhaar eKYC API client. |
|
kyc/gst
Package gst provides the Setu GSTIN Verification API client.
|
Package gst provides the Setu GSTIN Verification API client. |
|
kyc/namematch
Package namematch provides the Setu Name Match API client.
|
Package namematch provides the Setu Name Match API client. |
|
kyc/pan
Package pan provides the Setu PAN Verification API client.
|
Package pan provides the Setu PAN Verification API client. |
|
Package main demonstrates the complete Setu Go SDK.
|
Package main demonstrates the complete Setu Go SDK. |
|
internal
|
|
|
auth
Package auth manages Setu UPI/BBPS access-token lifecycle.
|
Package auth manages Setu UPI/BBPS access-token lifecycle. |
|
ratelimit
Package ratelimit provides a client-side token-bucket rate limiter backed by golang.org/x/time/rate.
|
Package ratelimit provides a client-side token-bucket rate limiter backed by golang.org/x/time/rate. |
|
retry
Package retry implements exponential backoff with full jitter.
|
Package retry implements exponential backoff with full jitter. |
|
transport
Package transport provides the shared HTTP client for all Setu SDK sub-clients.
|
Package transport provides the shared HTTP client for all Setu SDK sub-clients. |
|
payments
|
|
|
bbps
Package bbps provides the Setu BBPS BillCollect client.
|
Package bbps provides the Setu BBPS BillCollect client. |
|
billpay
Package billpay provides the Setu BBPS BillPay (agent) client.
|
Package billpay provides the Setu BBPS BillPay (agent) client. |
|
upi
Package upi provides the Setu UPI Setu (UMAP) API client.
|
Package upi provides the Setu UPI Setu (UMAP) API client. |
|
whatsapp
Package whatsapp provides the Setu WhatsApp Collect client.
|
Package whatsapp provides the Setu WhatsApp Collect client. |
|
pkg
|
|
|
setuerrors
Package setuerrors defines all structured error types for the Setu SDK.
|
Package setuerrors defines all structured error types for the Setu SDK. |
|
types
Package types defines shared domain types used across the Setu SDK.
|
Package types defines shared domain types used across the Setu SDK. |
|
Package webhook provides a unified http.Handler that dispatches all Setu webhook notifications (UPI Setu payments, mandates, refunds, disputes, Account Aggregator, and BBPS settlement) to typed callback functions.
|
Package webhook provides a unified http.Handler that dispatches all Setu webhook notifications (UPI Setu payments, mandates, refunds, disputes, Account Aggregator, and BBPS settlement) to typed callback functions. |