Edit payment method

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

Request Headers

Idempotency-Key string
A unique key for safely retrying a request without duplicating work.

Path parameters

orderId string
The order ID obtained when the order session was [created](/docs/payment-products/checkout/create-order-session).

Request body

paymentMethod object
An object with `type` and `provider`. The supported values are `advanceInvoice` for `type` and `ledyer` for `provider`.
{
  "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
Show child attributes
availableActions array
A list of available actions for the order. Each object in the list contains a 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
A date in ISO 8601 format.
ledgerId string
Unique identifier for the sub order.
documentReference string Optional
Unique identifier for the invoice.
documentUrl string Optional
An invoice web link.
note string Optional
An internal note, optionally set when making a refund/partial refund. Defaults to empty string if not set.
orderLines array
An array of order lines.
Show child attributes
description string
Product name, description etc.
quantity integer
Non negative number.
reference string Optional
SKU or product reference.
totalAmount integer
Total amount in minor units.
totalVatAmount integer
Total VAT amount in minor units.
type string
Type of order line: `physical`, `shippingFee`, `discount`, `giftCard`.
unitDiscountAmount integer Optional
Discount per unit in minor units.
unitPrice integer
Price per unit in minor units.
vat integer
VAT rate in minor units (e.g., 2500 for 25%).
status array
A list of possible sub order statuses for merchants that use invoice service. Available values: - `debtCollection` - `fullyPaid` - `partiallyPaid` - `recourse` - `reminder1` - `reminder2` Can also be empty.
totalOrderAmount integer
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency` and integer `minorUnits`, including VAT.
totalOrderAmountExclVat integer
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency` and integer `minorUnits`, excluding VAT.
totalOrderVatAmount integer
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency` and integer `minorUnits`, only the VAT part of the total order amount.
paymentMethod object
An object with `type` and `provider`. The supported values are `advanceInvoice` for `type` and `ledyer` for `provider`.