Spring Boot 3.2+ / 4.x · Java 17+ · MIT License · v0.4.0

NepalPay
Spring Boot Starter

The first production-grade Java library for Nepal payment gateways. Integrate Khalti, eSewa, ConnectIPS, and Fonepay in minutes — security baked in.

Spring Boot 3.2+ (Java 17+)
<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependency>
    <groupId>com.github.sujankim.nepal-pay-spring-boot-starter</groupId>
    <artifactId>nepal-pay-spring-boot-3-starter</artifactId>
    <version>v0.4.1</version>
</dependency>
Spring Boot 4.x (Java 21+)
<dependency>
    <groupId>com.github.sujankim.nepal-pay-spring-boot-starter</groupId>
    <artifactId>nepal-pay-spring-boot-4-starter</artifactId>
    <version>v0.4.1</version>
</dependency>
settings.gradle — add repository
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}
build.gradle — Spring Boot 3.2+
dependencies {
    implementation 'com.github.sujankim.nepal-pay-spring-boot-starter:nepal-pay-spring-boot-3-starter:v0.4.1'
}
build.gradle — Spring Boot 4.x
dependencies {
    implementation 'com.github.sujankim.nepal-pay-spring-boot-starter:nepal-pay-spring-boot-4-starter:v0.4.1'
}
settings.gradle.kts — add repository
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}
build.gradle.kts — Spring Boot 3.2+
dependencies {
    implementation("com.github.sujankim.nepal-pay-spring-boot-starter:nepal-pay-spring-boot-3-starter:v0.4.1")
}
build.gradle.kts — Spring Boot 4.x
dependencies {
    implementation("com.github.sujankim.nepal-pay-spring-boot-starter:nepal-pay-spring-boot-4-starter:v0.4.1")
}

The public API is identical in both starters. Only the internal Jackson version differs. · Full install guide →

Why NepalPay?

Stop writing 500 lines of payment boilerplate every project.

5-Minute Integration

Add dependency → configure keys → inject client. No @Bean, no config class, no boilerplate.

🔐

Secure by Default

Server-side verification, HMAC signature validation, RSA signing — all built in. Sandbox mode by default.

Java Native

Built for Java 17+ and Spring Boot. Type-safe records, auto-configuration, no Node.js bridge.

🧪

Fully Tested

MockWebServer HTTP tests, HMAC/RSA signature tests, auto-configuration wiring tests. 80+ tests total.

🔀

Boot 3 and 4

Separate modules for Spring Boot 3.2+ and 4.x. Identical public API — switch without code changes.

🌍

Open Source

MIT licensed. Built for Nepal's developer community. Contributions welcome.

Supported Gateways

All major Nepal digital payment gateways in one library.

This simple. This clean.

Three lines instead of 80.

❌ Without NepalPay
// 80+ lines for Khalti initiation alone
HttpClient client = HttpClient.newHttpClient();
String json = """
    {
      "return_url": "%s",
      "website_url": "%s",
      "amount": %d,
      "purchase_order_id": "%s",
      "purchase_order_name": "%s"
    }
    """.formatted(returnUrl, url, amount, orderId, name);

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://dev.khalti.com/..."))
    .header("Authorization", "Key " + secretKey)
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();
// parse response manually...
// repeat for eSewa with HMAC-SHA256...
// repeat again for your next project
✅ With NepalPay
// 3 lines. Type-safe. Tested. Secure.
var response = khaltiClient.initiatePayment(
    KhaltiInitiateRequest.builder()
        .amount(10000L)
        .purchaseOrderId("ORD-001")
        .purchaseOrderName("Pro Plan")
        .build()
);

// Redirect user to payment page
return response.paymentUrl();