Calls the Zapper Business API (v2) server-side to create a payment invoice and return a deep-link that opens the Zapper app directly to the payment screen. Keeps your API keys off the browser entirely.
npm install -g firebase-tools
firebase login
Copy this folder's contents into your Firebase project's functions/ folder.
Your project ID is already set: rubbishrouter-688b2
cd functions
npm install
firebase deploy --only functions
https://us-central1-rubbishrouter-688b2.cloudfunctions.net/createZapperInvoice
This URL is already set in pay.html — no further changes needed.
- pay.html calls this function with
{ amountCents: 1500, reference: "RR_..." } - Function calls
POST https://api.zapper.com/business/api/v1/merchants/76032/sites/96013/invoiceswithRepresentation-Type: deeplink/zappercode/v2 - Zapper returns a deep link:
https://www.zapper.com/payWithZapper?qr=... - Function returns link to pay.html which redirects the user
- On mobile → opens Zapper app to payment screen
- On desktop → opens Zapper hosted payment page
- After payment → Zapper redirects to success.html?reference=RR_...
Once a user pays, Zapper will POST to your webhook URL.
Set this up at: https://mp.zapper.com → Integrations → Webhook
Recommended URL: a second Cloud Function onZapperWebhook (can add later)
For now, success.html activates the account optimistically on redirect.
- Merchant ID: 76032
- Site ID: 96013
- Merchant API Key: 6c48d74081e0421bb1afce2edc9b4dde
- Merchant Site API Key: 1b8ba011df7b45e09c107e35aa70710c