Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
aisbf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
aisbf
Commits
1702a4f0
Commit
1702a4f0
authored
Apr 16, 2026
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(payments): add fiat payment API endpoints
parent
f316e47c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
0 deletions
+102
-0
main.py
main.py
+102
-0
No files found.
main.py
View file @
1702a4f0
...
@@ -1701,6 +1701,108 @@ async def add_crypto_payment_method(request: Request):
...
@@ -1701,6 +1701,108 @@ async def add_crypto_payment_method(request: Request):
return
result
return
result
# Fiat payment API endpoints
@
app
.
post
(
"/api/payment-methods/stripe"
)
async
def
add_stripe_payment_method
(
request
:
Request
):
"""Add Stripe payment method"""
current_user
=
await
get_current_user
(
request
)
body
=
await
request
.
json
()
result
=
await
payment_service
.
add_stripe_payment_method
(
current_user
[
'id'
],
body
[
'payment_method_token'
]
)
if
not
result
[
'success'
]:
raise
HTTPException
(
status_code
=
400
,
detail
=
result
[
'error'
])
return
result
@
app
.
post
(
"/api/payment-methods/paypal/initiate"
)
async
def
initiate_paypal_payment_method
(
request
:
Request
):
"""Initiate PayPal billing agreement"""
current_user
=
await
get_current_user
(
request
)
body
=
await
request
.
json
()
result
=
await
payment_service
.
initiate_paypal_billing_agreement
(
current_user
[
'id'
],
body
[
'return_url'
],
body
[
'cancel_url'
]
)
if
not
result
[
'success'
]:
raise
HTTPException
(
status_code
=
400
,
detail
=
result
[
'error'
])
return
result
@
app
.
post
(
"/api/payment-methods/paypal/complete"
)
async
def
complete_paypal_payment_method
(
request
:
Request
):
"""Complete PayPal billing agreement"""
current_user
=
await
get_current_user
(
request
)
body
=
await
request
.
json
()
result
=
await
payment_service
.
complete_paypal_billing_agreement
(
current_user
[
'id'
],
body
[
'token'
]
)
if
not
result
[
'success'
]:
raise
HTTPException
(
status_code
=
400
,
detail
=
result
[
'error'
])
return
result
@
app
.
get
(
"/api/payment-methods"
)
async
def
get_payment_methods
(
request
:
Request
):
"""Get user's payment methods"""
current_user
=
await
get_current_user
(
request
)
methods
=
await
payment_service
.
get_payment_methods
(
current_user
[
'id'
])
return
{
'payment_methods'
:
methods
}
@
app
.
delete
(
"/api/payment-methods/{payment_method_id}"
)
async
def
delete_payment_method
(
payment_method_id
:
int
,
request
:
Request
):
"""Delete payment method"""
current_user
=
await
get_current_user
(
request
)
result
=
await
payment_service
.
delete_payment_method
(
current_user
[
'id'
],
payment_method_id
)
if
not
result
[
'success'
]:
raise
HTTPException
(
status_code
=
400
,
detail
=
result
[
'error'
])
return
result
@
app
.
post
(
"/api/webhooks/stripe"
)
async
def
stripe_webhook
(
request
:
Request
):
"""Handle Stripe webhooks"""
stripe_signature
=
request
.
headers
.
get
(
"Stripe-Signature"
)
payload
=
await
request
.
body
()
result
=
await
payment_service
.
stripe_handler
.
handle_webhook
(
payload
,
stripe_signature
)
return
result
@
app
.
post
(
"/api/webhooks/paypal"
)
async
def
paypal_webhook
(
request
:
Request
):
"""Handle PayPal webhooks"""
payload
=
await
request
.
json
()
headers
=
dict
(
request
.
headers
)
result
=
await
payment_service
.
paypal_handler
.
handle_webhook
(
payload
,
headers
)
return
result
# Dashboard routes
# Dashboard routes
@
app
.
get
(
"/dashboard/analytics"
,
response_class
=
HTMLResponse
)
@
app
.
get
(
"/dashboard/analytics"
,
response_class
=
HTMLResponse
)
async
def
dashboard_analytics
(
async
def
dashboard_analytics
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment