Navigation

Wallet Auto-Topup with Trigger Billing

Automatically charge when a balance drops below a threshold

Goal: Set up automatic wallet topups so when a customer's balance drops below $15, Edge charges their stored payment method $200 and the balance is credited. This is the exact pattern Zyntro uses internally.

What You'll Need

Trigger Billing (Fixed mode, off_session) — Defines the condition (balance <= $15) and charge amount ($200)
Billing Customers — Stores the customer's payment method and gateway
Edge Webhooks — Delivers trigger.captured so your system can credit the wallet
Fire Trigger API — Your application calls this when it detects low balance

Steps

Create the topup item

Navigate to Edge > Billable Items > New Item. Set billing type Trigger. Configure: Trigger Mode = Fixed, Capture Mode = Charge Immediately, Condition = <=, Threshold = 15.00, Unit Price = 200.00. Description: 'When wallet balance <= $15, charge $200'. Save and note the `billable_item_id`.

Create a billing customer

Navigate to Edge > Billing Customers > New Customer. Select the contact, choose gateway, attach payment method. Enable Allow Trigger Billing. Set initial charge to $15.00. Save. Note the `billing_customer_id`.

Enroll the customer

Open the billing customer. Click Enroll, select the topup item. Enrollment is now active.

Subscribe to trigger.captured

In Account > API & Webhooks, create a webhook for `trigger.captured` pointing to your handler (e.g., `https://yourapp.com/webhooks/edge`). Note the secret key for HMAC verification.

Wire your balance check

In your application, after any wallet debit, check the new balance. If at or below $15, call:

`POST /apis/edge/trigger/fire.php`

with `billable_item_id` and `billing_customer_id`. Edge charges $200 immediately.

Handle the webhook

Your endpoint receives `trigger.captured` with charge details. Verify HMAC signature. Credit the customer's wallet by the charged amount. Return 200 OK.

Result

When a balance drops below $15, your system fires the trigger, Edge charges $200, and your webhook handler credits the wallet. Fully automated — no manual intervention.

This is exactly how Zyntro bills itself. Same API, same webhook, same infrastructure.

Variations

Multiple topup tiers

Create 4 items ($100, $200, $300, $500) with the same condition but different amounts. Let customers choose during onboarding.

Different thresholds

Create items with different thresholds ($15, $25, $50) for high-volume vs low-volume customers.

Tip: The 60-second cooldown prevents double-topups if your system fires twice in quick succession. Edge returns the existing result on the second call.

Was this article helpful?

NotebookLM Overviews