Want to send order invoice from my ionic app to mail ids?


#1

Hi,
I am new to ionic and i want to send the order summary as a mail if the customer clicks on "send summary as email " button. But i could find anything. Got to know about Email Composer but it wont help as my requirement is different.
TIA


#2

What is your requirement? How does the Email Composer not meet it?


#3

@Sujan12 - If a customer wants the order summary to be send to his email id, he just clicks on “Send summary to email” and he get the order summary in his mail id.
I don’t want the customer to physically type the email which happens in Email Composer as per my knowledge.
If you can help how to implement this.
Thanks for reply.


#4

Do you know the email address? (mail id = email address, correct?)
What did he do before? Was the order transmitted to a server?

In general sending email to the user of the app is better done in the backend. Call an API endpoint with the order ID, send the email from the server, done.

Sending email in the Ionic app only makes sense if it is from the user to someone else.


#5

@Sujan12 How can i do it from serve using Magento?


#6

Ask your Magento developer.


#7

ok. Thanks for your response.


#8

As far as I know, you can’t send custom emails with Magento REST API. What you can do, is send system email notifications related to Magento Resources (customers, orders, invoices, etc).

In the REST API you have many endpoint for that. Visit the Mgento REST API documentation (http://devdocs.magento.com/swagger/index_20.html#/)

What you will need to do in you Ionic code is:

  1. First, user must be logged in. Use the integrationCustomerTokenServiceV1 service (the endpoint is: POST /V1/integration/customer/token)

  2. Next, identify the resource id. For example if you need to send an Invoice notification you first need to get the invoice id. Query the Invoice repository an select one. You query the repository with the salesInvoiceRepositoryV1 interface (endpoint: GET /V1/invoices)

  3. Then, with the Invoice id you can send a copy of the invoice to the user email with the salesInvoiceManagementV1 interface (endpoint: POST /V1/invoices/{id}/emails)

The same can be done with customer, orders and shipments.

Hope this help.