CreateOrder order.fulfillments[0].delivery_details.prep_time_duration INVALID_TIME

Request:

{
  "order": {
    "location_id": "LRJTTXT2WPN8D",
    "customer_id": "RFMY1VH7K3DGHV5B29HBD1BNCW",
    "line_items": [
      {
        "name": "A Book from Lebanon",
        "quantity": "1",
        "base_price_money": {
          "amount": 2500,
          "currency": "USD"
        }
      },
      {
        "name": "Shipping",
        "quantity": "1",
        "base_price_money": {
          "amount": 0,
          "currency": "USD"
        }
      },
      {
        "name": "Credit Card Fee",
        "quantity": "1",
        "base_price_money": {
          "amount": 113,
          "currency": "USD"
        }
      }
    ],
    "fulfillments": [
      {
        "type": "DELIVERY",
        "state": "PROPOSED",
        "delivery_details": {
          "recipient": {
            "customer_id": "RFMY1VH7K3DGHV5B29HBD1BNCW"
          },
          "schedule_type": "ASAP",
          "prep_time_duration": "2023-07-17T18:15:19Z"
        }
      }
    ],
    "metadata": {
      "addressType": "Residential",
      "shippingCostInBtc": "0.0006599",
      "subtotalInBtc": "0.00082529"
    }
  },
  "idempotency_key": "1361e30f-fc7b-4cb5-b8e8-f9252b4785d6"
}

error:

{
  "errors": [
    {
      "code": "INVALID_TIME",
      "detail": "The provided duration `2023-07-17T18:15:19Z` does not conform to RFC3339.",
      "field": "order.fulfillments[0].delivery_details.prep_time_duration",
      "category": "INVALID_REQUEST_ERROR"
    }
  ]
}

What is invalid about the RFC3339 I sent in the request? I believe there is an error in your RFC3339 validation.

The RFC3339 for duration would be something like P1W3D.

Durations:

   dur-second        = 1*DIGIT "S"
   dur-minute        = 1*DIGIT "M" [dur-second]
   dur-hour          = 1*DIGIT "H" [dur-minute]
   dur-time          = "T" (dur-hour / dur-minute / dur-second)
   dur-day           = 1*DIGIT "D"
   dur-week          = 1*DIGIT "W"
   dur-month         = 1*DIGIT "M" [dur-day]
   dur-year          = 1*DIGIT "Y" [dur-month]
   dur-date          = (dur-day / dur-month / dur-year) [dur-time]

   duration          = "P" (dur-date / dur-time / dur-week)

:slightly_smiling_face:

I appreciate the response, Bryan!

In that case, the examples for prep_time_duration on POST /v2/orders - Square API Reference may be a bit off. They currently read:

Examples for January 25th, 2020 6:25:34pm Pacific Standard Time:

UTC: 2020-01-26T02:25:34Z

Pacific Standard Time with UTC offset: 2020-01-25T18:25:34-08:00

This confused me here. It does say “(for example, “P1W3D”)” but I mistakenly assumed that was the typo.

Anywho, thanks again!

Thanks for bringing this to our attention. I’ve escalated this with the team. :slightly_smiling_face: