Skip to content

Stripe integration

Create Stripe Payment Links, track status, and update Sales Invoice payment state via webhooks.

  • leekimerp/leekimerp/api/stripe.py — payment link API
  • leekimerp/leekimerp/api/stripe_webhook.py — webhook handling, payment entry creation helpers
sequenceDiagram
participant U as User
participant API as stripe.py
participant S as Stripe
participant WH as stripe_webhook.py
U->>API: create_payment_link
API->>S: Create link / session
S->>WH: payment_intent.succeeded / checkout.session.completed
WH->>WH: update_invoice_payment_status
FunctionRole
create_payment_linkCreate link for a sales invoice
get_payment_link_statusPoll status
payment_completedMark completion from client callback
cancel_payment_linkCancel link

stripe_webhook is the main entry; guest access — must validate Stripe signatures (see implementation). Helper functions update invoice status and may create Payment Entry.

  • Stripe settings per Company (get_stripe_settings, init_stripe_client)
  • API keys via site config or integration DocType (follow existing get_stripe_settings pattern)
  • Test helpers: test_webhook, debug_webhook_signature, stripe_webhook_test — disable or protect in production