Contents

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

SystemOwns
auth.pay2all.inUsers, passwords, sessions, tokens, login and account-recovery flows. Decides when an OTP is needed.
SMS21Generating, delivering and verifying OTPs; SMS and WhatsApp delivery; DLT; delivery reports; messaging costs.
erp.pay2all.in, pay2all.in, trip2all.comTheir 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.
ProjectTypical scopesTypical use
authotp:send otp:verifyLogin, registration, password reset, mobile verification
pay2allotp:send otp:verify sms:send reports:readTransaction OTPs, payment receipts
erpsms:send whatsapp:send reports:readInvoices, reminders, staff alerts
trip2allsms:send whatsapp:send reports:readBooking confirmations, itinerary updates

Conventions

  • OTP purpose matches the flow: login, registration, password_reset, mobile_verification in auth; transaction for 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 appInfo in the SDK (auth-pay2all/2.3.0) so SMS21 request logs identify the caller.
  • Log requestId / messageId with 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