Updating an order paid in installments
It is possible to edit transactions after the payment as long as they are pending (with the PENDING status).
- The transaction amount (amount attribute),
- The capture date of the transaction (expected_capture_date attribute).
- Similarly to a mono-transactional order, it is not possible to increase the transaction amount beyond its initial amount, as recorded in the read-only initial_amount attribute.
- Items must imperatively be transmitted in the PUT query (?expand=items).
- It is possible to delete one (or several) transaction(s) (see below), but currently it is not possible to add transactions.
Procedure:
- The complete list of order transactions must be added in the PUT ORDER request body in a transactions list, including each of the potentially edited trans_uuid, expected_capture_date and amount attributes.
For example:
{ "marketplace": "2434c0a2-9d46-4e96-9553-1536c898625b", "reference": "MyMultitransactionOrder01", "description": "Order update.", "currency": "EUR", "url_return": "https://www.my-website.com/", "language": "en", "items": [ { "seller": "4d20a9d4-0526-4474-b452-e936dc25418d", "reference": "0000001", "description": "Flat screen TV", "amount": 390000, "quantity": 1, "is_commission": false }, { "seller": "72ccc2ff-b455-4653-847e-deb6fee99f8d", "reference": "0000002", "description": "Commission", "amount": 14755, "quantity": 1, "is_commission": true } ], "transactions": [ { "trans_uuid": "c383739d12a6489badc3bb6847db84cc", "payment_scheme": "CB", "amount": 14755, "expected_capture_date": "201909185743" }, { "trans_uuid": "d0c4d34249d540af87ff8df3a2fa314a", "payment_scheme": "CB", "amount": 190000, "expected_capture_date": "201905175352" }, { "trans_uuid": "8c5a6788b3334d368185b0a567dd7bcd", "payment_scheme": "CB", "amount": 200000, "expected_capture_date": "201904205352" } ], "buyer": { … } }
- “transactions” must be added in the “expand” URL attribute.
Therefore, you must submit a PUT ORDER resource to
https://secure.lyra.com/marketplace/orders/{order_uuid}?expand=items,transactions.
If the "transactions" value is not indicated, transaction updates cannot be taken into account.
During the update, the application checks if the item and transaction amounts match: normally, the total amount of the item must be identical to the total amount of the transactions. Thus, a decrease in the item amount should be followed by a manual decrease of the transaction amount.
Special case of transaction deletion
The decrease of the item amount may exceed the amount of one of the transactions. If you choose to delete one of the transactions instead of decreasing the amount across all transactions, simply exclude it from the list of transactions submitted in the update request. It will then be interpreted as canceled and its status will change to CANCELLED.
Other remarks:
- The application returns an error if the update does not include any changes (concerning transactions, items or order values).
- The new value of expected_capture_date must not be before the date and time of the update.