Idempotency-Key string A unique key for safely retrying a request without duplicating work.
This API currently supports one conversion: service invoice to advance invoice. The order must be uncaptured for the conversion to succeed. The advance invoice is sent to the customer immediately by email.
You can verify whether editPaymentMethod is available by checking availableActions in the uncaptured sub-order from the GET order response.
curl -X POST
-H 'authorization: Bearer v4.public.eyJpc3MiOiJs...'
-H 'content-type: application/json'
-H 'Idempotency-Key: da7ca8f9-915b-472b-b5f0-81945bff9e4a'
-d '{
"paymentMethod": {
"provider": "ledyer",
"type": "advanceInvoice"
}
}'
https://api.sandbox.ledyer.com/v1/orders/:orderId/paymentmethod Idempotency-Key string orderId string paymentMethod object {
"captured": [],
"capturedAmount": { ... },
"createdAt": "2023-05-21T15:03:59.764338Z",
"customer": {
"billingAddress": { ... },
"companyId": "559311-3714",
"companyName": "Ledyer AB",
"email": "sven.svensson@example.com",
"firstName": "Sven",
"invoiceChannel": {
"details": "",
"type": "email",
},
"lastName": "Svensson",
"paymentMethod": {
"provider": "ledyer",
"type": "advanceInvoice"
},
"phone": "076123123123",
"reference1": "Ref 1",
"reference2": "Ref 2",
"shippingAddress": { ... },
"vatId": "SE559311371401"
},
"events": [
{
"id": "oe_2Q6kXhOWaEIybYmQu8PCP3rOcnT",
"orderId": "or_2Q6kTSe8SxH6F2n63Ti8AfNuQ5q",
"ledgerId": "in_2Q6kVAv4RdCdwkFiJMOxqRB8Vsp",
"type": "editPaymentMethod",
"createdAt": "2023-05-21T15:04:19.155525Z",
"amount": { ... }
},
{ ... },
{ ... }
],
"expiresAt": "2023-05-22T15:03:59.764338Z",
"id": "or_2Q6kTSe8SxH6F2n63Ti8AfNuQ5q",
"merchantId": "ac_1xWqkkS5aIbxCJsoseRhSd0OJyD",
"merchantReference": "Merchant ref",
"orderAmount": { ... },
"orderReference": "4SPU23Y9",
"paymentMethod": {
"provider": "ledyer",
"type": "advanceInvoice"
},
"refunded": [],
"refundedAmount": { ... },
"riskProfile": {
"tags": []
},
"status": [
"uncaptured"
],
"storeId": "698761970",
"uncaptured": {
"availableActions": [
{
"type": "cancel"
},
{
"type": "capture"
},
{
"type": "editPaymentMethod"
}
],
"createdAt": "2023-05-21T15:03:59.764338056Z",
"factoringStatus": "unspecified",
"ledgerId": "in_2Q6kVAv4RdCdwkFiJMOxqRB8Vsp",
"note": "",
"orderLines": [ ... ],
"status": [],
"totalOrderAmount": { ... },
"totalOrderAmountExclVat": { ... },
"totalOrderVatAmount": { ... }
},
"uncapturedAmount": { ... },
"updatedAt": "2023-05-21T15:04:19.155525Z"
} events array A list of order event snapshots. Each event includes an amount object with amount, currency, formatted, formattedWithCurrency, and minorUnits, plus createdAt, orderId, ledgerId, and type.
Supported type values:
acknowledge: Order has been acknowledged.authorize: Order has been authorized.cancel: Order has been cancelled.create: Order has been created.edit: Order lines and related order details have been edited since
first authorization.editCustomer: Customer details have been edited.editPaymentMethod: Payment method has been changed.extendExpiry: Order expiry has been extended at least once.fullCapture: All order lines have been captured.fullRefund: All order lines have been added to a credit invoice.paid: Order has been paid.partialCapture: Some order lines have been captured.partialRefund: Some order lines have been added to a credit invoice.readyForCapture: Order has been made ready for capture.setReference: Merchant order reference has been updated.uncaptured object availableActions array type property that describes an available action. The following types can be listed: - cancel: The order can be cancelled. - capture: The order can be fully
captured. - editCustomer: The customer details of the order can be
edited. - editOrder: The order lines can be edited. - editPaymentMethod: The payment method of the order can be edited. - extendExpiry: The
expiry date of the order can be extended. - partialCapture: The order can
be partially captured. - partialRefund: The order can be partially
refunded. - refund: The order can be fully refunded.createdAt string ledgerId string documentReference string Optional documentUrl string Optional note string Optional orderLines array description string quantity integer reference string Optional totalAmount integer totalVatAmount integer type string unitDiscountAmount integer Optional unitPrice integer vat integer status array totalOrderAmount integer totalOrderAmountExclVat integer totalOrderVatAmount integer paymentMethod object