A Next.js application that validates Atlassian Marketplace transactions to ensure:
- Pricing is correct based on user count and platform
- Manual discounts have proper explanations
- Partner cuts are calculated correctly (for specific products)
- Automated Price Validation: Fetches current pricing from marketplace listings and compares against transaction amounts
- Discount Verification: Ensures all manual discounts have explanations
- Partner Cut Validation: Verifies partner commission calculations (20% for Table Grid Next Generation)
- Multiple Report Formats: Generate reports in HTML, JSON, or plain text
- API-First Design: Use via web UI or direct API calls
- Vercel-Ready: Optimized for deployment on Vercel
- Node.js 18.x or higher
- Atlassian Marketplace API credentials
- Your Developer/Space ID from Atlassian
The Marketplace API uses Basic Authentication with your email and API token.
-
Get your API Token:
- Go to https://id.atlassian.com/manage-profile/security/api-tokens
- Click "Create API token"
- Give it a name (e.g., "Marketplace Validator")
- Copy and save the token (you won't see it again!)
-
Get your Developer ID:
- Go to https://developer.atlassian.com/
- Navigate to your developer profile or app listings
- Your Developer/Space ID is in the URL or profile settings
- It looks like:
39811bd6-659c-4089-a14f-a016fbfec7d9
-
Use your Atlassian account email:
- This is the email you use to log in to Atlassian
- Clone the repository:
git clone <repository-url>
cd mpwatcher- Install dependencies:
npm install- Create environment file:
cp .env.example .env- Configure environment variables in
.env:
ATLASSIAN_EMAIL=your_email@example.com
ATLASSIAN_API_TOKEN=your_api_token_here
ATLASSIAN_DEVELOPER_ID=39811bd6-659c-4089-a14f-a016fbfec7d9
PARTNER_CUT_PERCENTAGE=20Run the development server:
npm run devOpen http://localhost:3000 in your browser.
- Install Vercel CLI:
npm install -g vercel- Deploy:
vercel- Set environment variables:
vercel env add ATLASSIAN_EMAIL
vercel env add ATLASSIAN_API_TOKEN
vercel env add ATLASSIAN_DEVELOPER_ID
vercel env add PARTNER_CUT_PERCENTAGE- Redeploy with environment variables:
vercel --prod- Push your code to GitHub
- Go to vercel.com
- Click "New Project"
- Import your GitHub repository
- Add environment variables:
ATLASSIAN_API_TOKENATLASSIAN_DEVELOPER_IDPARTNER_CUT_PERCENTAGE
- Click "Deploy"
GET /api/validate?startDate=2024-01-01&endDate=2024-12-31&format=jsonParameters:
startDate(optional): Start date in YYYY-MM-DD formatendDate(optional): End date in YYYY-MM-DD formatappKey(optional): Specific app key to validateformat(optional): Report format -json,html, ortext(default:json)
Example Response (JSON format):
{
"success": true,
"report": {
"generatedAt": "2024-10-25T10:30:00.000Z",
"totalTransactions": 150,
"validTransactions": 142,
"invalidTransactions": 8,
"summary": {
"priceIssues": 3,
"discountIssues": 4,
"partnerCutIssues": 1
},
"results": [...]
}
}GET /api/healthReturns API status and configuration check.
The validator:
- Fetches current pricing from marketplace listings
- Extracts the pricing tier and platform from each transaction
- Compares the charged amount against expected pricing
- Accounts for discounts and rounding differences
For each transaction with discounts:
- Identifies manual/custom discounts
- Checks if an explanation/reason is provided
- Validates explanation quality (minimum length)
For Table Grid Next Generation transactions:
- Verifies partner commission is calculated correctly
- Checks if the partner cut matches the configured percentage (default 20%)
- Flags any discrepancies
- ✓ Price matches the marketplace listing for the given tier and platform
- ✓ Discounts are properly applied
⚠️ Allows ±$0.02 tolerance for rounding differences
- ✓ All manual discounts have explanations
- ✓ Explanations are at least 10 characters
⚠️ Warning if explanation is too brief
- ✓ Partner commission is exactly 20% (configurable) of vendor amount
- ✓ Only applies to Table Grid Next Generation
⚠️ Allows ±$0.02 tolerance for rounding differences
mpwatcher/
├── lib/
│ ├── atlassian-api.ts # Atlassian API client
│ ├── pricing-fetcher.ts # Marketplace pricing scraper
│ ├── validator.ts # Transaction validation logic
│ └── report-generator.ts # Report generation
├── pages/
│ ├── api/
│ │ ├── validate.ts # Main validation endpoint
│ │ └── health.ts # Health check endpoint
│ ├── _app.tsx
│ └── index.tsx # Web UI
├── types/
│ └── index.ts # TypeScript types
├── package.json
├── tsconfig.json
└── next.config.js
| Variable | Description | Required | Default |
|---|---|---|---|
ATLASSIAN_EMAIL |
Your Atlassian account email | Yes | - |
ATLASSIAN_API_TOKEN |
Your Atlassian API token | Yes | - |
ATLASSIAN_DEVELOPER_ID |
Your developer/space ID | Yes | - |
PARTNER_CUT_PERCENTAGE |
Partner commission % | No | 20 |
APP_KEYS |
Comma-separated app keys to validate | No | All apps |
- Ensure
ATLASSIAN_EMAIL,ATLASSIAN_API_TOKEN, andATLASSIAN_DEVELOPER_IDare set in your.envfile or Vercel environment variables - The email should be your Atlassian account email (used for Basic Auth)
- Get your API token from: https://id.atlassian.com/manage-profile/security/api-tokens
- Double-check your email and API token are correct
- Make sure the API token hasn't expired
- Verify the email matches your Atlassian account
- The API uses Basic Authentication (email + token), not OAuth
- The marketplace listing page structure may have changed
- Check if the app key is correct
- Verify the app is publicly listed on the marketplace
- Check your API token has the correct permissions
- Verify your developer ID is correct
- Ensure there are transactions in the specified date range
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT
For issues or questions, please open an issue on GitHub.