mollie v0.2.3 Mollie.Orders

Link to this section Summary

Functions

Cancels the order if the order’s status field is either created, authorized or shipping

Creates an order. 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

Retrieve a single order by its ID

Retrieve all orders. Results are paginated

Update the billing and/or shipping address of an order

Link to this section Functions

Link to this function cancel(client, id, params \\ %{})
cancel(Mollie.Client.t(), binary(), map()) :: Mollie.response()

Cancels the order if the order’s status field is either created, authorized or shipping.

Example

Mollie.Orders.cancel client, "ord_8wmqcHMN4U"

More info at: https://docs.mollie.com/reference/v2/orders-api/cancel-order

Link to this function create(client, body)
create(Mollie.Client.t(), map()) :: Mollie.response()

Creates an order. 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.

Order body example

%{
    "amount" => %{
        "currency" => "EUR",
        "value" => "100.00"
    },
    "orderNumber" => "23302",
    "lines" => [
      %{
          "name" => "LEGO 4440 Forest Police Station",
          "quantity" => 1,
          "unitPrice" => %{
              "currency" => "EUR",
              "value" => "79.00"
          },
          "totalAmount" => %{
              "currency" => "EUR",
              "value" => "100.00"
          },
          "vatRate" => "21.00",
          "vatAmount" => %{
              "currency" => "EUR",
              "value" => "21.00"
          }
      }
    ],
    "billingAddress" => %{
      "givenName" => "Piet",
      "familyName" => "Mondriaan",
      "email" => "pm@example.com",
      "streetAndNumber" => "Keizersgracht 313",
      "city" => "Amsterdam",
      "region" => "Noord-Holland",
      "postalCode" => "1234AB",
      "country" => "NL",
    },
    "redirectUrl" => "https://example.com/redirect",
    "locale" => "nl_NL"
}

Example

Mollie.Orders.create client, order_body

More info at: https://docs.mollie.com/reference/v2/orders-api/create-order

Link to this function find(client, id, params \\ %{})

Retrieve a single order by its ID.

Example

Mollie.Orders.find client, "ord_8wmqcHMN4U"

More info at: https://docs.mollie.com/reference/v2/orders-api/get-order

Link to this function list(client, params \\ %{})

Retrieve all orders. Results are paginated

Example

Mollie.Orders.list client

More info at: https://docs.mollie.com/reference/v2/orders-api/list-orders

Link to this function update(client, id, body)
update(Mollie.Client.t(), binary(), map()) :: Mollie.response()

Update the billing and/or shipping address of an order.

Update body example

%{
    "shippingAddress" => %{
        "givenName" => "Piet",
        "familyName" => "Mondriaan",
        "email" => "pm@example.com",
        "streetAndNumber" => "Keizersgracht 313",
        "city" => "Amsterdam",
        "region" => "Noord-Holland",
        "postalCode" => "1234AB",
        "country" => "NL"
    }
}

Example

Mollie.Orders.update client, "ord_8wmqcHMN4U", update_body

More info at: https://docs.mollie.com/reference/v2/orders-api/update-order