Beta — OAuth apps are currently in beta. The flow is stable and available to all businesses, but the API surface is still expanding and details may change. Share feedback at support@hit-pay.com.
Overview
If you run a marketplace, SaaS platform, or any tool that serves HitPay merchants, you can add a “Connect your HitPay account” button to your product. Merchants authorize your app once, and your platform receives API tokens to act on their behalf — create payment requests, look up charges, and issue refunds. This is the structured alternative to collecting merchants’ API keys: access is scoped, revocable, and no secrets change hands. (New to HitPay’s platform model? Start with the Platforms overview for how the integration paths compare.) The integration uses the industry-standard OAuth 2.0 authorization code flow:- You create an app in the HitPay Dashboard and receive a client ID and client secret.
- Your platform redirects the merchant to HitPay’s authorization page.
- The merchant reviews the permissions your app is requesting and approves the connection.
- HitPay redirects the merchant back to your platform with an authorization code.
- Your server exchanges the code for an access token and refresh token.
- You call the HitPay API with the access token, scoped to that merchant’s business.
Looking to collect a platform commission on transactions? OAuth handles account access only — to take commissions, have your account platform-enabled and pass your
X-PLATFORM-KEY header alongside the Bearer token when creating payment requests. See Platform Key.Create your app
1
Open the App Builder
In the HitPay Dashboard, go to Developers → App Builder and click New App. You need to be an Owner or Admin of your business.
2
Fill in your app details
3
Save your client credentials
After creating the app you’ll see your Client ID and Client Secret.
4
Request the scopes you need
New apps start with the
business:read scope only. To act on payments, open your app’s detail panel, click Request Scopes, select the scopes your integration needs, and describe your use case. HitPay reviews scope requests and you’ll see the status (pending, approved, or rejected) in the same panel.Scopes
Request only the scopes your integration actually needs — merchants see the full list on the authorization screen.
Step 1: Redirect the merchant to HitPay
When the merchant clicks Connect your HitPay account on your platform, redirect them to:What the merchant sees
The merchant signs in to HitPay (if they aren’t already) and lands on the authorization screen, which shows your app’s name and icon and the permissions you’re requesting. If the merchant manages multiple businesses, they choose which business to connect. Only business Owners and Admins can authorize an app. The merchant then clicks Authorize or Deny access.Step 2: Handle the redirect
If the merchant approves, HitPay redirects back to yourredirect_uri with an authorization code:
state matches the value you sent, then move on to the token exchange. Authorization codes are short-lived and single-use.
If the merchant denies access, the redirect includes an error instead:
Step 3: Exchange the code for tokens
From your server, exchange the authorization code for an access token:Response
The token endpoint is rate-limited to 90 requests per minute.
Step 4: Call the API on the merchant’s behalf
Authenticate API calls by sending the access token as a Bearer token. The main endpoint you’ll use is the Payment Request API — create a payment request for the connected merchant, then redirect your customer to the returned checkouturl:
Response
X-BUSINESS-API-KEY header, and the payment is created on the connected merchant’s account.
The following endpoints accept OAuth access tokens:
Getting notified of payments
Pass awebhook URL when creating each payment request — HitPay will notify that URL when the payment completes, regardless of the merchant’s own webhook configuration:
X-PLATFORM-KEY, charge events for your merchants’ payments are additionally delivered to the webhook endpoints registered on your platform account — see Unified webhooks.
Disconnecting
Merchants can revoke your app at any time from Developers → Connected Apps in their HitPay Dashboard. Revocation immediately invalidates all access and refresh tokens for that merchant. There is no disconnect notification, so treat a401 Unauthorized response as the merchant having revoked access: mark the account as disconnected in your system and prompt the merchant to reconnect if needed.
Also note that regenerating your client secret or deleting your app invalidates the tokens of all connected merchants.
Testing in sandbox
The full flow works in the sandbox environment with a separate sandbox app:- Create a sandbox account and build your app under Developers → App Builder.
- Create a second sandbox account to play the role of the merchant connecting to your platform.
- Use the sandbox hosts throughout:
https://dashboard.sandbox.hit-pay.com/oauth/authorizefor authorization andhttps://api.sandbox.hit-pay.com/v1/open/oauth/tokenfor tokens.
FAQs
How is this different from a direct API key integration?
How is this different from a direct API key integration?
A direct API key integration requires each merchant to generate and hand you their API key, which grants full account access. OAuth replaces the manual key exchange with a one-click authorization flow, gives merchants scoped (rather than full) access control, and lets them revoke your access without rotating their own keys. Either way, commissions and unified webhooks come from the separate Platform Key, which works with both.
Can one merchant connect multiple businesses?
Can one merchant connect multiple businesses?
Yes. Each authorization connects exactly one business (the merchant picks which during the flow). To connect another business, send the merchant through the authorization flow again and store the resulting tokens separately.
What happens if I request a scope my app hasn't been granted?
What happens if I request a scope my app hasn't been granted?
The authorization request is rejected. Only request scopes that have been approved for your app — you can see your app’s granted scopes in its detail panel under Developers → App Builder.
Do access tokens expire?
Do access tokens expire?
Yes, after one year. Use the refresh token to obtain a new access token. If both have expired or been revoked, send the merchant through the authorization flow again.