eCom - Sending email notifications through the API

whappycannabiswhappycannabis Member Posts: 19
edited May 11 in Development

Hi, when using the LS eCom admin interface, we can press on a button to mark the order "as paid" or "as ready for pickup" and when we do this, an email notification is sent to the customer.

When I update an eCom order through the API by sending a PUT request and changing the paymentStatus to paid, the order gets mark as paid but no email notification is sent.

How can I have the email notification sent? Am I missing something here?

Thanks, Max.


Tags:

5 comments

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 734 moderator

    Hi @whappycannabis,

    Thank you for contacting us.

    You must update the invoice and not the order: https://developers.lightspeedhq.com/ecom/endpoints/invoice/#put-update-an-invoice

    Payload:

    PUT /invoices/{invoice_id}.json
    {
      "invoice": {
        "status": "paid",    
        "doNotifyNew": false,
        "doNotifyPaid": true,
        "order": 173168102,
        "customer": 123893197
      }
    }
    
  • whappycannabiswhappycannabis Member Posts: 19

    Great! thanks @LucienVersendaal it worked. Also, once the invoice is set as paid, and I want to mark the order as "picked up", I do the following.... can you confirm if this is the right way to mark the order as complete?

    url = "https://api.shoplightspeed.com/us/orders/" + eComOrderID + ".json"
    
    payload = {
     'order[shipmentStatus]': 'shipped'
    }
    requests.put(url, data=payload, auth=(eComKey, eComSecret))
    
  • Ali_MasoumieAli_Masoumie Moderator, Lightspeed Staff Posts: 109 moderator

    Hi,

    That is correct, as the invoice is "paid" and the shipment is "shipped", the order will be marked as completed.

  • whappycannabiswhappycannabis Member Posts: 19
    edited May 18

    Thanks again for all your help @LucienVersendaal and @Ali_Masoumie maybe one last question about this... what if I need to cancel the order? Do I cancel the order or do I cancel the invoice? Currently my script is cancelling the order this way but I was wondering if this is the correct way to cancel and order or should I cancel the invoice:

    url = "https://api.shoplightspeed.com/us/orders/" + eComOrderID + ".json"
    payload = {
     'order[status]': 'cancelled'
    }
    requests.put(url, data=payload, auth=(eComKey, eComSecret))
    
  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 734 moderator

    @whappycannabis,

    You're cancelling the order. When doing that a credit invoice is created automatically.

Sign In or Register to comment.