← All articlesWeb security

Server-side payment confirmation: why a success URL does not prove a purchase

The payment page returns a customer to the store, and the interface says “Paid.” What fact allowed the server to deliver the purchase? If it was a URL, a browser parameter or a local flag, the trust boundary is wrong. We will examine payment confirmation and fulfillment using a fictional digital store.

Why the success page is unreliable

Visiting a success page does not itself prove payment. Conversely, a customer can pay and close the browser before returning to the store. Fulfillment must therefore work independently of that visit. Stripe documents server-side payment notifications as the way to bridge this gap.

Separate two questions: what to show the customer now, and what access you can already grant. The screen can show that confirmation is pending. Permission to download a file or start a service follows a verified server-side change in the order state.

Verify the payment status on the server

The fulfillment function receives a payment identifier and checks its state through the provider’s API. With Stripe Checkout, this includes the payment_status of the retrieved Checkout Session. The function must handle repeated and concurrent calls correctly.

In your application, match the result to the stored order: the expected amount, currency, product and owner. Use the server-side catalog and order record. A browser parameter can help locate a record, but cannot replace this verification.

Handle delayed payment methods

With delayed payment methods, checkout completion and successful payment can happen at different times. Stripe reports a later successful payment through events such as checkout.session.async_payment_succeeded. Do not deliver a product simply because the customer finished entering payment details.

For the interface, keep pending confirmation, confirmed payment and completed fulfillment distinct. A delayed email then does not become a “payment not received” error, and a declined payment does not grant paid access.

Verify Stripe webhooks

Verify Stripe webhooks using the signature, raw request body and secret for the relevant environment and endpoint. Your handler must account for repeated delivery and events arriving out of order.

Acknowledging a notification and delivering a product are separate operations. First persist the processing result reliably, then perform delivery. An outbox is one engineering option: create an email job in the same transaction as the order change, and let a separate process deliver it. This is an example design, not a required Stripe format.

Protect the business workflow

OWASP recommends deriving security-relevant values on the server and explicitly controlling valid workflow transitions. A hidden form field, a JavaScript price and a client-side paid flag do not confer authority.

In the fictional store “Contour,” a template is released after PENDING → PAID. Check ownership on download too: one customer’s paid order must not unlock a file for another. Fulfill once through an atomic PAID → FULFILLED transition; a repeated event must not add another purchase.

A practical sandbox test matrix

Test this design in your own sandbox with test orders and cards. Define the expected order state and number of granted entitlements for each case. A successful HTTP response from a handler does not prove the business outcome is correct.

  • Open success before payment and change a local paid flag: no purchase is delivered.
  • Repeat an event and deliver two notifications concurrently: fulfillment remains unique.
  • Test an amount or currency mismatch: the order does not become paid.
  • Use another test account: someone else’s order grants no access.
  • Test delayed and declined payments and a closed browser: access follows the server-side result.

What to hand over to your developer

Keep a scenario table, actual order transitions and concrete tasks: where the signature is checked, where the amount and owner are matched, and which constraint prevents duplicate fulfillment. Also test recovery after a failure between payment and email: the customer should receive the product without another charge.

Start with a free audit of your own website to investigate reachable interfaces and risks. Supplement payment workflow assurance with tests in your own sandbox and a review of server-side code.

Sources and documentation

  1. Stripe: Fulfill Checkout orders
  2. Stripe: Receive and verify webhook events
  3. OWASP: Business Logic Security Cheat Sheet
CheckMyApp

Check your application’s security.

Enter your web application address and email. Get a free preliminary report and choose the depth of analysis.

Check for free