Search charges
Search and filter charges to find transactions by description, metadata, card details, customer information, and more. The Search API provides powerful full-text search capabilities across all charges.
API Credentials
Request Parametersโ
Required - 1 fieldRequired Parameters
`scope`STRING(required)
Search scope. Must be set to "charge" to search charges.
Recommended - 2 fieldsRecommended Parameters
`query`STRING(optional)
Search query string. Searches across charge description, metadata, card details (last 4 digits, brand, bank), and customer information. Supports multiple words (AND logic) and partial matches.
`filters`OBJECT(optional)
Filter criteria to narrow search results. Common filters include status, currency, amount, capture, paid, and created date ranges.
Additional - 3 fieldsAdditional Parameters
Responsesโ
200
Successful searchSearch completed successfully. Returns a search result object with matching charges in the data array.
Response includes:
data- Array of charge objects matching the search criteriatotal- Total number of results matching the searchtotal_pages- Number of pages availablepage- Current page numberper_page- Number of results per pageorder- Sort order applied (chronological or reverse_chronological)
400
Bad requestRequest validation failed. Check the error message for details.
Common causes:
- Missing required
scopeparameter - Invalid page number (below 1)
- Invalid per_page value (above 100 or below 1)
- Malformed filters object
401
UnauthorizedAuthentication failed. Invalid or missing API key.
Common causes:
- Missing Authorization header
- Invalid secret key
- Using public key instead of secret key
- Incorrect HTTP Basic Auth format
422
Invalid scopeInvalid search scope provided.
Common causes:
- Scope parameter is not "charge"
- Invalid scope value
Code samplesโ
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/search \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d "scope=charge" \
-d "query=order 1234" \
-d "filters[status]=successful" \
-d "filters[currency]=thb"
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
results = Omise::Search.execute({
scope: 'charge',
query: 'order 1234',
filters: {
status: 'successful',
currency: 'thb'
}
})
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
results = omise.Search.execute(
scope='charge',
query='order 1234',
filters={
'status': 'successful',
'currency': 'thb'
}
)
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const results = await omise.search.execute({
scope: 'charge',
query: 'order 1234',
filters: {
status: 'successful',
currency: 'thb'
}
});
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$results = OmiseSearch::execute([
'scope' => 'charge',
'query' => 'order 1234',
'filters' => [
'status' => 'successful',
'currency' => 'thb'
]
]);
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Map<String, Object> filters = new HashMap<>();
filters.put("status", "successful");
filters.put("currency", "thb");
SearchResult<Charge> results = client.search()
.scope("charge")
.query("order 1234")
.filters(filters)
.send();
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var results = await client.Search.Execute(new SearchRequest
{
Scope = "charge",
Query = "order 1234",
Filters = new Dictionary<string, object>
{
{ "status", "successful" },
{ "currency", "thb" }
}
});
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
results, _ := client.Search(&operations.SearchCharges{
Scope: "charge",
Query: "order 1234",
Filters: map[string]interface{}{
"status": "successful",
"currency": "thb",
},
})
Error and result codesโ
Common Error Codesโ
| Code | Description | Resolution |
|---|---|---|
bad_request | Missing or invalid parameters | Check that scope is provided and parameters are valid |
authentication_failure | Invalid API key | Verify your secret key is correct |
invalid_scope | Invalid search scope | Ensure scope is set to "charge" |
Search Filter Optionsโ
| Filter | Type | Description |
|---|---|---|
status | string | Charge status (pending, successful, failed, expired, reversed) |
currency | string | Currency code (thb, jpy, sgd, myr, usd, etc.) |
amount | integer | Exact amount in smallest currency unit |
capture | boolean | Whether charge is captured (true/false) |
paid | boolean | Whether charge is paid (true/false) |
created | object | Date range filter (e.g., {gte: '2025-01-01', lte: '2025-01-31'}) |
Try it outโ
Required - 1 fields
Recommended - 2 fields
Additional - 3 fields