Edit payment method
This API can currently only be used to convert a service invoice to an advance invoice.
The invoice needs to be uncaptured for a conversion to be successful.
The advance invoice will be sent instantly to the customer by email.
An entry in the availableActions
array in the uncaptured suborder chunk will reveal if editPaymentMethod
is available.
It can be retrieved from the GET order response.
- Example Request
- Example 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
Request Headers
Idempotency-Key
stringOptionalBy providing a unique value for this header, the idempotency of the operation will be guaranteed. This means that retries of requests will be safe to apply in case of network errors, socket errors and timeouts, etc. We recommend using UUID version 4 for the key.
Path parameters
orderId
The order ID string that was obtained when the order session was created.
Request body
paymentMethod
objectAn object consisting of the properties paymentMethod
and provider
.
The only payment method available currently is advanceInvoice
and the only provider is ledyer
.
{
"authorizeStatus": "authorized",
"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 of eventsA list of event objects, or snapshots on the order.
Each object contains an amount
object with the strings amount
, currency
formatted
, formattedWithCurrency
and integer minorUnits
pertaining to the event.
The event object also contains the date string createdAt
as well as orderId
and ledgerId
, and finally the event type
.
Events can have one of the following types:
acknowledge
: Order has been acknowledged.authorize
: Order has been authorized.cancel
: Order has been cancelled.create
: Order has been created.edit
: The order lines etc have been edited since first authorized.editCustomer
: The customer details of the order have been edited.editPaymentMethod
: The payment method of the order has been changed.extendExpiry
: The expiry date of the order 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 of the order lines have been captured.partialRefund
: Some of the order lines have been added to a credit invoice.readyForCapture
: Order has been made ready for capture.setReference
: The merchant's order reference has been updated.
uncaptured
objectpaymentMethod
objectAn object consisting of the properties paymentMethod
and provider
.
The only payment method available currently is advanceInvoice
and the only provider is ledyer
.