VulCode

Stripe integration: subscriptions, BLIK and KSeF

Subscriptions, one-off payments, BLIK and multi-seller platforms on Stripe, connected to the rest of your system. And because Stripe does not send invoices to KSeF, we do, from every paid payment.

Online payments
A company's subscription in the app's admin panel: past_due after a failed renewal, periods with Stripe invoices and KSeF invoice numbers, the rules after a failed payment and the Stripe events
The customer's billing in the app on a phone: the failed payment notice, the plan, the payment method, monthly BLIK and the invoices

Stripe or a Polish gateway

Both are good, for different ways of selling.

Stripe
A Polish gateway

How you sell

Stripe Billing runs subscriptions and usage billing. One-off purchases in a store are well served by a Polish gateway.

Stripe: closer to "subscriptions, plans, usage". A Polish gateway: closer to "one-off in a store".

Who you sell to

Stripe takes many currencies, with BLIK in złoty. A Polish gateway focuses on transfers from Polish banks.

Stripe: closer to "also abroad, in many currencies". A Polish gateway: closer to "mostly customers in Poland".

What the sales run on

Stripe Connect pays out to sellers or creators. A store on a platform the gateway has a plugin for usually needs only that plugin.

Stripe: closer to "a platform that pays out to sellers". A Polish gateway: closer to "a platform with the gateway's plugin".

Stripe subscription statuses

From the first invoice to cancellation. Access to the product follows the status, not a date in your database. We agree the length of the grace period and the customer messages with you.

The subscription status in StripeAccess in your app
incompleteAccess in your app: not on yet

Subscription created, the first invoice awaits payment. With automatic collection the customer has 23 hours.

activeAccess in your app: on

Paid. We turn on the plan's features and issue the invoice to KSeF.

past_dueAccess in your app: grace period

A renewal invoice is unpaid. We notify the customer and decide how long access stays.

unpaidAccess in your app: paused

Stripe stopped collection attempts. Access is paused until paid.

Other statuses
  • trialingbefore active, instead of incomplete

    A trial. After it ends and the payment succeeds, the subscription moves to active by itself.

  • incomplete_expiredfrom incomplete: 23 hours without payment

    The first invoice went unpaid in time. It is voided, a new subscription is needed.

  • canceledfrom active: cancellation

    Cancelled by the customer or by you. Access ends under your plan's rules.

From a Stripe payment to an invoice in KSeF

A Stripe invoice is not a Polish e-invoice. Your system builds and sends the structured FA(3) invoice.

Event
invoice.paid

A Stripe event with a Stripe-Signature, when a payment or a subscription invoice is paid.

  • Access in the app
    active status

    The plan's features on at once, without waiting for the invoice.

  • KSeF module
    FA(3), an XML file

    The invoice from the sales data in your database: customer, tax number, lines, rates.

  • KSeF
    KSeF number and UPO

    The invoice, sent in the background from a queue, with retries.

    Receives on a condition: Consumer invoices may go to KSeF voluntarily. We agree with you which payments go to the system.

  • Customer
    PDF with a QR code

    The invoice with its KSeF number.

  • Panel
    KSeF number on the payment

    Or a rejection with its reason, for a decision in the panel.

When one target does not receive

KSeF rejects the invoice

Access stays on, and the rejection with its reason goes to the panel.

KSeF does not answer

The invoice waits in the module's queue, which sends it in the background and retries.

The KSeF details

Sending, offline modes and QR codes are covered on our KSeF integration page.

A Stripe webhook that cannot be faked

Before an event changes anything, we check its signature and whether we have handled it already. The screen shows an hour of the event log.

An app panel: an hour of Stripe events, an invoice.paid event delivered twice, the Stripe-Signature header, the endpoint secret and the invoice in KSeF
  1. Stripe

    the invoice.paid event
  2. The signature on the raw body

    We check the signature on the raw body with the whsec secret. After parsing the JSON it would no longer match.

  3. A duplicate skipped

    Stripe allows duplicates, so we record the ids of handled events.

  4. The KSeF queue

    A paid invoice goes into the KSeF queue and turns on access. Both are idempotent.

  5. KSeF

    the KSeF number and UPO
  • Retries for three days

    In live mode Stripe retries events for up to three days. The endpoint has to cope with a backlog after an outage.

  • Event order

    The created field does not set the order. We take state from the object in Stripe, not from the last event.

Stripe Connect: three charge types

A multi-seller platform chooses who the transaction is with. Everything else follows from that.

Your multi-seller platform

Who is the customer's counterparty?

Direct charges

paid to the seller's account
When
  • Who the customer transacts with: the seller, often unaware of the platform
  • Several sellers in one payment: no
Fits

SaaS tools for businesses selling on their own

Destination charges

paid to the platform
When
  • Who the customer transacts with: the platform, for the seller's service
  • Several sellers in one payment: no
Fits

marketplaces with one seller per order

Separate charges and transfers

split later
When
  • Who the customer transacts with: the platform
  • Several sellers in one payment: yes
Fits

carts with products from several sellers

Common questions about Stripe

Answers about KSeF, BLIK in a subscription, marketplaces and failed renewals.

One-off sales or subscriptions?

Tell us what you sell through Stripe and whether invoices should go to KSeF. We will reply within an hour with questions and a quote.