Skip to main content

API Methods

The Payrails SDK provides REST API methods through the api() function for making calls to payrails backend directly from the client.

api

Returns: Promise<Operations[TOperation]['responseType']>

Available Operations

Delete Payment Instrument

Response: DeleteInstrumentResponse

Update Payment Instrument

Request Body Fields: Response Fields:

Query Methods

The query system allows you to retrieve configuration data and SDK state information without making external API calls.

query

Returns: ConfigurationQueryTypes[K]['returnType'] | null

Available Query Keys


Query Examples

Basic Configuration Queries

Payment Method Queries


Error Handling

All API methods may throw PayrailsError exceptions. It’s recommended to wrap API calls in try-catch blocks:
Query methods return null instead of throwing errors when data is not found:

Examples

Complete Instrument Management Example


Integration Notes

Best Practices

Last modified on August 17, 2026