We’ve encountered a timing issue with order confirmation emails. Shopify sends the initial order confirmation email to the customer before our app has had a chance to process the payment and update the order with the payment details.
Here’s the sequence of events:
- Customer Places Order: The customer completes the checkout process on Shopify, selecting our offsite payment method.
- Payment Processing (Offsite): The customer is redirected to our payment gateway to complete the payment.
- Order Creation (Shopify): Shopify creates the order object.
- Order Confirmation Email Sent (Shopify): Shopify immediately sends the order confirmation email to the customer. This email, at this point, does not contain the payment details because our app hasn’t updated the order yet.
- Webhook Notification (Our App): Our app receives the
orders/create
webhook. - Payment Details Update (Our App): Our app processes the payment (which happens asynchronously) and then uses the webhook data to update the Shopify order with the payment details (typically using metafields).
Problem:
Because Shopify sends the order confirmation email in step 4, before our app updates the order with the payment information in step 6, the customer receives an order confirmation email that is missing crucial payment information.
Workaround:
Resending the order confirmation email manually from the Shopify admin does display the correct payment details because the order has been updated by that point.
Desired Behavior:
Ideally, we need a way to ensure that the order confirmation email is sent only after our app has successfully updated the order with the payment details.
Impact:
This issue leads to a poor customer experience as they receive an incomplete order confirmation. It also creates extra work for merchants who have to manually resend the email.
We are looking for a solution or a suggested best practice to resolve this timing issue. Thank you for your assistance.