Request authentication
Your server authenticates Payments v2 API requests with an enabled API Key of type API_KEY. Send its value in the ApiKey HTTP header. Payments v2 requests do not include the request sign field.
Choose the environment
| Environment | API base URL |
|---|---|
| Sandbox | https://sandbox-payment-api.onerway.com |
| Production | https://payment-api.onerway.com |
Use the credentials and IP allowlist for the environment you call. Complete Setup before sending requests.
Send the API Key
Include this header in every server-side Payments v2 API request:
ApiKey: replace_with_api_key
API_KEY is the credential type; the header name is ApiKey. Keep API Keys on your server. Do not include them in browser code, mobile binaries, public repositories, URLs, or logs.
The IP allowlist remains required. Add every public outbound IP address used by your servers to the allowlist for the target environment, even when you use an API Key.
Preserve the endpoint's inputs
Submit merchantNo and appId wherever the endpoint requires them. API Key authentication does not remove or change those requirements. The API Key must belong to the merchant identified by the request.
Keep the endpoint's existing wire types. Fields documented as JSON strings must still be serialized and sent as JSON strings, including any nested JSON-string fields. Removing request sign does not change the body format.
Use the Payments v2 API Reference for each endpoint's fields and examples. Response or client parameters named sign, such as WeChat Pay's presentContext.sign, retain their own purpose; follow the corresponding API or SDK instructions.
Rotate API Keys
A merchant can have multiple enabled API Keys. Enabling or disabling an API Key takes effect immediately for request authentication. To rotate a key:
- Create and enable a new
API_KEYfor the same environment and merchant. - Replace the key in your server configuration and verify that requests using it succeed.
- Disable the old API Key after every caller has switched to the new one.
API Keys and webhook signing keys are separate credentials. Changing an API Key does not replace the key used to verify notifications. Arrange webhook signing-key rotation separately.
Handle authentication failures
If the API Key belongs to a different merchant from the request's merchantNo, the API returns RS0024 with API key verification failed.
When authentication fails, check the API base URL, the API Key's environment, merchant and enabled state, and the server's outbound IP allowlist. Handle the returned error before retrying. Do not automatically resend the request to the API host used by Payments v1 or fall back to request signing.