Share an Invoice on WhatsApp From Your Android App
The simplest way to share an invoice on WhatsApp from an Android app is to generate a PDF and hand it to the Android share sheet, so the user picks WhatsApp and the contact themselves. Automated business messaging is a different approach: your server sends the message, and it needs separate setup and ongoing operation. Decide which one you need first, then plan the PDF, the recipient check, the failure cases and the privacy of any link.
Share sheet or automated messaging: which should you choose?
The two approaches look similar to the customer but differ a lot in what you build and own.
User-driven share sheet. The person using your app taps Share, chooses WhatsApp, picks a contact and presses send. The message comes from their own account. Your app never sends anything by itself, and you do not need a server component for the sending step.
Automated business messaging. Your backend sends the message to the customer, usually after an event such as an invoice being finalised. It needs a business messaging account with the provider, a server, and a way to handle failures. Pricing, template rules and delivery behaviour are outside this article. Check the provider's current documentation before you commit.
| Question | Share sheet | Automated messaging |
|---|---|---|
| Who presses send? | The app user | Your server |
| Which account sends it? | The user's own | A business account you set up |
| Needs a backend? | Not for sending | Yes |
| Works when the user is offline? | No, the user must be able to send | Can be queued by your server |
| Best for | Small shops and field staff sending one bill at a time | Large volumes, reminders, no staff involvement |
For many first versions, the share sheet is enough. You can add automation later if the volume justifies it. If you are still deciding what belongs in the first release, see how to scope an app MVP.
Should the PDF be generated on the device or on a server?
Both work. Choose by where your invoice data already lives.
On the device. The app builds the PDF from local data. This works with weak or no network, and it is quick. The cost is that layout fixes need an app update, and different phones may render fonts slightly differently, so test on them.
On a server. The server builds the PDF and the app downloads it. Every invoice looks the same, and you can change the layout without a release. The cost is that the app needs a network, and the server needs storage or regeneration logic.
A common middle path is to generate on the device for the share action and keep a server copy for records. Whichever you pick, the PDF the customer receives should match the invoice shown on screen. Our guide to designing invoice screens for a billing app covers what the invoice itself should show, and the same data can feed a paper copy, as in printing receipts from an Android app.
How do you check the recipient before sending?
Sending an invoice to the wrong number is a privacy problem, not just an embarrassment. Build a small confirmation step.
- Show the customer name and the phone number together on a confirmation screen before the share action.
- Store numbers in one consistent format, including the country code, so a missing code does not send the message to the wrong place.
- Validate the number format when the customer record is saved, not only at the moment of sending.
- With the share sheet, remember that the final contact choice is made inside WhatsApp. Your app cannot verify it, so show the name clearly before handing over.
- With automated messaging, require the number to be confirmed on the customer record, and log which number each invoice went to.
How should the app handle a missing app or no network?
Plan these cases as normal behaviour, not rare errors.
WhatsApp is not installed. Do not assume it is. Check for it before showing a WhatsApp-only button, or use the general share sheet so the user can choose another app, email or save the file. Offer a clear fallback such as Save PDF.
No network. A device-generated PDF can still be created. Sending it needs a connection, and your app cannot see what happens inside the messaging app. Tell the user the invoice is ready and ask them to check that it was sent once they are back online. If the PDF is made on a server, show a plain message and a retry button, and consider keeping the last generated file. For the wider picture, see planning offline data sync and testing on slow networks.
The user cancels the share. If the user closes the share sheet without picking an app, leave the invoice status unchanged. If they pick an app, the share sheet can tell your app which one, but not whether a message was actually sent, so label the status as shared, not delivered.
How do you avoid exposing invoice links publicly?
Some apps send a link to the invoice instead of the file. That is convenient, but a link can be forwarded, guessed or indexed.
- Do not use a short, sequential identifier such as an invoice number in the address. Use a long, random value that cannot be guessed.
- Make links expire, and let the business owner revoke them.
- Prefer sending the PDF file itself when the invoice is a one-off.
- Do not put customer names, amounts or phone numbers in the link text.
- Keep invoices private by default, and require an explicit action to create a link.
- Avoid writing full links into logs or analytics events.
What does the flow look like step by step?
| Step | App action | What can go wrong | Plan for it |
|---|---|---|---|
| 1 | User opens a finalised invoice | Invoice is still a draft | Disable Share until it is final |
| 2 | App shows customer and number | Number missing or wrong | Ask the user to fix it first |
| 3 | App generates or downloads the PDF | Slow, failed or offline | Progress, retry, or fallback to the device copy |
| 4 | App opens the share sheet | WhatsApp not installed | Show other options and Save PDF |
| 5 | User picks an app or closes the share sheet | App cannot confirm a message was sent | Mark as shared only if an app was picked, never as delivered |
| 6 | App records the action | Duplicate sends | Show the last shared time |
To stop a repeated tap from sharing the same invoice twice, see preventing duplicate submissions.
What should you test before release?
- The PDF opens correctly in WhatsApp and in a separate PDF viewer.
- Long customer names, many line items and non-English text do not break the layout.
- The confirmation screen shows the right name and number every time.
- A number without a country code is handled as you intended.
- The flow works with WhatsApp installed, not installed, and signed out.
- Airplane mode shows a clear message at each step.
- Closing the share sheet without picking an app leaves the invoice status unchanged.
- Shared files do not stay in a publicly readable folder on the phone.
- Any link in use cannot be opened without its random value, and expires as designed.
- The app works on older, low-memory phones; see testing on low-end phones.
- The general pre-release testing checklist is complete.
What common mistakes should you avoid?
Saying delivered when you only know shared. The share sheet hands off the file. Use honest status labels.
Using guessable links. Sequential invoice addresses let anyone browse other customers' bills.
Skipping the recipient check. Typing errors in phone numbers are common and the cost is a private document sent to a stranger.
Assuming WhatsApp exists. Some users prefer other apps, and some work phones do not have it.
Building automation too early. If staff send a few invoices a day, the share sheet is cheaper to build and maintain.
When does this not apply?
If your customers do not use WhatsApp, or your business needs formal delivery records, an email or portal flow may fit better. If you send high volumes of reminders without staff involvement, the share sheet is the wrong tool, and you should plan automated messaging with a backend. Also, if invoices carry tax details, check the format rules with your accountant or the official tax portal for your country rather than relying on this article.
If you want help planning an invoice flow for your app, see our services.
What questions do founders often ask?
Can an app send a WhatsApp message without the user pressing send?
Not through the share sheet. The user always chooses the contact and presses send. Sending without that step needs automated business messaging, which runs from your server through a provider and has its own setup, rules and costs to check.
Should I send the PDF or a link?
Send the PDF for one-off invoices, because it needs no hosting and leaves no link that can be forwarded or guessed. It still goes to whichever contact is picked, so check the recipient first. Use a link only if you need updates or payment on the page, and then make it long, random, expiring and revocable.
What if the customer's number is wrong?
The invoice reaches the wrong person, so prevention matters most. Show name and number together before sharing, validate the format when saving the customer, and keep a record of what was shared. Let staff correct the number and resend.
Does the app need a backend to share invoices?
Not for the share sheet with a device-made PDF. You need a backend if the PDF is made on a server, if you send links, or if you use automated messaging. Many first versions start without one and add it later.