Klarna Docs - Best Practices

Best Practices

This section includes tips for having the best developer expereince.

  1. When implementing Klarna Payments, make sure to add the library only once. Doing it otherwise might incur undesired side effects.
  2. Implement the klarnaAsyncCallback before importing the library. This way you ensure it will be invoked when the library is loaded.
  3. Only utilize the Klarna.Payments object after klarnaAsyncCallback has been invoked. This way you avoid it being undefined.
  4. Always invoke the authorize callback that you receive in the on_click. Don't invoke Klarna.Payments.authorize when using Express Checkout. They look the same, however, they are not.
  5. If you need to render more than one button, you can always invoke load again.