WordPress developer in Stockholm

Swish and Klarna in WooCommerce for Swedish shops: payment request fields, callbacks, statuses and Klarna capture rules from the official developer documentation.

WordPress developer

My place in the WordPress community

  • I have had a wordpress.org account since 2006.
  • I contributed to WordPress core for versions 7.0 and 7.1.
  • I maintain 30 plugins on wordpress.org.
  • I organise and speak at WordCamps.
  • I have attended every WordCamp Europe from 2017 to 2026.
  • Local WordPress meetup: WordPress Stockholm

My WordPress.org profile

A Swedish webshop is judged at the payment step, and two methods carry most of it: Swish and Klarna. This page is about what the two payment systems say in their own developer documentation and how that turns into WooCommerce work. I am Mariusz Szatkowski, a one-person studio in Gdynia, Poland, and everything I do runs remotely and in writing.

#Swish: what a payment request contains

The Swish developer documentation describes a payment request as a transaction sent from the merchant to the Swish system. A request is created with a PUT to /swish-cpcapi/api/v2/paymentrequests/{instructionUUID}, where the identifier is 32 hexadecimal characters that you generate. The body has four required fields: the merchant’s Swish number (payeeAlias), the amount, the currency and a callback URL.

The details that matter in a shop:

  • The currency value can only be SEK.
  • callbackUrl has to use HTTPS. Without it the request is rejected with error RP03.
  • payeePaymentReference is the merchant’s own reference, such as an order id, limited to letters, digits and hyphens, 1 to 35 characters long.
  • message is up to 50 characters, so the product description in it must be short.
  • payerAlias is the customer’s phone number in the form country code plus number without the leading zero, for example 46712345678.
  • callbackIdentifier is optional, 32 to 36 alphanumeric characters, returned unchanged as an HTTP header in the callback. The documentation recommends generating a new UUID for every request and using it to check that the callback really came from Swish.

A successful request returns 201 with a Location header for retrieving the status. In the mobile case it also returns a PaymentRequestToken header. The merchant authenticates with a client certificate: a 401 means a certificate problem or a Swish number that is not enrolled, and a 403 means the payeeAlias in the request is not the merchant’s own number.

#From callback to WooCommerce order status

The payment status has four values: PAID, DECLINED, ERROR and CANCELLED. A retrieve request returns the full payment request with its status and, once paid, the bank’s paymentReference.

That gives a short design for the WooCommerce side, which I write down in the scope before building:

  1. Create the WooCommerce order first and use its number as payeePaymentReference, after checking the number format fits the 35 character rule.
  2. Generate a fresh callbackIdentifier per attempt, store it on the order and compare it when the callback arrives.
  3. Treat the callback as a trigger, then call retrieve and only mark the order paid when the status is PAID.
  4. Make the handler safe to run twice, so a repeated callback does not create a second payment note or a second stock change.
  5. Map DECLINED, ERROR and CANCELLED to a visible order note and a retry path for the customer.

Cancellation has a limit worth knowing. Until the payer signs with BankID, the merchant can retract the request with a PATCH that sets the status to cancelled. Once it is signed or finished, the cancel call returns error RP07. Two error codes explain common support cases: RP06 means a request already exists for that payer in the e-commerce flow, and RP09 means the identifier was already used.

Swish provides separate test environments, the Merchant Swish Simulator and a sandbox, with test certificates. I build and test against those before any real number is connected.

#Klarna in WooCommerce: what the plugin documentation states

Klarna’s documentation for WooCommerce lists prerequisites that I check first. The published plugin requires PHP 8.0 and WordPress 6.7, and WooCommerce must be installed. API credentials come from the Klarna Partner Portal, and test mode works only with an account in Klarna’s test environment.

Facts from the same pages that change how a store is set up:

  • Payments and order management are in one plugin from version 4.3.0.
  • Since version 4.11.0 (22 June 2026), a Combine payment methods setting can show one Pay with Klarna method, with the customer choosing a Klarna method inside the widget.
  • Since version 4.12.2 (17 August 2026), capture runs when the WooCommerce order reaches the status you select in Capture order status. The default is still Completed.
  • Only full capture is supported. Partial and full refunds are.
  • Express Checkout comes in a one-step and a two-step form, and one-step needs a webhook.
  • Klarna can also be enabled through plugins from WooPayments, Stripe, Paytrail, Mollie, Kustom and Airwallex, and the Klarna plugin can still be used for its other features.

For a Stockholm shop, the capture rule is the one with consequences. If the warehouse ships in two parcels and the order reaches Completed only after the second, the payment is captured late. If you set an earlier status, the customer is charged for goods not yet sent. I write this rule into the scope, and you approve it before launch.

#Checklist before a Swedish payment setup goes live

ItemSwishKlarna
CredentialsMerchant Swish number and certificatePartner Portal API credentials
Test pathSimulator or sandbox, test certificateTest environment account
CurrencySEK onlySet in the Klarna merchant setup
ConfirmationCallback, then retrievePlugin order management
Order linkOrder number in the payment referenceOrder id handled by the plugin
Failure pathsDeclined, error, cancelled, timeoutCancel, refund, no partial capture
DuplicatesIdempotent callback handlerCheck capture status before retrying

#Consumer law on the same checkout

The 14-day withdrawal rule for distance contracts is already covered on my WooCommerce page for Stockholm, with the sections of lag (2005:59). Payment status and refund status have to agree with that process, so the refund step in WooCommerce is tested together with the payment gateway, not separately.

#Personal data and IMY

IMY is the Swedish authority for data protection. Its page for organisations says that data controllers must report certain personal data breaches to IMY. A shop that takes Swish or Klarna holds names, addresses and order history, so logs matter after an incident.

When I receive access to personal data we put a written Art. 28 GDPR processor arrangement in place first. I work alone and do not subcontract development. Fonts are self-hosted where the design allows; analytics stay behind the consent banner.

#Staging before go-live

Theme, plugin, PHP and payment changes run on a copy first. I walk the home page, product page, cart, checkout with Swish or Klarna in test mode, and a refund path. Without written sign-off on that copy I do not go live. That keeps a failed experiment off production and off Stockholm orders.

#How a payment project runs

You send a short written description: the shop address, which of Swish and Klarna are live or planned, the hosting and whether a staging copy exists. I reply with questions in writing, then a written scope with assumptions and exclusions. I build on staging, send each milestone with notes, and you accept in writing. I hand over documentation for the next developer. Related work is on the WordPress developer page and the WooCommerce developer page.

I design the views, or you provide your own design. I do not offer calls or meetings.

#Send me the shop

Write through the contact page with the shop URL, the payment methods you use and what goes wrong at checkout. You get a first written estimate at no charge. I reply within 24 hours on working days (CET).

Stockholm City Hall seen from Riddarholmen

Photo: Arild Vågen, CC BY-SA 3.0, Wikimedia Commons.

See also in Sweden

Need this service: WordPress developer in Stockholm?

Describe your project by e-mail. I reply within 24 hours.

Describe your project

Latest WordPress developer articles

Sep 14, 2017

WordPress 4.9 to Gutenberg: how WordPress changed

WordPress 4.9 was "the calm before the storm." We analyze this pivotal moment in WP history that prepared the ground for the block editor. What changed since? How did the ecosystem evolve?

Oct 26, 2014

Best free WordPress plugins in 2026

Compare the best WordPress plugins in 2026 for security, SEO, cache, backups, and image optimisation, with practical advice on what to install and what to avoid.

Explore other WordPress services and knowledge base