PhonePe
www.phonepe.com/ ↗No user-delegated OAuth: the only published flow is a merchant client_credentials token (self-serve once your Business account and V2 keys exist), while acting for PhonePe users means Switch partner onboarding plus app review, with no published timeline.
01Pick your path
02Time & effort
- DEVMerchant account + KYC1–3 daysinferred[S10]Sources state an active PhonePe Business account is a prerequisite but give no KYC duration.
- DEVSupport ticket for V2 credentials/roleswait 1–5 dayssourced[S4]Conditional: skip if Developer Settings already shows client_id/client_secret/client_version. Ticket turnaround is inferred.
- DEVToken fetch + refresh logic30–90 minutesinferred[S6]Endpoint and parameters are documented; coding time is an estimate.
- DEVSandbox end-to-end (pay, webhook, status)2–6 hoursinferred[S7][S10]Four documented steps: token, create payment, PayPage, verify via webhook or Order Status.
- PRODGo live: whitelist URL, live keys, webhook1–3 daysinferred[S4]Whitelisting is done 'on our end' per troubleshooting docs; production review time is not stated.
- PRODSwitch onboarding + app review (only user-auth path)wait 2–8 weeksinferred[S5]Switch docs list 'Submitting your App for review' and 'Process of going live' but publish no SLA or criteria.
03Steps
Get a working connection
Both /.well-known/openid-configuration and /.well-known/oauth-authorization-server return 404 on api.phonepe.com and developer.phonepe.com. There is no standards OAuth authorization-code flow to point an agent at; the documented auth is a client_credentials token for merchants.
↗ developer.phonepe.com/payment-gateway/website-integration/standard-checkout/api-integration/api-reference/authorizationGet the merchant account first — credentials live behind it. Then open Dashboard → Developer Settings and confirm you see client_id, client_secret and client_version (the V2 trio). If the dashboard only shows salt keys, you are on the deprecated V1 flow.
“Ensure that you are using the correct Credentials(V2) which are present on the PhonePe Dashboard under ’Developer Settings’.” — [S4] verified verbatim
◆ prepared by agent · PhonePe Business sign-uphttps://developer.phonepe.com/
The documented path to V2 credentials or extra API roles (custom checkout, Payment Links) is a support ticket to the integration team; credentials are issued per integrationType. Include your merchant ID, flow and sandbox/production environments.
“You need to raise a support ticket to the integration team in order to release PG V2 credentials.” — [S4] verified verbatim
POST form-encoded client_id/client_version/client_secret/grant_type=client_credentials. Cache access_token and refresh off expires_at (epoch seconds) at least 5 minutes before expiry — expires_in comes back null. Use the O-Bearer prefix on every later call.
“Ensure you are using a complete valid access token. We recommend generating a new access token at least 5 minutes before your current one is set to expire..” — [S4] verified verbatim
◆ prepared by agent · Token fetch + refresh helperimport time, requests TOKEN_URL = "https://api-preprod.phonepe.com/apis/pg-sandbox/v1/oauth/token" # prod: https://api.phonepe.com/apis/identity-manager/v1/oauth/token _cache = {"token": None, "exp": 0} def get_token(): if _cache["token"] and time.time() < _cache["exp"] - 300: # refresh ~5 min early return _cache["token"] r = requests.post( TOKEN_URL, headers={"Content-Type": "application/x-www-form-urlencoded"}, data={ "client_id": CLIENT_ID, "client_secret": CLIENT_SECRET, "client_version": CLIENT_VERSION, "grant_type": "client_credentials", }, timeout=15, ) r.raise_for_status() d = r.json() _cache["token"] = d["access_token"] _cache["exp"] = d["expires_at"] # epoch seconds; expires_in is null return _cache["token"] # then: headers={"Authorization": f"O-Bearer {get_token()}", "Content-Type": "application/json"}Sandbox base: https://api-preprod.phonepe.com/apis/pg-sandbox/. Create payment → invoke PayPage → verify via webhook (checkout.order.completed / failed, pg.refund.completed / failed) or Order Status API. Rely only on root-level payload.state, not a nested field.
Make it production-ready
Swap in the identity-manager + /apis/pg base URLs, register your exact production domain/sub-domain (one URL per merchant ID), and point the dashboard webhook at an HTTPS URL with no IP or port. Keep Order Status polling as the fallback.
“Ensure you have created a valid webhook url, with no IP address or port number in it and https method and accept post json data.” — [S4] verified verbatim
If you genuinely need user-level sessions, the only documented route is Switch: merchant apps hosted inside PhonePe with an SSO flow and an app review submission. There is no published Apply button in the fetched docs — go through your BD representative / support ticket.
◆ prepared by agent · Switch access request draftSubject: Switch onboarding + SSO for a third-party app Hi PhonePe partner team, We are an existing PhonePe merchant (merchant ID: XXXX) building an in-app experience for the "<category>" section of PhonePe Switch. Our app is a <React Native / PWA / M-Site> build. We would like to (a) get Switch onboarding prerequisites, (b) confirm what the SSO flow (fetchAuthToken → access token → user details) exposes and what user consent is shown, and (c) the app-review checklist and expected timeline for going live. Use case: <one paragraph, transaction volume estimate, screenshots of the flow>. Thanks, <name>, <company>
04Requirements, scopes & nuances
You'll need
- ▸An active PhonePe Business merchant account (sign-up + business KYC). sourced ❝[S10]
- ▸Client_ID, Client_Secret and Client_Version from the PhonePe Business Dashboard → Developer Settings. sourced ❝[S10][S6]
- ▸A backend server to hold credentials (browser calls fail with CORS). sourced ❝[S4]
- ▸One registered/whitelisted HTTPS domain or sub-domain for production; localhost is not accepted. inferred[S4]
- ▸A webhook URL on the dashboard: HTTPS, no IP/port, accepts POST JSON, returns an acknowledgement. sourced ❝[S4]
- ▸For user-level auth inside the PhonePe app: a Switch app (React Native, PWA or M-Site) submitted for review. sourced ❝[S5]
Gotchas
- !The Authorization header prefix is 'O-Bearer <token>' (with the space), not 'Bearer'; wrong prefix causes 401/API Mapping Not Found. sourced ❝[S4]
- !The token response returns expires_in: null — schedule refresh off expires_at (epoch seconds) and regenerate ~5 minutes before expiry. inferred[S6][S4]
- !Only one URL can be whitelisted per merchant ID, and you whitelist either a domain or a sub-domain, not both. sourced ❝[S4]
- !V1 salt_key/salt_index credentials are deprecated and cannot be generated; any tutorial using them is dead. sourced ❝[S4]
- !Webhook URL must be HTTPS, contain no IP address or port, accept POST JSON, and return an acknowledgement — and you still need Order Status API as fallback. sourced ❝[S4]
- !Token and payment calls must run from your backend; browser calls hit CORS errors. sourced ❝[S4]
| Scope / permission | Tier | Note | Evidence |
|---|---|---|---|
| client_credentials grant (no scope parameter) | restricted | Token request takes only client_id, client_version, client_secret, grant_type. There is no scope list and no user consent screen — the token carries your merchant's full PG rights. | inferred[S6] |
| Payment Links API role | gated | Gated: requires sharing a business use case with the integration team; role is assigned after approval. | sourced ❝[S4] |
| Switch SSO user details | gated | User identity inside the PhonePe app via fetchAuthToken + Get User Details; only for merchants onboarded to Switch. | inferred[S5] |
05If you get blocked
→ Treat PhonePe as a merchant-side payment rail (agent acts for your business, not for the end user), or apply to PhonePe Switch if you truly need user identity inside the PhonePe app.
→ Open a support ticket to the integration team; credentials are issued per integrationType/flow. V1 salt keys cannot be reissued.
→ Whitelist the real registered domain/sub-domain before go-live and never test production from localhost.
06Evidence: what was tested, sourced, and still uncertain
Sources read
- [S1] PhonePe Business Developer Documentation | Integration Guide official
- [S2] Payment Gateway | PhonePe Business Developer Documentation official
- [S3] Payment Gateway | PhonePe Business Developer Documentation | Integration Guide official
- [S4] Troubleshooting | PhonePe Business Developer Documentation | Integration Guide official
- [S5] Switch | PhonePe Business Developer Documentation | Integration Guide official
- [S6] Authorization | PhonePe Business Developer Documentation official
- [S7] Integration Steps | PhonePe Business Developer Documentation official
- [S8] Offline Integration official
- [S9] Introduction | PhonePe Business Developer Documentation official
- [S10] Introduction to Website Checkout official
- [composio] Composio — Managed OAuth apps directory official
- [probe] Live HTTP probes run by the agent (dummy client_id, no credentials) probe
Still uncertain
- ? Sources never state approval durations for merchant KYC, V2 credential tickets, URL whitelisting, or Switch app review — all waits here are inferred.
- ? Whether PhonePe offers any 'Sign in with PhonePe' style user-delegated OAuth to arbitrary third-party apps is not shown in any fetched source; the planner's 'unclear' is really 'not published'. Ask PhonePe before promising user-level auth.
- ? Switch pages were fetched only as a table of contents — user-consent behaviour of its SSO flow (fetchAuthToken / Get User Details) and onboarding criteria are unverified.
- ? Scope/role granularity is undocumented: the token appears merchant-wide, so an agent holding it can do anything the merchant can (payments, refunds) — no least-privilege options are described.
- ? Whether new merchants automatically get V2 credentials or must always raise a ticket is ambiguous in the troubleshooting doc.
- ? Generated automatically; no app was registered and no review was submitted.