Skip to content


Initialize payment

There are 2 supported payment procedures: - Checkout, where stripe provides the UI - "payment intent", the client must use stripe libraries to create its own UI.

You can call init payment endpoint only if the order is in status Placed or Payment. If the order is in status Payment you already have initialized a payment session. You will get the same response again, but you can't change the process - thus provided InitpaymentData is not taken into account. The URL of the payment endpoint:


Web checkout

Using the checkout process of Stripe takes only two steps:

  1. We create a session object on the backend and send it to Stripe. The session already contains all the required information for the payment.
  2. checkout: the client uses the session Id to redirect the customer to the payment page. otherwise: Client creates its own form and sends the payment to stripe

You must send callbacks URL as part of the payment initialization in the body of the request. Stripe will redirect to those URL after payment done:

    "createCheckoutSession" : true,
    "successUrl": "https://my.server/payment_ok",
    "errorUrl": "https://my.server/payment_failed"
Payment endpoint returns session id required to redirect to Stripe:
    "sessionId": "cs_test_Px7s8kZKHpYwRfrlETarNX1MQNwEBnixCmpaTzVfPl7stpBOfIaLGm6B",
    "clientSecret": "pi_5MDVV8EJdYTfvwwn0aqpMMMM_secret_5MDVVQLhbHPmtjty6x7sfSSSS",
    "paymentApiKey": "pk_test_BFvwJBVHlQbtxmftXMbF3gs00052KLsbTk",
    "result": true
  "validationMessages": []
You can use Stripe's API to redirect the customer. Here is a sample for JavaScript: where the api-key which is part of the response above must be used (in the sample: pk_test_BFvwJBVHlQbtxmftXMbF3gs00052KLsbTk)
var stripe = window['Stripe']('pk_test_BFvwJBVHlQbtxmftXMbF3gs00052KLsbTk');
        // Make the id field from the Checkout Session creation API response
        // available to this file, so you can provide it as parameter here
        // instead of the {{ CHECKOUT_SESSION_ID }} placeholder.
          sessionId: response.initPaymentData.sessionId
      }).then(function (result) {
         // do something
      }, function (result) {
        // using `result.error.message`.
        this.errorText = result.error.message;
More information:

Payment intents

This is the default.

    "createCheckoutSession" : false
Payment endpoint returns the client secret which is required to call the confirm CardPayment at Stripe:
    "initPaymentData": {
        "clientSecret": "pi_5MDVV8EJdYTfvwwn0aqpMMMM_secret_5MDVVQLhbHPmtjty6x7sfSSSS",
        "paymentApiKey": "pk_test_BFvwJBVHlQbtxmftXMbF3gs00052KLsbTk",
        "result": true
    "validationMessages": []


Stripe offers libraries that fit different ways of implementation depending on the client's preferences

In the sample app we used JavaScript and the Angular elements-wrapper

More information:


Once the payment successfully proceed payment the following things happen:

  1. the client gets redirected to the success page which must be implemented by the client → the client-side ordering process has finished
  2. stripe calls our server to confirm the payment → the fulfillment process gets started


We only reserve money of the customer's card. The charging of the cards occurs only if fulfillment has completed. On a partial fulfillment only the successfully processsed items are charged.

Stripe sends a checkout.session.completed event to the webhook we registered. This webhook is an endpoint by API which is not accessible to the public and is the same for all partners.

When the webhook is called, it does the following:

  1. Validate the message and signature from Stripe
  2. Save the payment id into the order and change the status to Paid. If this phase fails the webhook will return an error to Stripe. This will cause Stripe to repeat the webhook call.
  3. Start the fulfillment and delivery processes. If something fails in this process the webhook still returns an OK response to Stripe.

Last update: December 2, 2021 16:32:19