Skip to main content

Update session

To update an existing session, refer back to the session you initiated with Create session. The fields totalOrderAmount, totalOrderVatAmount, and totalOrderAmountExclVat are essential for the update.

If you're adding new order lines, ensure you also update the corresponding total amounts as demonstrated in the following example. Be aware that adding new order lines will clear out any existing ones in the session, replacing them with the newly provided lines.

curl -X POST \
-H 'authorization: Bearer v4.public.eyJpc3MiOiJs...' \
-H 'content-type: application/json' \
-d '{
"orderLines": [
{
"description": "Coffee Machine X200",
"quantity": 10,
"reference": "111-222-333",
"totalAmount": 500000,
"totalVatAmount": 100000,
"type": "physical",
"unitDiscountAmount": 0,
"unitPrice": 50000,
"vat": 2500
},
{
"description": "Shipping fee",
"quantity": 1,
"reference": "444-555-666",
"totalAmount": 10000,
"totalVatAmount": 2000,
"type": "shippingFee",
"unitDiscountAmount": 0,
"unitPrice": 10000,
"vat": 2500
}
],
"totalOrderAmount": 510000,
"totalOrderAmountExclVat": 408000,
"totalOrderVatAmount": 102000
}'
https://api.sandbox.ledyer.com/v1/payment-sessions/:sessionId

Path parameters

sessionId

The session ID string that was obtained when the order session was created.

Request body

country

stringOptional

Country code such as SE, FI etc (ISO 3166-1 alpha-2).

currency

stringOptional

Example SEK, NOK (ISO 4217 alpha).

locale

stringOptional

Specify language for the payments application, sv-SE, da-DK etc (BCP 47).

metadata

objectOptional

Merchant may send a key/value object literal for internal use. Example: { "property1": "value1", "property2": "value2" }.

orderLines

array of orderlinesOptional

An array of order lines.

reference

stringOptional

This property can be used for merchant order reference and will be visible on the invoice. Maximum of 50 characters.

settings

objectOptional

An object containing various setting possibilities.

settlementReference

stringOptional

Maximum of 50 characters.

totalOrderAmount

integer

Total order amount in minor units.

totalOrderAmountExclVat

integer

Total order amount excl. VAT in minor units.

totalOrderVatAmount

integer

Total order VAT amount in minor units.