Upgrading From 3.19 To 3.20
Private media storage
Since Saleor 3.20 webhook event delivery payloads are stored as files using dedicated private storage.
Make sure PRIVATE_FILE_STORAGE is configured properly in settings.py before upgrade.
Please refer to Amazon S3 or Google Cloud Storage (GCS) guidelines if you are using cloud storage.
Automatic checkout completion
Saleor 3.20 added new functionality to automatically complete Checkout that have been paid by the customer.
👉 To learn more, about how this feature works and how to enable it, read the Automatic Checkout completion docs.
This feature is disabled for existing instances by default and needs to be enabled manually in the channel settings.
New Saleor instances created from version 3.20 onwards will have this feature enabled by default.
This removes the need for storefront implementation to call checkoutComplete mutation in order to create Order.
Previously a store might have had missing orders, due to checkoutComplete mutation not being always called. This could have happened for many unexpected reasons: network issues, storefront bug, customer leaving website, closing tab before being redirected from payment provider, etc.
Before you enable this feature
Before you enable this feature make sure that you don’t rely on any Checkout query or mutation that updates Checkout after transaction is created.
Automatic checkout completion works just like calling checkoutComplete mutation, which converts Checkout object into Order.
After completion checkout query with a id of already completed Checkout will return null.
In order to get the Order details after payment you can use:
checkoutCompletemutation
This mutation is idempotent, which means it can be called multiple times, but only one Order will be created. If checkoutComplete is invoked multiple times it will return the same Order object.
mutation CompleteCheckout($id: ID!) {
checkoutComplete(id: $id) {
order {
id
}
}
}
If Checkout has been paid, the response will contain Order object:
{
"data": {
"checkoutComplete": {
"order": {
"id": "T3JkZXI6NzQ="
}
}
}
}
If Checkout hasn’t been paid, the response will contain an error:
{
"data": {
"checkoutComplete": {
"errors": [
{
"code": "CHECKOUT_NOT_FULLY_PAID"
}
]
}
}
}
ordersquery
orders query filter, has an option to provide checkoutIds or checkoutTokens to get Order object that was created by specified Checkout:
query OrderDetails($checkoutId: ID!) {
orders(filter: { checkoutIds: [$checkoutId] }, first: 1) {
edges {
node {
id
}
}
}
}
query OrderDetails($checkoutToken: UUID!) {
orders(filter: { checkoutTokens: [$checkoutToken] }, first: 1) {
edges {
node {
id
}
}
}
}