Retrieving the voucher

Once the order has been paid the next thing you want to do is to retrieve the voucher for each item in the order.

Depending on the product you bought the voucher might be ready immediately after the payment or not.

The time Musement needs to make the voucher available depends on the value of max_confirmation_time. This value indicates the max amount of time needed to generate the voucher.

So for example looking at the next JSON the order has 2 items. The first one has a max_confirmation_time of 30 minutes (PT30M) while for the second one the voucher is available immediately after the order (P0D).

After 30 minutes from the order the status for the first item will change from PENDING to OK and the voucher will show up in the vouchers property. Please note that this is the max amount of time needed. The status might change also before the specified interval.

The merchant should check for status updates at regular intervals.

{
    [..]
    "uuid": "bf464161-f03a-449e-ac82-566721c0e6b4",
    [..]
    "status": "PENDING",
    [..]
    "items": [
        {
            "product": {
                [..]
                "max_confirmation_time": "PT30M",
                [..]
              },
              "status": "PENDING",
              "vouchers": []
        },
        {
            "product": {
                [..]
                "max_confirmation_time": "P0D",
                [..]
              },
              "status": "OK",
              "vouchers": [
                  {
                    "url": "https://sandbox.musement.com/voucher/view/286462ss-ba5d-496f-9149-9d846e70ba87?pdf=1"
                  }
              ]
        }
    ],
    [..]
}

After 30 minutes from the order (or less) the response will be. Please note that also the status for the order changed from PENDING to OK because all items in the order have been confirmed.

{
    [..]
    "uuid": "bf464161-f03a-449e-ac82-566721c0e6b4",
    [..]
    "status": "OK",
    [..]
    "items": [
        {
            "product": {
                [..]
                "max_confirmation_time": "PT30M",
                [..]
              },
              "status": "OK",
              "vouchers": [
                  {
                    "url": "https://sandbox.musement.com/voucher/view/92utr92-ba5d-496f-9149-9d846e70ba87?pdf=1"
                  }
              ]
        },
        {
            "product": {
                [..]
                "max_confirmation_time": "P0D",
                [..]
              },
              "status": "OK",
              "vouchers": [
                  {
                    "url": "https://sandbox.musement.com/voucher/view/286462ss-ba5d-496f-9149-9d846e70ba87?pdf=1"
                  }
              ]
        }
    ],
    [..]
}