My store provides a pdf as the product. I need to be able to put the link to the pdf in the order confirmation email and on the Thank you page of the checkout process.
The way that I'm trying to do this is to create an AWS Lambda that sits behind an AWS API Gateway that verifies that the order number and the customer email match a particular product and then sends a pre-qualified URL of the pdf in an AWS S3 bucket. The link to access the Lambda would look something like this:
https://<aws gateway domain>/?email=<customer email>&order=<order_number or order_id>
The problem is the REST API won't let me look up the order based on an order_number and the order object in liquid doesn't seem to have the "shopify id" (the long number that shows up when you look up the order in the order admin page). The order object in liquid does have the order number (the short number that is monotonically increasing with each new order).
It seems that I can get the order id on the Thank you page easily enough because it's available as part of the checkout object.
Is there a way where I can either look up an order by order_number using the REST API or where I can get the shopify id using liquid in the order confirmation email?