public class OrderHandler extends AbstractHandler
| Constructor and Description |
|---|
OrderHandler(String baseUrl) |
| Modifier and Type | Method and Description |
|---|---|
OrderResponse |
cancelOrder(String orderId)
The order can only be canceled while:
the order doesn’t have any open payments except for the methods banktransfer, directdebit, klarnapaylater, and klarnasliceit.
the order’s status field is either created, authorized or shipping.
In case of created, all order lines will be canceled and the new order status will be canceled.
In case of authorized, the authorization will be released, all order lines will be canceled and the new order status will be canceled.
In case of shipping, any order lines that are still authorized will be canceled and order lines that are shipping will be completed.
|
OrderResponse |
cancelOrder(String orderId,
QueryParams params)
The order can only be canceled while:
the order doesn’t have any open payments except for the methods banktransfer, directdebit, klarnapaylater, and klarnasliceit.
the order’s status field is either created, authorized or shipping.
In case of created, all order lines will be canceled and the new order status will be canceled.
In case of authorized, the authorization will be released, all order lines will be canceled and the new order status will be canceled.
In case of shipping, any order lines that are still authorized will be canceled and order lines that are shipping will be completed.
|
void |
cancelOrderLines(String orderId,
CancelOrderLinesRequest body)
This endpoint can be used to cancel one or more order lines that were previously authorized using a pay after delivery payment method.
|
void |
cancelOrderLines(String orderId,
CancelOrderLinesRequest body,
QueryParams params)
This endpoint can be used to cancel one or more order lines that were previously authorized using a pay after delivery payment method.
|
OrderResponse |
createOrder(OrderRequest body)
Using the Orders API is the preferred approach when integrating the Mollie API into e-commerce applications such as webshops.
|
OrderResponse |
createOrder(OrderRequest body,
QueryParams params)
Using the Orders API is the preferred approach when integrating the Mollie API into e-commerce applications such as webshops.
|
PaymentResponse |
createOrderPayment(String orderId,
OrderPaymentRequest body)
An order has an automatically created payment that your customer can use to pay for the order.
|
PaymentResponse |
createOrderPayment(String orderId,
OrderPaymentRequest body,
QueryParams params)
An order has an automatically created payment that your customer can use to pay for the order.
|
RefundResponse |
createOrderRefund(String orderId,
OrderRefundRequest body)
When using the Orders API, refunds should be made against the order.
|
RefundResponse |
createOrderRefund(String orderId,
OrderRefundRequest body,
QueryParams params)
When using the Orders API, refunds should be made against the order.
|
OrderResponse |
getOrder(String orderId)
Retrieve a single order by its ID.
|
OrderResponse |
getOrder(String orderId,
QueryParams params)
Retrieve a single order by its ID.
|
Pagination<OrderRefundListResponse> |
getOrderRefunds(String orderId)
Retrieve all order refunds.
|
Pagination<OrderRefundListResponse> |
getOrderRefunds(String orderId,
QueryParams params)
Retrieve all order refunds.
|
Pagination<OrderListResponse> |
getOrders()
Retrieve all orders.
|
Pagination<OrderListResponse> |
getOrders(QueryParams params)
Retrieve all orders.
|
OrderResponse |
updateOrder(String orderId,
OrderUpdateRequest body)
This endpoint can be used to update the billing and/or shipping address of an order.
|
OrderResponse |
updateOrder(String orderId,
OrderUpdateRequest body,
QueryParams params)
This endpoint can be used to update the billing and/or shipping address of an order.
|
OrderResponse |
updateOrderLine(String orderId,
String lineId,
OrderLineUpdateRequest body)
This endpoint can be used to update an order line.
|
OrderResponse |
updateOrderLine(String orderId,
String lineId,
OrderLineUpdateRequest body,
QueryParams params)
This endpoint can be used to update an order line.
|
delete, delete, delete, get, get, patch, patch, post, post, postWithoutBody, validateResponsepublic OrderHandler(String baseUrl)
public OrderResponse createOrder(OrderRequest body) throws MollieException
Creating an order will automatically create the required payment to allow your customer to pay for the order.
Once you have created an order, you should redirect your customer to the URL in the _links.checkout property from the response.
Note that when the payment fails, expires or is canceled, you can create a new payment using the Create order payment API. This is only possible for orders that have a created status.
body - OrderRequest objectMollieException - when something went wrongpublic OrderResponse createOrder(OrderRequest body, QueryParams params) throws MollieException
Creating an order will automatically create the required payment to allow your customer to pay for the order.
Once you have created an order, you should redirect your customer to the URL in the _links.checkout property from the response.
Note that when the payment fails, expires or is canceled, you can create a new payment using the Create order payment API. This is only possible for orders that have a created status.
body - OrderRequest objectparams - A map of query paramsMollieException - when something went wrongpublic OrderResponse getOrder(String orderId) throws MollieException
orderId - An order IDMollieException - when something went wrongpublic OrderResponse getOrder(String orderId, QueryParams params) throws MollieException
orderId - An order IDparams - A map of query paramsMollieException - when something went wrongpublic Pagination<OrderListResponse> getOrders() throws MollieException
MollieException - when something went wrongpublic Pagination<OrderListResponse> getOrders(QueryParams params) throws MollieException
params - A map of query paramsMollieException - when something went wrongpublic OrderResponse updateOrder(String orderId, OrderUpdateRequest body) throws MollieException
When updating an order that uses a pay after delivery method such as Klarna Pay later, Klarna may decline the requested changes, resulting in an error response from the Mollie API. The order remains intact, though the requested changes are not persisted.
orderId - An order IDbody - OrderUpdateRequest objectMollieException - when something went wrongpublic OrderResponse updateOrder(String orderId, OrderUpdateRequest body, QueryParams params) throws MollieException
When updating an order that uses a pay after delivery method such as Klarna Pay later, Klarna may decline the requested changes, resulting in an error response from the Mollie API. The order remains intact, though the requested changes are not persisted.
orderId - An order IDbody - OrderUpdateRequest objectparams - A map of query paramsMollieException - when something went wrongpublic OrderResponse updateOrderLine(String orderId, String lineId, OrderLineUpdateRequest body) throws MollieException
Use cases for this endpoint could be updating the name, productUrl and imageUrl for a certain order line because your customer wants to swap the item for a different variant, for example exchanging a blue skirt for the same skirt in red.
Or update the quantity, unitPrice, discountAmount, totalAmount, vatAmount and vatRate if you want to substitute a product for an entirely different one.
Alternatively, you can also (partially) cancel order lines instead of updating the quantity.
When updating an order line that uses a pay after delivery method such as Klarna Pay later, Klarna may decline the requested changes, resulting in an error response from the Mollie API. The order remains intact, though the requested changes are not persisted.
orderId - An order IDlineId - A line IDbody - OrderLineUpdateRequest objectMollieException - when something went wrongpublic OrderResponse updateOrderLine(String orderId, String lineId, OrderLineUpdateRequest body, QueryParams params) throws MollieException
Use cases for this endpoint could be updating the name, productUrl and imageUrl for a certain order line because your customer wants to swap the item for a different variant, for example exchanging a blue skirt for the same skirt in red.
Or update the quantity, unitPrice, discountAmount, totalAmount, vatAmount and vatRate if you want to substitute a product for an entirely different one.
Alternatively, you can also (partially) cancel order lines instead of updating the quantity.
When updating an order line that uses a pay after delivery method such as Klarna Pay later, Klarna may decline the requested changes, resulting in an error response from the Mollie API. The order remains intact, though the requested changes are not persisted.
orderId - An order IDlineId - A line IDbody - OrderLineUpdateRequest objectparams - A map of query paramsMollieException - when something went wrongpublic OrderResponse cancelOrder(String orderId) throws MollieException
orderId - An order IDMollieException - when something went wrongpublic OrderResponse cancelOrder(String orderId, QueryParams params) throws MollieException
orderId - An order IDparams - A map of query paramsMollieException - when something went wrongpublic void cancelOrderLines(String orderId, CancelOrderLinesRequest body) throws MollieException
Canceling or partially canceling an order line will immediately release the authorization held for that amount. Your customer will be able to see the updated order in his portal / app. Any canceled lines will be removed from the customer’s point of view, but will remain visible in the Mollie Dashboard.
You should cancel an order line if you don’t intend to (fully) ship it.
An order line can only be canceled while its status field is either authorized or shipping. If you cancel an authorized order line, the new order line status will be canceled. Canceling a shipping order line will result in a completed order line status.
If the order line is paid or already completed, you should create a refund using the Create Order Refund API instead.
orderId - An order IDbody - CancelOrderLinesRequest objectMollieException - when something went wrongpublic void cancelOrderLines(String orderId, CancelOrderLinesRequest body, QueryParams params) throws MollieException
Canceling or partially canceling an order line will immediately release the authorization held for that amount. Your customer will be able to see the updated order in his portal / app. Any canceled lines will be removed from the customer’s point of view, but will remain visible in the Mollie Dashboard.
You should cancel an order line if you don’t intend to (fully) ship it.
An order line can only be canceled while its status field is either authorized or shipping. If you cancel an authorized order line, the new order line status will be canceled. Canceling a shipping order line will result in a completed order line status.
If the order line is paid or already completed, you should create a refund using the Create Order Refund API instead.
orderId - An order IDbody - CancelOrderLinesRequest objectparams - A map of query paramsMollieException - when something went wrongpublic PaymentResponse createOrderPayment(String orderId, OrderPaymentRequest body) throws MollieException
A new payment can only be created while the status of the order is created, and when the status of the existing payment is either expired, canceled or failed.
Note that order details (for example amount or webhookUrl) can not be changed using this endpoint.
orderId - An order IDbody - OrderPaymentRequest objectMollieException - when something went wrongpublic PaymentResponse createOrderPayment(String orderId, OrderPaymentRequest body, QueryParams params) throws MollieException
A new payment can only be created while the status of the order is created, and when the status of the existing payment is either expired, canceled or failed.
Note that order details (for example amount or webhookUrl) can not be changed using this endpoint.
orderId - An order IDbody - OrderPaymentRequest objectparams - A map of query paramsMollieException - when something went wrongpublic RefundResponse createOrderRefund(String orderId, OrderRefundRequest body) throws MollieException
However, if you want to refund arbitrary amounts you can use the Create Payment Refund API for Pay later and Slice it.
If an order line is still in the authorized status, it cannot be refunded. You should cancel it instead. Order lines that are paid, shipping or completed can be refunded.
orderId - An order IDbody - OrderRefundRequest objectMollieException - when something went wrongpublic RefundResponse createOrderRefund(String orderId, OrderRefundRequest body, QueryParams params) throws MollieException
However, if you want to refund arbitrary amounts you can use the Create Payment Refund API for Pay later and Slice it.
If an order line is still in the authorized status, it cannot be refunded. You should cancel it instead. Order lines that are paid, shipping or completed can be refunded.
orderId - An order IDbody - OrderRefundRequest objectparams - A map of query paramsMollieException - when something went wrongpublic Pagination<OrderRefundListResponse> getOrderRefunds(String orderId) throws MollieException
orderId - An order IDMollieException - when something went wrongpublic Pagination<OrderRefundListResponse> getOrderRefunds(String orderId, QueryParams params) throws MollieException
orderId - An order IDparams - A map of query paramsMollieException - when something went wrongCopyright © 2020. All rights reserved.