Pay2All applications
How auth.pay2all.in, erp.pay2all.in, pay2all.in and trip2all.com integrate.
Pay2All products use SMS21 like any other customer. None of them integrates an SMS or WhatsApp vendor directly: routing, failover, DLT and provider credentials stay inside SMS21, and switching a vendor never requires an application deployment.
Who does what
| System | Owns |
|---|---|
| auth.pay2all.in | Users, passwords, sessions, tokens, login and account-recovery flows. Decides when an OTP is needed. |
| SMS21 | Generating, delivering and verifying OTPs; SMS and WhatsApp delivery; DLT; delivery reports; messaging costs. |
| erp.pay2all.in, pay2all.in, trip2all.com | Their business events (orders, payments, bookings) and the messages those events trigger. |
Authentication stays in auth.pay2all.in
SMS21 answers “was this code correct for this number?”. It never creates users, sessions or tokens; auth.pay2all.in does that after a successful verification.
Set-up
- One SMS21 company (Pay2All) with one project per application, so keys, reports, webhooks and costs are separated.
- Per project, a test key for development and staging and a live key for production only, each in that environment’s secret store.
- Minimum scopes and an IP allow-list with the application servers’ egress addresses.
- DLT entity, sender IDs and templates registered once under the company and used by every project.
| Project | Typical scopes | Typical use |
|---|---|---|
| auth | otp:send otp:verify | Login, registration, password reset, mobile verification |
| pay2all | otp:send otp:verify sms:send reports:read | Transaction OTPs, payment receipts |
| erp | sms:send whatsapp:send reports:read | Invoices, reminders, staff alerts |
| trip2all | sms:send whatsapp:send reports:read | Booking confirmations, itinerary updates |
Conventions
- OTP
purposematches the flow:login,registration,password_reset,mobile_verificationin auth;transactionfor payment confirmation in pay2all. A code verified for one purpose never authorises another. - Always pass the end user’s IP (
ip) on OTP sends. - Idempotency keys are namespaced by application and record:
Idempotency keys
auth:login-attempt:<attemptId>
pay2all:payment:<paymentId>:otp
erp:invoice:<invoiceId>:issued
trip2all:booking:<bookingId>:confirmation- Set
appInfoin the SDK (auth-pay2all/2.3.0) so SMS21 request logs identify the caller. - Log
requestId/messageIdwith your own correlation ID — never codes, keys or secrets. - Receive delivery status through one webhook endpoint per project and store it with the business record.
auth.pay2all.in login flow
TypeScript
// POST /login/otp (auth.pay2all.in backend)
const otp = await sms21.otp.send(
{ mobile, purpose: 'login', ip: request.ip },
{ idempotencyKey: `auth:login-attempt:${attempt.id}` },
);
await attempts.save({ id: attempt.id, requestId: otp.requestId, mobile }); // server-side
// POST /login/otp/verify
const result = await sms21.otp.check({ requestId: attempt.requestId, otp: body.code, mobile: attempt.mobile });
if (!result.verified) return reject(result.reason);
const user = await users.findByVerifiedMobile(result.verification.mobile);
return issueSession(user); // tokens are created by auth.pay2all.in, not SMS21