Add A Custom Message In Both Customer's Order History Page and Mail Notification

Hi Teams:

For my application, a random key is generated after customer pay for the products. The order status will then change to fulfilled by the application. I want to show this key in both customer’s order history and fulfillment notification mail.

I’ve tried REST admin order api to save the key value to note_attributes json array. Can i show this value for custom message?

Thank you!