Skip to content

[feat] Stripe subscription#3369

Merged
arcbtc merged 15 commits into
devfrom
stripe_subscription
Oct 16, 2025
Merged

[feat] Stripe subscription#3369
arcbtc merged 15 commits into
devfrom
stripe_subscription

Conversation

@motorina0
Copy link
Copy Markdown
Collaborator

@motorina0 motorina0 commented Oct 1, 2025

Summary

Users can now create a fiat subscription.
Each time a successful recurring (subscription) payment is made on the Fiat Provider side (here Stripe) an incoming payment will be generate on the user's LNbits wallet.

Flow:

saas1

Subscription Request:

{
  "subscription_id": "123",    // id specific to the fiat provider (previously configured)
  "quantity": 0,                      // number of items to be purchased (eg 3 x monthly subscription)
  "payment_options": {
    "memo": "string",             // all generated payments on the LNbits side will have this value in the memo (plus some payment data)
    "wallet_id": "string",        // the wallet where the payment will be created
    "tag": "string",                 // set a tag on the payment (optional, admin only)
    "extra": {},                        // append to the payment extra data (optional, admin only)
    "success_url": "https://my.lnbits.com"
  }
}

Example:

curl --location 'http://localhost:5000/api/v1/fiat/stripe/subscription' \
--header 'Authorization: Bearer eyJh...' \
--header 'Content-Type: application/json' \
--data '{
    "subscription_id": "price_1SCy7zPJINqKvy4Mxi5doWne",
    "quantity": 1,
    "payment_options": {
        "tag": "lnurlp",
        "wallet_id": "81c061539cb04af59472e57782842971",
        "memo": "SaaS instance 1234",
        "extra": {
            "link": "cbuWW7"
        }
    }
}'
{
    "ok": true,
    "checkout_session_url": "https://checkout.stripe.com/c/pay/cs_test_a1RTs...",
    "error_message": null
}
image

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 1, 2025

Codecov Report

❌ Patch coverage is 35.60976% with 132 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.89%. Comparing base (3e72788) to head (0c15a61).
⚠️ Report is 14 commits behind head on dev.

Files with missing lines Patch % Lines
lnbits/fiat/stripe.py 19.71% 57 Missing ⚠️
lnbits/core/views/callback_api.py 16.94% 49 Missing ⚠️
lnbits/core/views/fiat_api.py 29.16% 17 Missing ⚠️
lnbits/core/services/fiat_providers.py 75.00% 7 Missing ⚠️
lnbits/fiat/base.py 91.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #3369      +/-   ##
==========================================
- Coverage   56.12%   55.89%   -0.24%     
==========================================
  Files         116      116              
  Lines       15114    15271     +157     
==========================================
+ Hits         8483     8535      +52     
- Misses       6631     6736     +105     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@motorina0 motorina0 marked this pull request as ready for review October 1, 2025 09:47
Comment thread lnbits/core/views/callback_api.py
@motorina0 motorina0 force-pushed the stripe_subscription branch from 7494e3a to 8411c3e Compare October 6, 2025 15:21
@motorina0 motorina0 force-pushed the stripe_subscription branch from 8411c3e to 215caca Compare October 8, 2025 09:02
@dni dni self-requested a review October 13, 2025 09:28
@arcbtc arcbtc merged commit bf06def into dev Oct 16, 2025
44 checks passed
@arcbtc arcbtc deleted the stripe_subscription branch October 16, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants