### Add Maven Repository (Gradle Kotlin)
Source: https://github.com/lunarclient/lunarclient.dev/blob/master/maven-repository.mdx
Configure your Gradle (Kotlin) project to use the Lunar Client Maven repository.
```kotlin
repositories {
maven {
name = "lunarclient"
url = uri("https://repo.lunarclient.dev")
}
}
```
--------------------------------
### Add Maven Repository (Gradle Groovy)
Source: https://github.com/lunarclient/lunarclient.dev/blob/master/maven-repository.mdx
Configure your Gradle (Groovy) project to use the Lunar Client Maven repository.
```groovy
repositories {
maven {
name = 'lunarclient'
url = 'https://repo.lunarclient.dev'
}
}
```
--------------------------------
### Add Maven Repository
Source: https://github.com/lunarclient/lunarclient.dev/blob/master/maven-repository.mdx
Configure your Maven project to use the Lunar Client Maven repository.
```xml
lunarclient
https://repo.lunarclient.dev
```
--------------------------------
### Purchase Webhook Event Format
Source: https://github.com/lunarclient/lunarclient.dev/blob/master/server-partner-program/purchase-webhooks.mdx
This JSON structure represents a typical `store.purchase.completed` webhook event. It includes details about the transaction, purchased packages, and the customer. Note that only relevant packages for your server partner program will be included.
```json
{
"id": "0a838fbe-b3be-4ebf-ba0c-1ee55caf5c68", // Unique ID assigned to this webhook invoke
"date": "2024-07-04T16:54:16.515Z", // Date this webhook was created, in ISO format
"type": "store.purchase.completed", // Type of this webhook. See Webhook Types section above.
"subject": {
"transactionId": "tbx-43016325a16605-282a5d", // Transaction ID uniquely identifying the purchase. No specific format is guaranteed.
"packages": [
{
"id": 5362597, // Internal ID of the package purchased. This should be a stable identifier.
"name": "Purple Prison (Hearts)", // Name of the package purchased.
"quantity": 1, // Quantity purchased
"paidIntoWallet": 9.84, // How much Lunar Client received after fees/taxes/etc.
"cosmeticSplits": [
{
"partner": {
"id": 23,
"name": "Purple Prison"
},
"percent": 0.5,
"payout": 4.92
}
]
},
{
"id": 5362600,
"name": "Purple Prison Necklace",
"quantity": 1,
"paidIntoWallet": 9.84,
"cosmeticSplits": []
}
],
"customer": {
"username": "macguy", // Minecraft username
"uuid": "7471b8e8-27c2-4354-a7d2-bd6a82dc00a0" // Minecraft uuid, with dashes
}
}
}
```
--------------------------------
### Verify Webhook Signature with Python
Source: https://github.com/lunarclient/lunarclient.dev/blob/master/server-partner-program/purchase-webhooks.mdx
This Python code snippet demonstrates how to verify webhook signatures using HMAC-SHA256. It requires the `LUNAR_CLIENT_WEBHOOK_SECRET` environment variable to be configured. The raw webhook body must be used for accurate signature generation.
```python
import os
import hmac
import hashlib
signature_secret = os.getenv('LUNAR_CLIENT_WEBHOOK_SECRET')
body = ... # This must be the raw body of the webhook. Parsing as JSON and re-serializing can create differences in whitespace.
expected_signature = hmac.new(
signature_secret.encode('utf-8'),
body.encode('utf-8'),
hashlib.sha256
).hexdigest()
```
--------------------------------
### Verify Webhook Signature with Node.js
Source: https://github.com/lunarclient/lunarclient.dev/blob/master/server-partner-program/purchase-webhooks.mdx
Use this code to verify the authenticity of incoming webhooks by comparing the `X-Signature` header with a computed HMAC-SHA256 hash of the raw request body. Ensure the `LUNAR_CLIENT_WEBHOOK_SECRET` environment variable is set.
```javascript
const signatureSecret = process.env.LUNAR_CLIENT_WEBHOOK_SECRET;
const body = ...; // This must be the raw body of the webhook. Parsing as JSON and re-serializing can create differences in whitespace.
const expectedSignature = crypto
.createHmac("sha256", signatureSecret)
.update(body)
.digest("hex");
```
--------------------------------
### Add Apollo API Dependency (Maven)
Source: https://github.com/lunarclient/lunarclient.dev/blob/master/maven-repository.mdx
Include the Apollo API as a provided dependency in your Maven project. For Adventure support, add the apollo-extra-adventure4 dependency.
```xml
com.lunarclient
apollo-api
1.2.7
provided
com.lunarclient
apollo-extra-adventure4
1.2.7
provided
```
--------------------------------
### Add Apollo API Dependency (Gradle Groovy)
Source: https://github.com/lunarclient/lunarclient.dev/blob/master/maven-repository.mdx
Include the Apollo API as a compileOnly dependency in your Gradle (Groovy) project. For Adventure support, add the apollo-extra-adventure4 dependency.
```groovy
dependencies {
compileOnly 'com.lunarclient:apollo-api:1.2.7'
// For Adventure support add the following dependency.
compileOnly 'com.lunarclient:apollo-extra-adventure4:1.2.7'
}
```
--------------------------------
### Add Apollo API Dependency (Gradle Kotlin)
Source: https://github.com/lunarclient/lunarclient.dev/blob/master/maven-repository.mdx
Include the Apollo API as a compileOnly dependency in your Gradle (Kotlin) project. For Adventure support, add the apollo-extra-adventure4 dependency.
```kotlin
dependencies {
compileOnly("com.lunarclient:apollo-api:1.2.7")
// For Adventure support add the following dependency.
compileOnly("com.lunarclient:apollo-extra-adventure4:1.2.7")
}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.