Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Version 1.4.10 - 2026-07-29
* feat: expose structured API error data in `RazorpayException`
* `ApiClient` now parses the API error body and attaches it to the exception, so callers no longer need to parse the response themselves
* New getters on `RazorpayException`: `getCode()`, `getDescription()`, `getField()`, `getReason()`, `getSource()`, `getStep()`, `getMetadata()`, and `getErrorResponse()` for the full error JSON
* `getStatusCode()` returns the HTTP status code from the failed response
* Backwards compatible: existing constructors and `getMessage()` behavior are unchanged

## Version 1.4.9 - 2026-06-09
* fix: use random nonce per call in AES-GCM onboarding signature

Expand Down
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>com.razorpay</groupId>
<artifactId>razorpay-java</artifactId>
<version>1.4.9</version>
<version>1.4.10</version>
</dependency>
```

Expand Down Expand Up @@ -64,6 +64,26 @@ Map<String, String> headers = new HashMap<String, String>();
razorpayClient.addHeaders(headers);
```

## Error Handling

SDK calls throw `RazorpayException` on API errors. In addition to the message, you can access structured error data returned by the API:

```java
try {
Order order = razorpayClient.orders.create(orderRequest);
} catch (RazorpayException e) {
int httpStatus = e.getStatusCode(); // HTTP status code (e.g. 400)
String code = e.getCode(); // e.g. "BAD_REQUEST_ERROR"
String description = e.getDescription(); // human-readable message
String field = e.getField(); // offending field, if any
String reason = e.getReason();
String source = e.getSource();
String step = e.getStep();
JSONObject metadata = e.getMetadata();
JSONObject raw = e.getErrorResponse(); // full error JSON
}
```

## Supported Resources
- [Addon](documents/addon.md)

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.razorpay</groupId>
<artifactId>razorpay-java</artifactId>
<version>1.4.9</version>
<version>1.4.10</version>
<packaging>jar</packaging>

<name>razorpay-java</name>
Expand Down
Loading