> For the complete documentation index, see [llms.txt](https://mogami.gitbook.io/mogami/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mogami.gitbook.io/mogami/java-server-sdk/getting-started-x402-v2.md).

# Getting started x402 V2

Here is how to use it on a simple REST service:

```java
@X402PayUSDC(amount = "3") // 3 USDC
@GetMapping("/weather")
public String weather() {
        return "It's sunny!";
}
```

You can have more parameters:

```java
@X402Resource(
  url = "/weatherWithX402PayUSDC",
  description = "Access to weather data with X402PayUSDC",
  mimeType = "text/plain"
)
@X402PayUSDC(
  amount = "0.01",
  payTo = "0x209693Bc6afc0C5328bA36FaF03C514EF312287C",
  network = "eip155:84532",
  description = "Access to protected content",
  maximumTimeoutSeconds = 300
)
@GetMapping("/weather")
public String weather() {
        return "It's sunny!";
}
```

To use our annotation in your spring boot project, edit your maven project and add:&#x20;

```xml
<dependency>
        <groupId>tech.mogami.spring</groupId>
        <artifactId>mogami-x402-spring-boot-starter</artifactId>
        <version>2.0.2</version>
</dependency>
```

or in your Gradle project:

```groovy
dependencies {
    implementation 'tech.mogami.spring:mogami-x402-spring-boot-starter:2.0.2'
}
```
