Answers.Body: <p>The tokens you can use in a message template are a bit random, just what the developer added to the template. In this case, the contribution id can be found with <code>{$contributionID}</code>. However, that is not the same as the <code>invoice_number</code>. I could not find a token for the invoice number. But the templates are generated by smarty, and in smarty you can use the CiviCRM api. So the following line gets the invoice number:</p>
  
  <pre><code>{crmAPI var='invoiceReference' 
          entity='Contribution' 
          action='getvalue' 
          return="invoice_id" 
          id=$contributionID}
  </code></pre>
  
  <p>You can print it with <code>{$invoiceReference}</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-22T12:59:06.320Z
Answers.LastActivityDate: 2018-08-22T12:59:06.320Z
Answers.UserDisplayName: Kainuk - CiviCooP
Answers.Body: <p>I think this answer is outdated, I can see that the {$invoiceReference} variable is available in the message template - Contributions - Receipt (on-line).</p>
  <p>Use the Smarty function in the template to see all the available Smarty variables and their values: <strong>{debug output=html}</strong></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-28T07:02:45.757Z
Answers.LastActivityDate: 2020-10-28T07:02:45.757Z
Answers.UserDisplayName: Justin Freeman - Agileware
Body: <p>I need to send Invoice number in the message templates for Membership Receipt Online, but I don't see any token or variables associated for Invoice Number which I can use to place it </p>
  
  <p>is there any way we can place the invoice number in the message templates ?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-22T20:25:02.730Z
Comments.Text: The solution proposed seems very good: {crmAPI var='invoiceReference' entity='Contribution' action='getvalue' return="invoice_id" id=$contributionID}
  You can print it with {$invoiceReference} But I obtain an array, in which way I could extract the invoice_number?
Comments.UserDisplayName: pk825
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-02T09:44:07.640Z
Comments.Text: This does not provide an answer to the question. Once you have sufficient [reputation](https://civicrm.stackexchange.com/help/whats-reputation) you will be able to [comment on any post](https://civicrm.stackexchange.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/10341)
Comments.UserDisplayName: William Mortada
Tags: <wordpress><message-templates><invoice>
Title: How to include token or variable for Invoice number under the message templates for Memberships - Receipt (on-line)
ThreadText: # How to include token or variable for Invoice number under the message templates for Memberships - Receipt (on-line)
  
  (Asked by: username_0 on 2018-08-21)
  
  I need to send Invoice number in the message templates for Membership Receipt Online, but I don't see any token or variables associated for Invoice Number which I can use to place it
  
  is there any way we can place the invoice number in the message templates ?
  
  **Tags:** wordpress, message-templates, invoice
  
  > **Comments:**
  > **username_1**: The solution proposed seems very good: {crmAPI var='invoiceReference' entity='Contribution' action='getvalue' return="invoice_id" id=$contributionID} You can print it with {$invoiceReference} But I obtain an array, in which way I could extract the invoice_number?  
  > **username_2**: This does not provide an answer to the question. Once you have sufficient [reputation](https://civicrm.stackexchange.com/help/whats-reputation) you will be able to [comment on any post](https://civicrm.stackexchange.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/10341)  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2018-08-22. Score: 3
  
  The tokens you can use in a message template are a bit random, just what the developer added to the template. In this case, the contribution id can be found with {$contributionID}. However, that is not the same as the invoice_number. I could not find a token for the invoice number. But the templates are generated by smarty, and in smarty you can use the CiviCRM api. So the following line gets the invoice number:
  {crmAPI var='invoiceReference' 
          entity='Contribution' 
          action='getvalue' 
          return="invoice_id" 
          id=$contributionID}
  
  You can print it with {$invoiceReference}
  
  
  ---
  
  ### Answer by username_4 on 2020-10-28. Score: 2
  
  I think this answer is outdated, I can see that the {$invoiceReference} variable is available in the message template - Contributions - Receipt (on-line).
  
  Use the Smarty function in the template to see all the available Smarty variables and their values: **{debug output=html}**
  
  
  ---
  
  