[feat] Add stripe payments (#3184)

This commit is contained in:
Vlad Stan
2025-06-30 13:13:13 +03:00
committed by GitHub
parent f4e7d0c70c
commit aba6e4cd87
51 changed files with 2014 additions and 175 deletions
+10 -10
View File
File diff suppressed because one or more lines are too long
+43 -2
View File
@@ -22,6 +22,7 @@ window.localisation.en = {
active_channels: 'Active Channels',
connect_peer: 'Connect Peer',
connect: 'Connect',
reconnect: 'Reconnect',
open_channel: 'Open Channel',
open: 'Open',
close_channel: 'Close Channel',
@@ -60,6 +61,7 @@ window.localisation.en = {
rename_wallet: 'Rename wallet',
update_name: 'Update name',
fiat_tracking: 'Fiat tracking',
fiat_providers: 'Fiat providers',
currency: 'Currency',
update_currency: 'Update currency',
press_to_claim: 'Press to claim bitcoin',
@@ -141,6 +143,7 @@ window.localisation.en = {
uninstall: 'Uninstall',
drop_db: 'Remove Data',
enable: 'Enable',
enabled: 'Enabled',
pay_to_enable: 'Pay To Enable',
enable_extension_details: 'Enable extension for current user',
disable: 'Disable',
@@ -171,12 +174,33 @@ window.localisation.en = {
payment_hash: 'Payment Hash',
fee: 'Fee',
amount: 'Amount',
amount_limits: 'Amount Limits',
amount_sats: 'Amount (sats)',
faucest_wallet: 'Faucet Wallet',
faucest_wallet_desc_1:
'Each time a payment is confirmed by the {provider} provider funds will be subtracted from this wallet.',
faucest_wallet_desc_2:
'This helps monitor all {provider} payments and their status.',
faucest_wallet_desc_3:
'This wallet must be topped up with the amount of sats that the admin is willing to offer in exchange for the fiat currency.',
faucest_wallet_desc_4:
'If this wallet is configured, but is empty, the {provider} payments will not be processed.',
faucest_wallet_desc_5:
'This wallet can eventually get to a negative balance if parallel fiat payments are made.',
faucest_wallet_id: 'Faucet Wallet ID (optional)',
faucest_wallet_id_hint:
'Wallet ID to use for the faucet. It will be used to send the funds to the user.',
tag: 'Tag',
unit: 'Unit',
description: 'Description',
expiry: 'Expiry',
webhook: 'Webhook',
webhook_url: 'Webhook URL',
webhook_url_hint:
'Webhook URL to send the payment details to. It will be called when the payment is completed.',
webhook_events_list: 'The following events must be supported by the webhook:',
webhook_stripe_description:
'One the stripe side you must configure a webhook with a URL that points to your LNbits server.',
payment_proof: 'Payment Proof',
update: 'Update',
update_available: 'Update {version} available!',
@@ -357,6 +381,8 @@ window.localisation.en = {
back: 'Back',
logout: 'Logout',
look_and_feel: 'Look and Feel',
endpoint: 'Endpoint',
api: 'API',
api_token: 'API Token',
api_tokens: 'API Tokens',
access_control_list: 'Access Control List',
@@ -374,6 +400,8 @@ window.localisation.en = {
extension_paid_sats: 'You have already paid {paid_sats} sats.',
release_details_error: 'Cannot get the release details.',
pay_from_wallet: 'Pay from Wallet',
pay_with: 'Pay with {provider}',
select_payment_provider: 'Select payment provider',
wallet_required: 'Wallet *',
show_qr: 'Show QR',
retry_install: 'Retry Install',
@@ -386,6 +414,9 @@ window.localisation.en = {
'The {name} extension requires a payment of minimum {amount} sats to enable.',
hide_empty_wallets: 'Hide empty wallets',
recheck: 'Recheck',
check: 'Check',
check_connection: 'Check Connection',
check_webhook: 'Check Webhook',
contributors: 'Contributors',
license: 'License',
reset_key: 'Reset Key',
@@ -492,7 +523,9 @@ window.localisation.en = {
allowed_currencies_hint: 'Limit the number of available fiat currencies',
default_account_currency: 'Default Account Currency',
default_account_currency_hint: 'Default currency for accounting',
min_incoming_payment_amount: 'Min Incoming Payment Amount',
min_incoming_payment_amount_desc:
'Minimum amount allowed for generating an invoice',
max_incoming_payment_amount: 'Max Incoming Payment Amount',
max_incoming_payment_amount_desc:
'Maximum amount allowed for generating an invoice',
@@ -554,6 +587,7 @@ window.localisation.en = {
admin_users_label: 'User ID',
allowed_users: 'Allowed Users',
allowed_users_hint: 'Only these users can use LNbits',
allowed_users_hint_feature: 'Only these users can use {feature}',
allowed_users_label: 'User ID',
allow_creation_user: 'Allow creation of new users',
allow_creation_user_desc: 'Allow creation of new users on the index page',
@@ -588,5 +622,12 @@ window.localisation.en = {
view_column: 'View wallets as rows',
filter_payments: 'Filter payments',
filter_date: 'Filter by date',
websocket_example: 'Websocket example'
websocket_example: 'Websocket example',
secret_key: 'Secret Key',
signing_secret: 'Signing Secret',
signing_secret_hint:
'Signing secret for the webhook. Messages will be signed with this secret.',
callback_success_url: 'Callback Success URL',
callback_success_url_hint:
'The user will be redirected to this URL after the payment is successful'
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+32
View File
@@ -54,6 +54,7 @@ window.AdminPageLogic = {
chartReady: false,
formAddAdmin: '',
formAddUser: '',
formAddStripeUser: '',
hideInputToggle: true,
formAddExtensionsManifest: '',
nostrNotificationIdentifier: '',
@@ -187,6 +188,23 @@ window.AdminPageLogic = {
let allowed_users = this.formData.lnbits_allowed_users
this.formData.lnbits_allowed_users = allowed_users.filter(u => u !== user)
},
addStripeAllowedUser() {
const addUser = this.formAddStripeUser || ''
if (
addUser.length &&
!this.formData.stripe_limits.allowed_users.includes(addUser)
) {
this.formData.stripe_limits.allowed_users = [
...this.formData.stripe_limits.allowed_users,
addUser
]
this.formAddStripeUser = ''
}
},
removeStripeAllowedUser(user) {
this.formData.stripe_limits.allowed_users =
this.formData.stripe_limits.allowed_users.filter(u => u !== user)
},
addIncludePath() {
if (!this.formAddIncludePath) {
return
@@ -613,6 +631,20 @@ window.AdminPageLogic = {
.catch(LNbits.utils.notifyApiError)
})
},
checkFiatProvider(providerName) {
LNbits.api
.request('PUT', `/api/v1/fiat/check/${providerName}`)
.then(response => {
response
const data = response.data
Quasar.Notify.create({
type: data.success ? 'positive' : 'warning',
message: data.message,
icon: null
})
})
.catch(LNbits.utils.notifyApiError)
},
downloadBackup() {
window.open('/admin/api/v1/backup', '_blank')
},
+5 -2
View File
@@ -19,14 +19,16 @@ window.LNbits = {
amount,
memo,
unit = 'sat',
lnurlCallback = null
lnurlCallback = null,
fiatProvider = null
) {
return this.request('post', '/api/v1/payments', wallet.inkey, {
out: false,
amount: amount,
memo: memo,
lnurl_callback: lnurlCallback,
unit: unit
unit: unit,
fiat_provider: fiatProvider
})
},
payInvoice(wallet, bolt11) {
@@ -197,6 +199,7 @@ window.LNbits = {
email: data.email,
extensions: data.extensions,
wallets: data.wallets,
fiat_providers: data.fiat_providers || [],
super_user: data.super_user,
extra: data.extra ?? {}
}
+8 -1
View File
@@ -35,6 +35,7 @@ window.WalletPageLogic = {
lnurl: null,
units: ['sat'],
unit: 'sat',
fiatProvider: '',
data: {
amount: null,
memo: ''
@@ -253,12 +254,15 @@ window.WalletPageLogic = {
this.receive.data.amount,
this.receive.data.memo,
this.receive.unit,
this.receive.lnurl && this.receive.lnurl.callback
this.receive.lnurl && this.receive.lnurl.callback,
this.receive.fiatProvider
)
.then(response => {
this.g.updatePayments = !this.g.updatePayments
this.receive.status = 'success'
this.receive.paymentReq = response.data.bolt11
this.receive.fiatPaymentReq =
response.data.extra?.fiat_payment_request
this.receive.amountMsat = response.data.amount
this.receive.paymentHash = response.data.payment_hash
if (!this.receive.lnurl) {
@@ -820,6 +824,9 @@ window.WalletPageLogic = {
},
swapBalancePriority() {
this.isFiatPriority = !this.isFiatPriority
this.receive.unit = this.isFiatPriority
? this.g.wallet.currency || 'sat'
: 'sat'
this.$q.localStorage.setItem('lnbits.isFiatPriority', this.isFiatPriority)
},
handleFiatTracking() {