Compare commits
9
Commits
53c45f55ec
...
a003b2e043
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a003b2e043 | ||
|
|
7ad68a415b | ||
|
|
0bcf23d45b | ||
|
|
c357a35b77 | ||
|
|
f507981cbd | ||
|
|
ddfb19d9a9 | ||
|
|
8c61803aba | ||
|
|
b390d584f1 | ||
|
|
df61a1e789 |
@@ -1,415 +0,0 @@
|
||||
# SonarDesk Commercial Launch & Selling Guide
|
||||
|
||||
## 1. Recommended commercial model
|
||||
|
||||
Launch SonarDesk as a **direct-download macOS product with recurring licensing**. Use **Paddle as the production Merchant of Record (MoR)** for the initial launch because this codebase already has Paddle checkout, subscription lifecycle handling, customer lookup, upgrades/cancellation, webhook verification and product mapping implemented.
|
||||
|
||||
Do **not** operate Paddle and Lemon Squeezy as two public checkout systems at launch. Pick one system of record. Running two providers doubles reconciliation, refund, subscription-state and support complexity.
|
||||
|
||||
### Launch pricing
|
||||
|
||||
| Plan | Monthly | Annual | Activations | Positioning |
|
||||
|---|---:|---:|---:|---|
|
||||
| Personal | £2.99/month | £24.99/year | 1 Mac | Individual developer |
|
||||
| Professional | £4.99/month | £44.99/year | 3 Macs | Multi-Mac / professional workflow |
|
||||
|
||||
Both plans should include the complete feature set and a **7-day free trial**. Do not artificially cripple Personal. The upgrade is based on activation allowance, which is simple to understand and easy to support.
|
||||
|
||||
Annual should be the visual default. At these prices it produces better unit economics than very low monthly pricing because both Paddle and Lemon Squeezy publish a fixed transaction component in addition to their percentage fee.
|
||||
|
||||
### Launch offer
|
||||
|
||||
For the first 30 days, use a single promotion rather than permanently reducing the list price:
|
||||
|
||||
- 20% off the first annual term using a launch coupon such as `LAUNCH20`.
|
||||
- Do not discount monthly plans.
|
||||
- Do not promise “lifetime” access while the licensing model is subscription-based.
|
||||
- Keep the public list price stable so the product does not look disposable or permanently on sale.
|
||||
|
||||
## 2. Why Paddle is the recommended launch provider
|
||||
|
||||
Paddle's public pay-as-you-go pricing is 5% + $0.50 per checkout transaction and includes payments/billing, tax compliance and related Merchant of Record services. Paddle supports a sandbox, checkout, subscription lifecycle events and signed webhooks.
|
||||
|
||||
This project is already designed around Paddle:
|
||||
|
||||
- `CheckoutController` supplies Paddle price IDs to Paddle.js.
|
||||
- `/api/v1/webhooks/paddle` accepts Paddle events.
|
||||
- `PaddleWebhookVerifier` verifies signed webhook requests.
|
||||
- `PurchaseProvisioner` provisions from `subscription.*` and `transaction.completed` events.
|
||||
- `PaddleCatalogSeeder` maps Paddle products/prices to SonarDesk licence products.
|
||||
- The portal can upgrade Personal to Professional and cancel Paddle subscriptions.
|
||||
|
||||
That makes Paddle the lowest-risk route to a release.
|
||||
|
||||
Official references:
|
||||
|
||||
- Paddle pricing: https://www.paddle.com/pricing
|
||||
- Paddle quickstart: https://developer.paddle.com/get-started/quickstart/
|
||||
- Paddle webhooks: https://developer.paddle.com/webhooks/
|
||||
- Paddle webhook simulator: https://developer.paddle.com/webhooks/simulator/
|
||||
|
||||
## 3. Paddle setup — complete production checklist
|
||||
|
||||
### A. Create/complete the Paddle account
|
||||
|
||||
1. Create the Paddle account and complete business verification.
|
||||
2. Add the legal/business details that Paddle requests.
|
||||
3. Configure payout details.
|
||||
4. Add the production website/domain.
|
||||
5. Complete Paddle's domain/default payment link approval before launch.
|
||||
6. Keep the account in sandbox while integrating. Switch the application to production only after the full purchase flow has passed end-to-end testing.
|
||||
|
||||
### B. Create the catalog
|
||||
|
||||
Create two Paddle products:
|
||||
|
||||
**SonarDesk Personal**
|
||||
- Monthly recurring price: **£3.99 GBP / month**
|
||||
- Annual recurring price: **£29.99 GBP / year**
|
||||
- Trial: **7 days**
|
||||
|
||||
**SonarDesk Professional**
|
||||
- Monthly recurring price: **£6.99 GBP / month**
|
||||
- Annual recurring price: **£59.99 GBP / year**
|
||||
- Trial: **7 days**
|
||||
|
||||
Use tax-inclusive/exclusive behaviour consistently with the checkout experience you want Paddle to present. Paddle, as MoR, calculates the applicable transaction taxes in checkout.
|
||||
|
||||
Copy the resulting two product IDs and four price IDs.
|
||||
|
||||
### C. Create application credentials
|
||||
|
||||
In Paddle Developer Tools:
|
||||
|
||||
1. Create a server API key for the licensing application.
|
||||
2. Create a client-side token for Paddle.js.
|
||||
3. Never put the server API key into browser JavaScript or source control.
|
||||
4. Keep sandbox and production credentials separate.
|
||||
|
||||
### D. Configure the webhook
|
||||
|
||||
Create a Paddle notification destination:
|
||||
|
||||
`https://YOUR-DOMAIN/api/v1/webhooks/paddle`
|
||||
|
||||
Subscribe at minimum to:
|
||||
|
||||
- `transaction.completed`
|
||||
- `subscription.created`
|
||||
- `subscription.updated`
|
||||
- `subscription.activated`
|
||||
- `subscription.canceled`
|
||||
- `subscription.paused`
|
||||
- `subscription.resumed`
|
||||
- `subscription.past_due`
|
||||
|
||||
The current code uses subscription events as the authoritative state for recurring licences. Paddle documents `transaction.completed` as the point at which transaction processing is complete. Paddle also documents at-least-once webhook delivery, so webhook handlers must remain idempotent; this project stores webhook event IDs for that purpose.
|
||||
|
||||
Copy the webhook endpoint secret.
|
||||
|
||||
### E. Production `.env`
|
||||
|
||||
Set the following values on the production server. Do not commit them.
|
||||
|
||||
```dotenv
|
||||
APP_ENV=production
|
||||
APP_DEBUG=false
|
||||
APP_URL=https://YOUR-DOMAIN
|
||||
|
||||
PADDLE_ENVIRONMENT=production
|
||||
PADDLE_API_URL=https://api.paddle.com
|
||||
PADDLE_API_KEY=YOUR_PRODUCTION_API_KEY
|
||||
PADDLE_CLIENT_SIDE_TOKEN=YOUR_PRODUCTION_CLIENT_TOKEN
|
||||
PADDLE_WEBHOOK_SECRET=YOUR_PRODUCTION_WEBHOOK_SECRET
|
||||
PADDLE_WEBHOOK_TOLERANCE=300
|
||||
|
||||
PADDLE_PERSONAL_PRODUCT_ID=pro_...
|
||||
PADDLE_PERSONAL_MONTHLY_PRICE_ID=pri_...
|
||||
PADDLE_PERSONAL_ANNUAL_PRICE_ID=pri_...
|
||||
PADDLE_PROFESSIONAL_PRODUCT_ID=pro_...
|
||||
PADDLE_PROFESSIONAL_MONTHLY_PRICE_ID=pri_...
|
||||
PADDLE_PROFESSIONAL_ANNUAL_PRICE_ID=pri_...
|
||||
```
|
||||
|
||||
Also configure the existing SonarDesk licence signing keys, mailer, support email and application database.
|
||||
|
||||
### F. Seed the price mapping
|
||||
|
||||
After the production IDs are in `.env`:
|
||||
|
||||
```bash
|
||||
php artisan config:clear
|
||||
php artisan db:seed --class=PaddleCatalogSeeder
|
||||
php artisan config:cache
|
||||
```
|
||||
|
||||
Check the `license_products` table and confirm there are four active Paddle rows with the correct product/price IDs and activation limits.
|
||||
|
||||
### G. Test in sandbox before production
|
||||
|
||||
Test every one of these scenarios:
|
||||
|
||||
1. Personal monthly trial signup.
|
||||
2. Personal annual trial signup.
|
||||
3. Professional monthly trial signup.
|
||||
4. Professional annual trial signup.
|
||||
5. Licence email is delivered.
|
||||
6. Licence activates in SonarDesk.
|
||||
7. Second activation is rejected for Personal.
|
||||
8. Up to three activations work for Professional.
|
||||
9. Portal displays the licence.
|
||||
10. Deactivate a Mac and activate a replacement Mac.
|
||||
11. Upgrade Personal to Professional.
|
||||
12. Cancel a subscription.
|
||||
13. Simulate a failed payment / past-due subscription.
|
||||
14. Simulate cancellation/expiry and confirm entitlement behaviour.
|
||||
15. Replay the same webhook and confirm a duplicate licence is not created.
|
||||
16. Refund test transaction and verify the intended entitlement state.
|
||||
17. Verify support and transactional email deliverability.
|
||||
18. Verify checkout on Safari and Chrome, including a private window.
|
||||
|
||||
Use Paddle's webhook simulator for lifecycle testing as well as a real sandbox checkout.
|
||||
|
||||
### H. Go live
|
||||
|
||||
1. Create the production catalog (do not reuse sandbox IDs).
|
||||
2. Add production API key/client token/webhook secret.
|
||||
3. Seed the production catalog mapping.
|
||||
4. Change `PADDLE_ENVIRONMENT=production` and `PADDLE_API_URL=https://api.paddle.com`.
|
||||
5. Run `php artisan config:cache`.
|
||||
6. Make one real low-value purchase with a controlled account.
|
||||
7. Confirm the webhook, licence issuance, email, activation, portal and cancellation path.
|
||||
8. Refund the test purchase in Paddle after validation if appropriate.
|
||||
|
||||
## 4. Lemon Squeezy — alternative setup
|
||||
|
||||
Lemon Squeezy is also a Merchant of Record and publishes base ecommerce pricing of 5% + $0.50 per transaction, with additional fees in some cases (for example certain international, PayPal and subscription payments). It also provides software licence keys and a License API.
|
||||
|
||||
Official references:
|
||||
|
||||
- Pricing: https://www.lemonsqueezy.com/pricing
|
||||
- Fees: https://docs.lemonsqueezy.com/help/getting-started/fees
|
||||
- Webhooks: https://docs.lemonsqueezy.com/help/webhooks
|
||||
- License API: https://docs.lemonsqueezy.com/api/license-api
|
||||
|
||||
### Important for this codebase
|
||||
|
||||
The application has a Lemon Squeezy webhook verifier and basic purchase provisioning, but the **public checkout and customer portal are currently Paddle-first**. Lemon Squeezy should therefore be treated as an alternative migration path, not a second launch checkout, until its full subscription lifecycle and portal actions are implemented and tested.
|
||||
|
||||
If switching to Lemon Squeezy:
|
||||
|
||||
1. Create a store and complete activation/verification.
|
||||
2. Create Personal and Professional products/variants with the same public pricing.
|
||||
3. Decide whether SonarDesk's own signed licence system remains authoritative (recommended for consistency with the Mac app) or whether you migrate fully to Lemon Squeezy's License API. Do not mix both without a clear source of truth.
|
||||
4. Create a webhook at:
|
||||
|
||||
`https://YOUR-DOMAIN/api/v1/webhooks/lemon-squeezy`
|
||||
|
||||
5. Generate a strong signing secret and set:
|
||||
|
||||
```dotenv
|
||||
LEMON_SQUEEZY_WEBHOOK_SECRET=YOUR_SECRET
|
||||
```
|
||||
|
||||
6. Subscribe to the events the application needs, including order creation/refund and all relevant subscription state events.
|
||||
7. Add `license_products` mappings where `payment_provider=lemon-squeezy`, mapping Lemon Squeezy variant IDs to `external_price_id`.
|
||||
8. Implement/verify checkout links or overlay checkout on `/buy` before exposing Lemon Squeezy publicly.
|
||||
9. Extend `PurchaseProvisioner::provisionLemonSqueezy()` so subscription updates, cancellations, pauses, payment failures/recovery and upgrades are handled with the same completeness as Paddle.
|
||||
10. Add customer-portal actions for cancellation/change-of-plan or route customers to Lemon Squeezy's supported customer management flow.
|
||||
11. Run the same end-to-end test matrix used for Paddle.
|
||||
|
||||
Lemon Squeezy webhooks are signed and should always be verified. Their documentation states that unsuccessful webhook deliveries are retried; keep processing idempotent and persist event identity/state.
|
||||
|
||||
## 5. Website conversion strategy
|
||||
|
||||
The updated site now has a clearer commercial funnel:
|
||||
|
||||
`Home → Features → Pricing → Paddle checkout → licence email → app activation → customer portal`
|
||||
|
||||
### Home page
|
||||
|
||||
The home page should answer these questions in order:
|
||||
|
||||
1. What is it? A native macOS companion for SonarQube.
|
||||
2. Why should I care? Faster access to project health and issues without browser-tab friction.
|
||||
3. What does it do? Projects, quality gates, measures, issues, multiple servers and secure token storage.
|
||||
4. Is it safe? SonarQube tokens are stored in macOS Keychain and server permissions remain authoritative.
|
||||
5. What does it cost? Clear Personal and Professional pricing.
|
||||
6. What should I do next? Start the 7-day free trial.
|
||||
|
||||
### Product language to keep consistent
|
||||
|
||||
**Primary one-line pitch**
|
||||
|
||||
> SonarDesk is a native macOS companion for SonarQube that puts project health, quality gates and issues in one focused desktop workspace.
|
||||
|
||||
**Short description**
|
||||
|
||||
> Monitor SonarQube projects, quality gates, bugs, vulnerabilities, code smells and measures without living in a browser.
|
||||
|
||||
**Positioning rule**
|
||||
|
||||
Never imply SonarDesk replaces SonarQube. The stronger and more credible position is: **SonarQube remains the source of truth; SonarDesk makes everyday monitoring faster on macOS.**
|
||||
|
||||
## 6. Launch channels
|
||||
|
||||
### Phase 1 — pre-launch (7–14 days)
|
||||
|
||||
- Finish notarised/signable release build and direct-download hosting.
|
||||
- Finish Paddle production approval.
|
||||
- Record a 30–60 second clean screen capture showing: connect server → project dashboard → issues → issue details.
|
||||
- Produce 4–6 high-resolution screenshots.
|
||||
- Create the launch coupon.
|
||||
- Test website analytics and conversion events.
|
||||
- Prepare support macros for activation, lost key, machine replacement, refund and SonarQube connection problems.
|
||||
- Recruit 5–10 testers from existing developer contacts for final feedback and testimonials you have permission to publish.
|
||||
|
||||
### Phase 2 — launch day
|
||||
|
||||
Publish in this order:
|
||||
|
||||
1. SonarDesk release page on your own site.
|
||||
2. LinkedIn launch post.
|
||||
3. Medium article.
|
||||
4. Relevant developer communities where self-promotion is allowed and useful.
|
||||
5. Existing customer/user mailing list only if recipients have consented to product marketing.
|
||||
|
||||
Do not spam generic communities. Show the product solving a concrete SonarQube workflow problem.
|
||||
|
||||
### Phase 3 — first 30 days
|
||||
|
||||
Publish practical content rather than repeating sales copy:
|
||||
|
||||
- “A faster way to review SonarQube issues on macOS”
|
||||
- “How I use SonarQube quality gates in a desktop workflow”
|
||||
- “What SonarDesk stores locally and how tokens are protected”
|
||||
- “Personal vs Professional: which SonarDesk licence do I need?”
|
||||
- Short release notes for every update
|
||||
|
||||
Track: website → pricing clicks, checkout starts, trial starts, trial-to-paid conversion, cancellations, refunds, activation failures and support topics.
|
||||
|
||||
## 7. LinkedIn release post
|
||||
|
||||
**SonarDesk 1.0 is now available for macOS.**
|
||||
|
||||
If SonarQube is part of your development workflow, you probably know the routine: open the browser, find the project, check the quality gate, scan the latest issues, then switch back to your editor.
|
||||
|
||||
I built SonarDesk to make that recurring workflow faster on the Mac.
|
||||
|
||||
SonarDesk is a native macOS companion for SonarQube. It brings project health, quality gates, bugs, vulnerabilities, code smells and measures into one focused desktop workspace.
|
||||
|
||||
Version 1.0 includes:
|
||||
|
||||
- Project dashboards and quality gate status
|
||||
- Bugs, vulnerabilities and code smells
|
||||
- Detailed issue views and filtering
|
||||
- Server-side pagination for larger issue sets
|
||||
- Multiple SonarQube server configurations
|
||||
- SonarQube token storage in macOS Keychain
|
||||
- Direct licensing and a self-service customer portal
|
||||
|
||||
SonarQube remains the source of truth. SonarDesk is designed to make the information you check throughout the day quicker to reach and easier to keep visible.
|
||||
|
||||
Personal is £24.99/year for one active Mac. Professional is £44.99/year for up to three active Macs. Monthly options are also available, and every plan starts with a 7-day free trial.
|
||||
|
||||
Learn more and try SonarDesk: **YOUR_RELEASE_URL**
|
||||
|
||||
#macOS #SonarQube #SoftwareDevelopment #CodeQuality #DeveloperTools
|
||||
|
||||
## 8. Medium launch article
|
||||
|
||||
# Introducing SonarDesk: a native SonarQube companion for macOS
|
||||
|
||||
SonarQube is a valuable part of the software-development toolchain. It gives teams a central place to understand code quality, security findings and the state of quality gates. But the information developers need throughout the day often lives one browser context-switch away from the work itself.
|
||||
|
||||
That is the problem I wanted SonarDesk to solve.
|
||||
|
||||
## A focused Mac workspace for SonarQube
|
||||
|
||||
SonarDesk is a native macOS companion for SonarQube. It is not a replacement for SonarQube, and it does not try to become another analysis engine. Your SonarQube server remains the source of truth.
|
||||
|
||||
Instead, SonarDesk focuses on the recurring desktop workflow: open a project, see its health, check the quality gate, browse bugs, vulnerabilities and code smells, inspect an issue, and get back to the code.
|
||||
|
||||
## What SonarDesk 1.0 includes
|
||||
|
||||
The first release includes project dashboards, quality gate status, important measures, issue browsing and detailed issue views. Issue lists support practical filtering and server-side pagination, which helps keep the workflow manageable as result sets grow.
|
||||
|
||||
SonarDesk can also keep multiple SonarQube server configurations available from the same Mac application. SonarQube access tokens are stored using macOS Keychain, and access remains governed by the permissions of the credentials you provide.
|
||||
|
||||
## Why a native app?
|
||||
|
||||
The browser is excellent for deep investigation and administration, and SonarDesk is not intended to remove it from the workflow. The benefit of a dedicated desktop app is focus. The project-health information you check repeatedly can have a consistent place on the Mac, separate from documentation, tickets, dashboards and all the other tabs competing for attention.
|
||||
|
||||
## Direct distribution and licensing
|
||||
|
||||
SonarDesk is distributed directly for macOS. Customers receive a licence and can manage activations through the SonarDesk customer portal.
|
||||
|
||||
There are two plans. Personal supports one active Mac and costs £24.99 per year or £2.99 per month. Professional supports up to three active Macs and costs £44.99 per year or £4.99 per month. Both include the complete feature set and start with a seven-day free trial.
|
||||
|
||||
## What comes next
|
||||
|
||||
Version 1.0 establishes the core SonarQube monitoring workflow on macOS. Future releases will continue to focus on making project and issue review faster, clearer and more useful without turning SonarDesk into a replacement for the platform it connects to.
|
||||
|
||||
If SonarQube is part of your day-to-day development workflow and you work on a Mac, you can learn more and start a free trial here:
|
||||
|
||||
**YOUR_RELEASE_URL**
|
||||
|
||||
## 9. Short announcement copy
|
||||
|
||||
**SonarDesk 1.0 for macOS is available now.** Monitor SonarQube project health, quality gates, bugs, vulnerabilities and code smells from a focused native Mac app. Personal and Professional plans include a 7-day free trial. **YOUR_RELEASE_URL**
|
||||
|
||||
## 10. Product listing copy
|
||||
|
||||
### Name
|
||||
SonarDesk
|
||||
|
||||
### Tagline
|
||||
Native SonarQube monitoring for macOS.
|
||||
|
||||
### 80-character style description
|
||||
Monitor SonarQube projects, quality gates and issues from your Mac.
|
||||
|
||||
### Full product description
|
||||
SonarDesk is a native macOS companion for developers and engineering teams using SonarQube. It provides a focused desktop view of project health, quality gates, measures, bugs, vulnerabilities and code smells, with detailed issue views, filtering, server-side pagination and support for multiple SonarQube server configurations. SonarQube tokens are stored in macOS Keychain, and your existing SonarQube permissions remain authoritative.
|
||||
|
||||
## 11. Release readiness checklist
|
||||
|
||||
Do not announce the public release until all items below are true:
|
||||
|
||||
- Production app is signed with Developer ID and notarised.
|
||||
- DMG/ZIP download is served over HTTPS.
|
||||
- Version and build number are final.
|
||||
- Sparkle/update mechanism, if used, is production-configured and signed.
|
||||
- Privacy policy, terms and cookie information match actual behaviour.
|
||||
- Support address is monitored.
|
||||
- Paddle production checkout is approved and working.
|
||||
- Webhook signature verification is enabled.
|
||||
- Production webhook endpoint returns successful responses.
|
||||
- Production product and price IDs are mapped in the database.
|
||||
- Licence signing private key is backed up securely and is not in source control.
|
||||
- Licence activation/validation/deactivation work from a clean Mac.
|
||||
- Purchase email and support email pass SPF/DKIM/DMARC checks.
|
||||
- Trial, paid renewal, cancellation, failed payment and refund paths are tested.
|
||||
- Website has working Home, Features, Pricing, Release, Support, Privacy and Terms pages.
|
||||
- Open Graph image and favicon render correctly.
|
||||
- A real production purchase has been tested end-to-end.
|
||||
- Download analytics and checkout conversion events are visible.
|
||||
- Launch screenshots/video are ready.
|
||||
- LinkedIn and Medium copy has been proofread and final URLs inserted.
|
||||
|
||||
## 12. First commercial targets
|
||||
|
||||
For the first 90 days, optimize for learning rather than vanity traffic. Review weekly:
|
||||
|
||||
- Unique visitors to the product page
|
||||
- Pricing-page visits
|
||||
- Checkout starts
|
||||
- Trial starts
|
||||
- Trial-to-paid conversion
|
||||
- Annual vs monthly mix
|
||||
- Personal vs Professional mix
|
||||
- Cancellation/refund reasons
|
||||
- Activation failure rate
|
||||
- Top support issues
|
||||
|
||||
Do not change pricing every week. Collect enough data to understand whether the problem is traffic, positioning, checkout friction, onboarding or product value before changing the commercial model.
|
||||
@@ -17,10 +17,10 @@ final class CheckoutController extends Controller
|
||||
}
|
||||
|
||||
$plans = [
|
||||
'personal-monthly' => ['name' => 'Personal', 'billing' => 'Monthly', 'display_price' => '£2.99 / month', 'price_id' => $paddle['personal_monthly_price_id'], 'activation_limit' => 1],
|
||||
'personal-annual' => ['name' => 'Personal', 'billing' => 'Annual', 'display_price' => '£24.99 / year', 'price_id' => $paddle['personal_annual_price_id'], 'activation_limit' => 1],
|
||||
'professional-monthly' => ['name' => 'Professional', 'billing' => 'Monthly', 'display_price' => '£4.99 / month', 'price_id' => $paddle['professional_monthly_price_id'], 'activation_limit' => 3],
|
||||
'professional-annual' => ['name' => 'Professional', 'billing' => 'Annual', 'display_price' => '£44.99 / year', 'price_id' => $paddle['professional_annual_price_id'], 'activation_limit' => 3],
|
||||
'personal-monthly' => ['name' => 'Personal', 'billing' => 'Monthly', 'display_price' => '£4.99 / month', 'price_id' => $paddle['personal_monthly_price_id'], 'activation_limit' => 1],
|
||||
'personal-annual' => ['name' => 'Personal', 'billing' => 'Annual', 'display_price' => '£39.99 / year', 'price_id' => $paddle['personal_annual_price_id'], 'activation_limit' => 1],
|
||||
'professional-monthly' => ['name' => 'Professional', 'billing' => 'Monthly', 'display_price' => '£8.99 / month', 'price_id' => $paddle['professional_monthly_price_id'], 'activation_limit' => 3],
|
||||
'professional-annual' => ['name' => 'Professional', 'billing' => 'Annual', 'display_price' => '£79.99 / year', 'price_id' => $paddle['professional_annual_price_id'], 'activation_limit' => 3],
|
||||
];
|
||||
|
||||
foreach ($plans as $plan) {
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Payments;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
final class CustomerAccountProvisioner
|
||||
{
|
||||
public function ensure(?string $email, ?string $name = null): ?User
|
||||
{
|
||||
$email = strtolower(trim((string) $email));
|
||||
if ($email === '' || ! filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$user = User::whereRaw('lower(email) = ?', [$email])->first();
|
||||
if ($user) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
$displayName = trim((string) $name);
|
||||
if ($displayName === '') {
|
||||
$displayName = Str::headline(Str::before($email, '@')) ?: 'SonarDesk Customer';
|
||||
}
|
||||
|
||||
$user = User::firstOrCreate(
|
||||
['email' => $email],
|
||||
[
|
||||
'name' => $displayName,
|
||||
// The customer never receives or knows this password. They choose their
|
||||
// own password through Laravel's signed, single-use reset flow.
|
||||
'password' => Str::random(64),
|
||||
// Access still requires possession of the mailbox because account setup
|
||||
// is completed using the reset link sent to this address.
|
||||
'email_verified_at' => now(),
|
||||
],
|
||||
);
|
||||
|
||||
if ($user->wasRecentlyCreated) {
|
||||
DB::afterCommit(function () use ($email): void {
|
||||
try {
|
||||
$status = Password::sendResetLink(['email' => $email]);
|
||||
if ($status !== Password::RESET_LINK_SENT) {
|
||||
Log::warning('SonarDesk customer account created but setup email was not sent.', [
|
||||
'email' => $email,
|
||||
'status' => $status,
|
||||
]);
|
||||
}
|
||||
} catch (\Throwable $exception) {
|
||||
// A mail outage must never undo a paid licence. The customer can
|
||||
// also use Forgot Password once mail is restored.
|
||||
report($exception);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ The current code uses subscription events as the authoritative state for recurri
|
||||
|
||||
Copy the webhook endpoint secret.
|
||||
|
||||
### E. Production `.env`
|
||||
### E. Production `../.env`
|
||||
|
||||
Set the following values on the production server. Do not commit them.
|
||||
|
||||
@@ -135,7 +135,7 @@ Also configure the existing SonarDesk licence signing keys, mailer, support emai
|
||||
|
||||
### F. Seed the price mapping
|
||||
|
||||
After the production IDs are in `.env`:
|
||||
After the production IDs are in `../.env`:
|
||||
|
||||
```bash
|
||||
php artisan config:clear
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
Paddle.PricePreview({items: previewItems}).then(result => {
|
||||
for (const item of (result?.data?.details?.lineItems ?? [])) {
|
||||
const element = priceElements.get(item?.price?.id);
|
||||
const formatted = item?.formattedTotals?.subtotal ?? item?.formattedUnitTotals?.subtotal;
|
||||
const formatted = item?.formattedTotals?.total ?? item?.formattedUnitTotals?.total;
|
||||
if (!element || !formatted) continue;
|
||||
const suffix = element.dataset.billing === 'annual' ? ' / year' : ' / month';
|
||||
element.textContent = formatted + suffix;
|
||||
|
||||
@@ -253,6 +253,7 @@
|
||||
<a href="{{ route('support') }}">Support</a>
|
||||
<a href="{{ route('privacy') }}">Privacy</a>
|
||||
<a href="{{ route('terms') }}">Terms</a>
|
||||
<a href="{{ route('refund') }}">Refunds</a>
|
||||
<a href="{{ route('cookies') }}">Cookies</a>
|
||||
<button type="button" class="footer-cookie-link" data-cookie-settings>Cookie settings</button>
|
||||
@auth @if(auth()->user()->hasVerifiedEmail())<a href="{{ route('portal.index') }}">Licence portal</a>@endif @else<a href="{{ route('login') }}">Sign in</a>@endauth
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
@extends('layouts.app', ['title' => 'Refund Policy — SonarDesk'])
|
||||
|
||||
@section('content')
|
||||
@php($legal = config('sonardesk.legal'))
|
||||
<article class="legal-page">
|
||||
<header class="legal-head">
|
||||
<span class="eyebrow">Legal</span>
|
||||
<h1>Refund Policy</h1>
|
||||
<p>Last updated 1 October 2026</p>
|
||||
</header>
|
||||
|
||||
<div class="legal-intro">
|
||||
This policy explains cancellation, refund and statutory consumer rights for SonarDesk subscriptions.
|
||||
SonarDesk payments are processed by Paddle, our Merchant of Record. Nothing in this policy limits any
|
||||
rights or remedies that cannot lawfully be limited.
|
||||
</div>
|
||||
|
||||
<section>
|
||||
<h2>1. Seven-day free trial</h2>
|
||||
<p>Where shown at checkout, SonarDesk includes a seven-day free trial. You can cancel before the trial
|
||||
ends to prevent the subscription converting to a paid subscription. If you cancel during the trial
|
||||
before a charge is made, there is no subscription payment to refund.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>2. Cancelling a paid subscription</h2>
|
||||
<p>You may cancel your subscription through the SonarDesk licence portal or the subscription-management
|
||||
facilities provided through Paddle. Cancellation stops future automatic renewals. Unless stated
|
||||
otherwise during cancellation, your licence normally remains available until the end of the billing
|
||||
period for which you have already paid.</p>
|
||||
<p>Cancellation does not itself create a refund for an earlier payment.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>3. Refund requests</h2>
|
||||
<p>If you believe a payment should be refunded, contact
|
||||
<a href="{{ route('support') }}">SonarDesk Support</a> as soon as possible. Please provide the email
|
||||
address used for the purchase and enough information for us to identify the transaction. Do not send
|
||||
full payment-card details.</p>
|
||||
<p>Because Paddle is the Merchant of Record, a refund may be processed by Paddle and may also be
|
||||
requested through Paddle's buyer-support facilities. Approved refunds are returned to the original
|
||||
payment method in accordance with Paddle's processing arrangements and the payment provider's timing.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>4. UK and EEA consumer withdrawal rights</h2>
|
||||
<p>If you purchase as a consumer, applicable law may provide a cooling-off or withdrawal period for
|
||||
distance contracts. For UK consumers this is generally 14 days, subject to the statutory rules and
|
||||
exceptions that apply to digital content and services.</p>
|
||||
<p>If you expressly request or consent to digital supply or performance beginning during a statutory
|
||||
withdrawal period, the law may affect the right to withdraw once supply or performance has begun.
|
||||
Nothing on this page removes a statutory right that applies to your purchase.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>5. Faulty or misdescribed digital content</h2>
|
||||
<p>This refund policy does not replace your statutory remedies. If SonarDesk is faulty, materially not
|
||||
as described, or otherwise fails to meet rights that apply to digital content or services under
|
||||
consumer law, you may be entitled to a repair, replacement, price reduction, refund or another remedy
|
||||
depending on the circumstances.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>6. Duplicate or incorrect charges</h2>
|
||||
<p>If you believe you have been charged twice, charged after a valid cancellation, charged an incorrect
|
||||
amount, or charged for the wrong plan, contact us promptly. We will investigate the subscription and
|
||||
transaction records and, where appropriate, arrange correction or refund through Paddle.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>7. Renewal payments</h2>
|
||||
<p>Subscriptions renew automatically until cancelled. A renewal charge is not automatically refundable
|
||||
solely because the subscription was not cancelled before renewal. We will nevertheless consider refund
|
||||
requests fairly, taking account of the circumstances, applicable law, the timing of the request and
|
||||
whether the renewed service has been used.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>8. Chargebacks</h2>
|
||||
<p>Please contact SonarDesk Support or Paddle about a disputed payment before initiating a chargeback
|
||||
where practical. This gives us an opportunity to investigate duplicate, fraudulent or incorrect charges
|
||||
promptly. This does not restrict any right you have to dispute a payment with your payment provider.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>9. How refunds affect your licence</h2>
|
||||
<p>A full refund or reversal of a subscription payment may cause the associated subscription and
|
||||
SonarDesk licence to be cancelled or revoked. Where only part of a payment is refunded, any effect on
|
||||
the subscription will depend on the reason for the adjustment and the resulting Paddle subscription
|
||||
status.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>10. Contact</h2>
|
||||
<p>For refund or billing enquiries, contact
|
||||
<a href="mailto:{{ $legal['support_email'] }}">{{ $legal['support_email'] }}</a> or use
|
||||
<a href="{{ route('support') }}">SonarDesk Support</a>. Include your purchase email address and relevant
|
||||
transaction details, but never send complete card details.</p>
|
||||
<p>See also our <a href="{{ route('terms') }}">Terms of Service</a>.</p>
|
||||
</section>
|
||||
</article>
|
||||
@endsection
|
||||
@@ -3,17 +3,144 @@
|
||||
@section('content')
|
||||
@php($legal = config('sonardesk.legal'))
|
||||
<article class="legal-page">
|
||||
<header class="legal-head"><span class="eyebrow">Legal</span><h1>Terms of Service</h1><p>Last updated 9 September 2026</p></header>
|
||||
<div class="legal-intro">These terms govern your use of the SonarDesk website, licence portal, subscription service and macOS application.</div>
|
||||
<section><h2>1. Licence plans</h2><p>Personal permits the number of active Mac installations shown for that plan at purchase. Professional permits the number shown for Professional. A licence is for your use and may not be shared, resold or used to bypass activation limits.</p></section>
|
||||
<section><h2>2. Trials and subscriptions</h2><p>Where offered, the trial length and renewal terms are shown at checkout. Subscription billing, cancellation, tax and payment processing are handled through Paddle. Your subscription continues until cancelled in accordance with the checkout terms. Changes between Personal and Professional may be prorated by Paddle.</p></section>
|
||||
<section><h2>3. Activation</h2><p>SonarDesk uses a licence service to activate permitted Macs and periodically confirm that an activation remains valid. A reasonable offline grace period may be provided, but continued use after a subscription or activation is revoked is not authorised.</p></section>
|
||||
<section><h2>4. Your SonarQube connections</h2><p>You are responsible for the SonarQube servers, credentials, tokens and projects you connect to SonarDesk. SonarDesk displays information made available by your SonarQube account and does not grant additional server permissions.</p></section>
|
||||
<section><h2>5. Acceptable use</h2><p>You must not attempt to defeat licensing controls, interfere with the service, probe accounts you do not own, distribute malware, or use SonarDesk in violation of applicable law or third-party rights.</p></section>
|
||||
<section><h2>6. Updates and availability</h2><p>We may update the application, website and licensing service to improve security, compatibility or functionality. We aim to provide a reliable service but do not guarantee uninterrupted availability.</p></section>
|
||||
<section><h2>7. Consumer rights</h2><p>Nothing in these terms excludes rights that cannot lawfully be excluded, including applicable UK consumer rights. Where mandatory law gives you stronger protections, that law prevails.</p></section>
|
||||
<section><h2>8. Liability</h2><p>To the extent permitted by law, we are not responsible for indirect or consequential loss arising from incorrect sync configuration, deleted destination data, unavailable third-party systems or failures outside our reasonable control. This does not limit liability that cannot lawfully be limited.</p></section>
|
||||
<section><h2>9. Privacy</h2><p>Our processing of personal data is described in the <a href="{{ route('privacy') }}">Privacy Policy</a> and <a href="{{ route('cookies') }}">Cookie Policy</a>.</p></section>
|
||||
<section><h2>10. Contact</h2><p>These terms are provided by {{ $legal['controller_name'] }} in {{ $legal['country'] }}. Questions can be submitted through <a href="{{ route('support') }}">SonarDesk Support</a>.</p></section>
|
||||
<header class="legal-head">
|
||||
<span class="eyebrow">Legal</span>
|
||||
<h1>Terms of Service</h1>
|
||||
<p>Last updated 1 October 2026</p>
|
||||
</header>
|
||||
|
||||
<div class="legal-intro">
|
||||
These Terms of Service govern your use of the SonarDesk website, licence portal,
|
||||
subscription service and macOS application. By purchasing, activating or using SonarDesk,
|
||||
you agree to these terms. Your statutory rights are not affected.
|
||||
</div>
|
||||
|
||||
<section>
|
||||
<h2>1. SonarDesk licences</h2>
|
||||
<p>SonarDesk is licensed, not sold. A Personal subscription permits the number of active Mac
|
||||
installations stated for that plan at the time of purchase. A Professional subscription permits
|
||||
the number stated for the Professional plan. Licences are for the subscriber's use and must not
|
||||
be shared, resold, sublicensed or used to circumvent activation limits.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>2. Free trials</h2>
|
||||
<p>Where a free trial is offered, its duration and the price that will apply afterwards are shown
|
||||
before checkout. Unless you cancel before the trial ends, the subscription will automatically
|
||||
convert to the selected paid plan and Paddle will charge the payment method provided at checkout.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>3. Subscriptions, billing and renewal</h2>
|
||||
<p>SonarDesk subscriptions renew automatically at the billing interval selected at checkout until
|
||||
cancelled. The renewal price, billing period, applicable taxes and other checkout information are
|
||||
presented before you complete the transaction. Payment processing, tax collection and subscription
|
||||
billing are handled by Paddle, our Merchant of Record.</p>
|
||||
<p>Changes between Personal and Professional plans may result in a prorated charge or credit as
|
||||
calculated by Paddle and displayed as part of the subscription change.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>4. Cancellation</h2>
|
||||
<p>You may cancel a subscription through the SonarDesk licence portal or the subscription-management
|
||||
facilities made available through Paddle. Cancellation prevents future renewals. Unless the
|
||||
cancellation flow expressly states otherwise, access normally continues until the end of the
|
||||
already-paid billing period.</p>
|
||||
<p>Cancellation and refund requests are separate. Cancelling a subscription does not automatically
|
||||
refund charges already paid. See our <a href="{{ route('refund') }}">Refund Policy</a>.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>5. Activation and licence checks</h2>
|
||||
<p>SonarDesk uses a licence service to activate permitted Macs and periodically confirm that an
|
||||
activation remains valid. A reasonable offline grace period may be provided. Continued use after a
|
||||
licence or subscription has expired or been revoked is not authorised.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>6. Your SonarQube connections</h2>
|
||||
<p>You are responsible for the SonarQube servers, credentials, tokens and projects you connect to
|
||||
SonarDesk. SonarDesk accesses information made available by the permissions of the credentials you
|
||||
provide. It does not grant additional permissions on your SonarQube server.</p>
|
||||
<p>You are responsible for ensuring that you are authorised to access and process the projects and
|
||||
information you connect to SonarDesk.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>7. Acceptable use</h2>
|
||||
<p>You must not attempt to defeat or circumvent licensing controls, interfere with the SonarDesk
|
||||
service, gain unauthorised access to accounts or systems, distribute malware through the service,
|
||||
reverse engineer the service except where applicable law expressly permits it, or use SonarDesk in
|
||||
violation of applicable law or third-party rights.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>8. Software updates and service availability</h2>
|
||||
<p>We may update SonarDesk, the website and licensing service to improve security, compatibility,
|
||||
reliability or functionality. We may also discontinue obsolete versions where reasonably necessary.
|
||||
We aim to provide a reliable service but do not guarantee uninterrupted or error-free availability.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>9. Third-party services</h2>
|
||||
<p>SonarDesk works with third-party services including SonarQube and Paddle. Those services are
|
||||
operated independently and may have their own terms and policies. We are not responsible for changes,
|
||||
outages or restrictions imposed by third-party services outside our reasonable control.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>10. Consumer rights</h2>
|
||||
<p>Nothing in these terms excludes or restricts rights that cannot lawfully be excluded or restricted.
|
||||
If you are a consumer, this includes applicable rights relating to digital content and services under
|
||||
UK consumer law. Where mandatory law gives you stronger protection than these terms, the mandatory
|
||||
protection applies.</p>
|
||||
<p>Information about refunds, statutory remedies and withdrawal rights is set out in our
|
||||
<a href="{{ route('refund') }}">Refund Policy</a>.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>11. Liability</h2>
|
||||
<p>Nothing in these terms excludes or limits liability where doing so would be unlawful, including
|
||||
liability for death or personal injury caused by negligence, fraud or fraudulent misrepresentation.</p>
|
||||
<p>Subject to those protections, we are not responsible for indirect or consequential losses, loss
|
||||
caused by unauthorised or incorrect configuration, unavailable third-party systems, or events outside
|
||||
our reasonable control. If you use SonarDesk for business purposes, you are responsible for maintaining
|
||||
appropriate backups and operational safeguards.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>12. Suspension and termination</h2>
|
||||
<p>We may suspend or terminate access where reasonably necessary to address fraud, security threats,
|
||||
material breach of these terms, chargebacks, or an invalid or expired subscription. Where appropriate,
|
||||
we will give reasonable notice and an opportunity to resolve the issue.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>13. Changes to these terms</h2>
|
||||
<p>We may update these terms when the service, law or our commercial arrangements change. The current
|
||||
version will be published on this page with its revision date. Material changes affecting an existing
|
||||
subscription will be communicated where required by law.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>14. Privacy</h2>
|
||||
<p>Our processing of personal data is described in the
|
||||
<a href="{{ route('privacy') }}">Privacy Policy</a> and
|
||||
<a href="{{ route('cookies') }}">Cookie Policy</a>.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>15. Governing law</h2>
|
||||
<p>These terms are governed by the laws applicable in {{ $legal['country'] }}, subject to any mandatory
|
||||
consumer protections and rights you have under the law of the country in which you live.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>16. Contact</h2>
|
||||
<p>These terms are provided by <strong>{{ $legal['controller_name'] }}</strong> in
|
||||
{{ $legal['country'] }}. For licensing, billing or contractual questions, contact
|
||||
<a href="mailto:{{ $legal['support_email'] }}">{{ $legal['support_email'] }}</a> or use
|
||||
<a href="{{ route('support') }}">SonarDesk Support</a>.</p>
|
||||
</section>
|
||||
</article>
|
||||
@endsection
|
||||
|
||||
@@ -27,6 +27,7 @@ Route::get('/support', [SupportController::class, 'create'])->name('support');
|
||||
Route::post('/support', [SupportController::class, 'store'])->middleware('throttle:5,10')->name('support.store');
|
||||
Route::view('/privacy', 'legal.privacy')->name('privacy');
|
||||
Route::view('/terms', 'legal.terms')->name('terms');
|
||||
Route::view('/refund-policy', 'legal.refund')->name('refund');
|
||||
Route::view('/cookies', 'legal.cookies')->name('cookies');
|
||||
Route::middleware('guest')->group(function () {
|
||||
Route::get('/login', [AuthenticatedSessionController::class, 'create'])->name('login');
|
||||
|
||||
Executable
+257
@@ -0,0 +1,257 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
PADDLE_API_URL="https://api.paddle.com"
|
||||
|
||||
: "${PADDLE_API_KEY:?PADDLE_API_KEY is not set}"
|
||||
: "${PADDLE_PRODUCT_ID:?PADDLE_PRODUCT_ID is not set}"
|
||||
|
||||
command -v curl >/dev/null || {
|
||||
echo "ERROR: curl is required."
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v jq >/dev/null || {
|
||||
echo "ERROR: jq is required."
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ "$PADDLE_API_KEY" != pdl_live_apikey_* ]]; then
|
||||
echo "ERROR: This script requires a Paddle LIVE API key."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$PADDLE_PRODUCT_ID" != pro_* ]]; then
|
||||
echo "ERROR: Invalid Paddle product ID."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "============================================"
|
||||
echo " SonarDesk Paddle Production Price Setup"
|
||||
echo "============================================"
|
||||
echo
|
||||
echo "Product: $PADDLE_PRODUCT_ID"
|
||||
echo
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Verify product
|
||||
# ------------------------------------------------------------
|
||||
|
||||
PRODUCT_RESPONSE="$(
|
||||
curl -fsS \
|
||||
-H "Authorization: Bearer $PADDLE_API_KEY" \
|
||||
-H "Accept: application/json" \
|
||||
"$PADDLE_API_URL/products/$PADDLE_PRODUCT_ID"
|
||||
)"
|
||||
|
||||
PRODUCT_NAME="$(echo "$PRODUCT_RESPONSE" | jq -r '.data.name // empty')"
|
||||
|
||||
if [[ -z "$PRODUCT_NAME" ]]; then
|
||||
echo "ERROR: Could not retrieve Paddle product."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Found product: $PRODUCT_NAME"
|
||||
echo
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Existing prices
|
||||
# ------------------------------------------------------------
|
||||
|
||||
get_prices() {
|
||||
curl -fsS \
|
||||
-H "Authorization: Bearer $PADDLE_API_KEY" \
|
||||
-H "Accept: application/json" \
|
||||
"$PADDLE_API_URL/prices?product_id=$PADDLE_PRODUCT_ID&status=active&per_page=100"
|
||||
}
|
||||
|
||||
find_price_by_description() {
|
||||
local description="$1"
|
||||
|
||||
get_prices |
|
||||
jq -r \
|
||||
--arg description "$description" \
|
||||
'.data[]
|
||||
| select(.description == $description)
|
||||
| .id' |
|
||||
head -n 1
|
||||
}
|
||||
|
||||
create_price() {
|
||||
local description="$1"
|
||||
local amount="$2"
|
||||
local interval="$3"
|
||||
|
||||
echo "Creating: $description"
|
||||
|
||||
curl -fsS \
|
||||
-X POST \
|
||||
"$PADDLE_API_URL/prices" \
|
||||
-H "Authorization: Bearer $PADDLE_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Accept: application/json" \
|
||||
--data "$(
|
||||
jq -n \
|
||||
--arg product "$PADDLE_PRODUCT_ID" \
|
||||
--arg description "$description" \
|
||||
--arg amount "$amount" \
|
||||
--arg interval "$interval" \
|
||||
'{
|
||||
product_id: $product,
|
||||
description: $description,
|
||||
unit_price: {
|
||||
amount: $amount,
|
||||
currency_code: "GBP"
|
||||
},
|
||||
billing_cycle: {
|
||||
interval: $interval,
|
||||
frequency: 1
|
||||
},
|
||||
quantity: {
|
||||
minimum: 1,
|
||||
maximum: 1
|
||||
},
|
||||
tax_mode: "account_setting"
|
||||
}'
|
||||
)" |
|
||||
jq -r '.data.id'
|
||||
}
|
||||
|
||||
update_price_amount() {
|
||||
local price_id="$1"
|
||||
local description="$2"
|
||||
local amount="$3"
|
||||
|
||||
echo "Updating: $description ($price_id)"
|
||||
|
||||
curl -fsS \
|
||||
-X PATCH \
|
||||
"$PADDLE_API_URL/prices/$price_id" \
|
||||
-H "Authorization: Bearer $PADDLE_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Accept: application/json" \
|
||||
--data "$(
|
||||
jq -n \
|
||||
--arg description "$description" \
|
||||
--arg amount "$amount" \
|
||||
'{
|
||||
description: $description,
|
||||
unit_price: {
|
||||
amount: $amount,
|
||||
currency_code: "GBP"
|
||||
}
|
||||
}'
|
||||
)" >/dev/null
|
||||
}
|
||||
|
||||
ensure_price() {
|
||||
local description="$1"
|
||||
local amount="$2"
|
||||
local interval="$3"
|
||||
|
||||
local existing
|
||||
existing="$(find_price_by_description "$description")"
|
||||
|
||||
if [[ -n "$existing" ]]; then
|
||||
local current_amount
|
||||
current_amount="$(
|
||||
get_prices |
|
||||
jq -r \
|
||||
--arg id "$existing" \
|
||||
'.data[]
|
||||
| select(.id == $id)
|
||||
| .unit_price.amount'
|
||||
)"
|
||||
|
||||
if [[ "$current_amount" != "$amount" ]]; then
|
||||
echo "Existing price $existing has amount $current_amount."
|
||||
echo "Required amount is $amount."
|
||||
update_price_amount \
|
||||
"$existing" \
|
||||
"$description" \
|
||||
"$amount"
|
||||
else
|
||||
echo "Exists: $description ($existing)"
|
||||
fi
|
||||
|
||||
echo "$existing"
|
||||
return
|
||||
fi
|
||||
|
||||
create_price \
|
||||
"$description" \
|
||||
"$amount" \
|
||||
"$interval"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# SonarDesk production prices
|
||||
#
|
||||
# Paddle amounts are in pennies:
|
||||
#
|
||||
# £2.99 = 299
|
||||
# £24.99 = 2499
|
||||
# £4.99 = 499
|
||||
# £44.99 = 4499
|
||||
# ------------------------------------------------------------
|
||||
|
||||
echo "Configuring prices..."
|
||||
echo
|
||||
|
||||
PERSONAL_MONTHLY="$(
|
||||
ensure_price \
|
||||
"SonarDesk Personal Monthly" \
|
||||
"299" \
|
||||
"month" |
|
||||
tail -n 1
|
||||
)"
|
||||
|
||||
PERSONAL_ANNUAL="$(
|
||||
ensure_price \
|
||||
"SonarDesk Personal Annual" \
|
||||
"2499" \
|
||||
"year" |
|
||||
tail -n 1
|
||||
)"
|
||||
|
||||
PROFESSIONAL_MONTHLY="$(
|
||||
ensure_price \
|
||||
"SonarDesk Professional Monthly" \
|
||||
"499" \
|
||||
"month" |
|
||||
tail -n 1
|
||||
)"
|
||||
|
||||
PROFESSIONAL_ANNUAL="$(
|
||||
ensure_price \
|
||||
"SonarDesk Professional Annual" \
|
||||
"4499" \
|
||||
"year" |
|
||||
tail -n 1
|
||||
)"
|
||||
|
||||
echo
|
||||
echo "============================================"
|
||||
echo " Paddle Production Prices"
|
||||
echo "============================================"
|
||||
echo
|
||||
echo "Personal Monthly: $PERSONAL_MONTHLY"
|
||||
echo "Personal Annual: $PERSONAL_ANNUAL"
|
||||
echo "Professional Monthly: $PROFESSIONAL_MONTHLY"
|
||||
echo "Professional Annual: $PROFESSIONAL_ANNUAL"
|
||||
echo
|
||||
echo "Add these to the production .env:"
|
||||
echo
|
||||
echo "PADDLE_ENVIRONMENT=production"
|
||||
echo "PADDLE_API_URL=https://api.paddle.com"
|
||||
echo "PADDLE_PRODUCT_ID=$PADDLE_PRODUCT_ID"
|
||||
echo "PADDLE_PERSONAL_MONTHLY_PRICE_ID=$PERSONAL_MONTHLY"
|
||||
echo "PADDLE_PERSONAL_ANNUAL_PRICE_ID=$PERSONAL_ANNUAL"
|
||||
echo "PADDLE_PROFESSIONAL_MONTHLY_PRICE_ID=$PROFESSIONAL_MONTHLY"
|
||||
echo "PADDLE_PROFESSIONAL_ANNUAL_PRICE_ID=$PROFESSIONAL_ANNUAL"
|
||||
echo
|
||||
echo "IMPORTANT:"
|
||||
echo "PADDLE_API_KEY and PADDLE_CLIENT_SIDE_TOKEN must also be LIVE values."
|
||||
echo "PADDLE_WEBHOOK_SECRET must come from the LIVE webhook destination."
|
||||
echo
|
||||
Executable
+114
@@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ENV_FILE="${1:-.env}"
|
||||
|
||||
if [[ ! -f "$ENV_FILE" ]]; then
|
||||
echo "ERROR: Cannot find $ENV_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Load only the Paddle values we need.
|
||||
get_env() {
|
||||
grep -E "^${1}=" "$ENV_FILE" | head -1 | cut -d= -f2-
|
||||
}
|
||||
|
||||
PADDLE_ENVIRONMENT="$(get_env PADDLE_ENVIRONMENT)"
|
||||
PADDLE_API_URL="$(get_env PADDLE_API_URL)"
|
||||
PADDLE_API_KEY="$(get_env PADDLE_API_KEY)"
|
||||
|
||||
PERSONAL_MONTHLY="$(get_env PADDLE_PERSONAL_MONTHLY_PRICE_ID)"
|
||||
PERSONAL_ANNUAL="$(get_env PADDLE_PERSONAL_ANNUAL_PRICE_ID)"
|
||||
PRO_MONTHLY="$(get_env PADDLE_PROFESSIONAL_MONTHLY_PRICE_ID)"
|
||||
PRO_ANNUAL="$(get_env PADDLE_PROFESSIONAL_ANNUAL_PRICE_ID)"
|
||||
|
||||
if [[ -z "$PADDLE_API_KEY" ]]; then
|
||||
echo "ERROR: PADDLE_API_KEY is missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Paddle environment: $PADDLE_ENVIRONMENT"
|
||||
echo "API URL: $PADDLE_API_URL"
|
||||
echo
|
||||
echo "Prices to update:"
|
||||
echo " Personal monthly -> £4.99"
|
||||
echo " Personal annual -> £39.99"
|
||||
echo " Professional monthly -> £8.99"
|
||||
echo " Professional annual -> £79.99"
|
||||
echo
|
||||
|
||||
if [[ "$PADDLE_ENVIRONMENT" == "production" ]]; then
|
||||
echo "WARNING: THIS IS THE LIVE PADDLE ACCOUNT."
|
||||
printf "Type LIVE to continue: "
|
||||
read -r confirmation
|
||||
|
||||
if [[ "$confirmation" != "LIVE" ]]; then
|
||||
echo "Cancelled."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
printf "Type YES to update the sandbox prices: "
|
||||
read -r confirmation
|
||||
|
||||
if [[ "$confirmation" != "YES" ]]; then
|
||||
echo "Cancelled."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
update_price() {
|
||||
local id="$1"
|
||||
local amount="$2"
|
||||
local description="$3"
|
||||
|
||||
if [[ -z "$id" ]]; then
|
||||
echo "ERROR: Missing price ID for $description"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Updating $description ($id)..."
|
||||
|
||||
response="$(
|
||||
curl --silent --show-error --fail-with-body \
|
||||
--request PATCH \
|
||||
"${PADDLE_API_URL}/prices/${id}" \
|
||||
--header "Authorization: Bearer ${PADDLE_API_KEY}" \
|
||||
--header "Content-Type: application/json" \
|
||||
--data "{
|
||||
\"unit_price\": {
|
||||
\"amount\": \"${amount}\",
|
||||
\"currency_code\": \"GBP\"
|
||||
}
|
||||
}"
|
||||
)"
|
||||
|
||||
if command -v jq >/dev/null 2>&1; then
|
||||
echo "$response" | jq '{
|
||||
id: .data.id,
|
||||
description: .data.description,
|
||||
price: .data.unit_price,
|
||||
billing_cycle: .data.billing_cycle,
|
||||
status: .data.status
|
||||
}'
|
||||
else
|
||||
echo "$response"
|
||||
fi
|
||||
}
|
||||
|
||||
# Paddle amounts are in pennies:
|
||||
# £4.99 = 499
|
||||
# £39.99 = 3999
|
||||
# £8.99 = 899
|
||||
# £79.99 = 7999
|
||||
|
||||
update_price "$PERSONAL_MONTHLY" 499 "Personal Monthly"
|
||||
update_price "$PERSONAL_ANNUAL" 3999 "Personal Annual"
|
||||
update_price "$PRO_MONTHLY" 899 "Professional Monthly"
|
||||
update_price "$PRO_ANNUAL" 7999 "Professional Annual"
|
||||
|
||||
echo
|
||||
echo "----------------------------------------"
|
||||
echo "All Paddle prices updated successfully."
|
||||
echo "----------------------------------------"
|
||||
Reference in New Issue
Block a user