If your customer updates their shopping cart or if you make any changes to payment details, you have to update the payment session before creating an order.
When the customer modifies the content of their shopping cart before authorization, you can update a payment session in two steps.
POST
request to the {apiUrl}/payments/v1/sessions/{sessionID}
endpoint.oad()
call to make the changes visible to your customer.To update the payment session, send the updated order details in a POST
request to the {apiUrl}/payments/v1/sessions/{sessionID}
endpoint.
The sessionID
path parameter must match the session identifier (session_id
) you got in response to the create session request.
If the request is successful, the Klarna payments session is updated and you'll receive a 204 No content
response.
If your request contains errors, you'll receive an error response.
Here are examples of common errors with troubleshooting suggestions. You can use the value in correlation_id
to find entries related to the request under Logs in the Merchant portal.
Error code | Error message | Description |
---|---|---|
BAD_VALUE | Bad value: order_tax_amount | The tax details in the request aren't aligned with the rules for tax handling. |
BAD_VALUE | Bad value: order_lines | Some of the order line details don't follow our guidelines or violate API field restrictions. Refer to the Klarna payments API reference for details. |
BAD_VALUE | Bad value: purchase_currency | purchase_currency is incorrectly formatted or doesn’t match locale. This may occur if the customer updates their billing address, causing country to be updated. |
NOT_FOUND | Invalid session id | The session identifier specified in the path can't be found. Make sure the value in sessionID has the correct value and try again. |
To show the updated order details to your customer, send the updated details in a load()
call to Klarna.
Learn how to handle responses to the load() call.
If your customer updates the cart after the authorize()
call, you can share updates with Klarna in two ways:
authorize()
call with updated details to start a new risk and fraud assessment process.authorize()
call, you'll get a new authorization_token
. Make sure to use the new token to place an order.init()
, load()
, and authorize()
calls. A reauthorize()
call can handle this and any necessary customer communication in fullscreen modals.If you're integrating Klarna payments in a multistep checkout following our best practices guide, you don't need to call authorize()
as the authorization happens at the last step of the purchase journey.
We recommend you display modals launched during re-authorization as the customer might need to provide some input to complete the purchase.