Skip to content
Niu DocsNiu 牛元文档
Dashboard控制台

Save encrypted EPay configuration with platform administrator write access

Generated from the checked-in source. Do not edit this reference by hand.

PUT /api/v1/platform/payments/epay

Validates enabled checkout configuration before persistence. An empty key retains the stored credential. Exact expected_revision prevents overwriting concurrent edits. Pending EPay orders prevent credential and checkout-field changes; enabling or disabling unchanged settings remains available and existing orders can still settle. Saves an append-only audit event and takes effect without restarting the gateway. This configures the classic EPay protocol; it does not establish merchant eligibility or live payment qualification. Supported method names and uniqueness are validated even when disabled; a disabled draft may use an empty methods list.

Operation: savePlatformEPayConfiguration.

Use the credential and permission scope described above. Each object below is an alternative; schemes within one object are required together.

JSON
[
{
"bearerAuth": []
}
]

Set NIU_ORIGIN to your installation origin (without /v1). Replace path, query and header placeholders with the required values. Query examples use curl 7.87 or newer to encode values with --url-query. Use the credential scope described above; a bearer token must have the authority required by this operation.

Shell
curl --fail-with-body -X PUT "$NIU_ORIGIN/api/v1/platform/payments/epay" \
-H "Authorization: Bearer $NIU_BEARER_TOKEN" \
-H 'Content-Type: application/json' \
--data @request.json

No path, query, or header parameters are declared.

Required.

JSON
{
"type": "object",
"additionalProperties": false,
"required": [
"expected_revision",
"enabled",
"merchant_id",
"key",
"endpoint",
"notify_url",
"return_url",
"methods"
],
"properties": {
"expected_revision": {
"type": "string",
"pattern": "^[0-9]+$"
},
"enabled": {
"type": "boolean"
},
"merchant_id": {
"type": "string"
},
"key": {
"type": "string",
"writeOnly": true
},
"endpoint": {
"type": "string",
"description": "HTTPS gateway base or complete submit.php endpoint. A base path gets /submit.php appended; a supplied submit.php is preserved, including subdirectories. Trailing slashes are normalized. Query strings, fragments and URL credentials are rejected. The complete encoded checkout must fit 2048 bytes for the largest supported order and amount; invalid enabled configuration is rejected before persistence. Existing saved checkout URLs are not rewritten."
},
"notify_url": {
"type": "string"
},
"return_url": {
"type": "string"
},
"methods": {
"type": "array",
"maxItems": 2,
"uniqueItems": true,
"items": {
"type": "string",
"enum": [
"alipay",
"wxpay"
]
}
}
}
}

Sanitized saved configuration in data, without key

Content type: application/json.

JSON
{
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"type": "object",
"additionalProperties": false,
"required": [
"merchant_id",
"endpoint",
"notify_url",
"return_url",
"revision",
"enabled",
"has_key",
"methods"
],
"properties": {
"merchant_id": {
"type": "string"
},
"endpoint": {
"type": "string",
"description": "HTTPS gateway base or complete submit.php endpoint. A base path gets /submit.php appended; a supplied submit.php is preserved, including subdirectories. Trailing slashes are normalized. Query strings, fragments and URL credentials are rejected. The complete encoded checkout must fit 2048 bytes for the largest supported order and amount; invalid enabled configuration is rejected before persistence. Existing saved checkout URLs are not rewritten."
},
"notify_url": {
"type": "string"
},
"return_url": {
"type": "string"
},
"revision": {
"type": "string",
"pattern": "^[0-9]+$"
},
"enabled": {
"type": "boolean"
},
"has_key": {
"type": "boolean"
},
"methods": {
"type": "array",
"items": {
"type": "string"
},
"description": "Saved methods or deployment defaults; legacy disabled configurations may contain unsupported values. Writes accept only alipay and wxpay."
}
}
}
}
}

Invalid configuration

Authentication required

Platform administrator write access required

Revision conflict or unresolved payment orders

Malformed JSON shape, missing fields or unknown fields

Encryption unavailable or stored configuration cannot be opened

Durable storage unavailable

Validates enabled checkout configuration before persistence. An empty key retains the stored credential. Exact expected_revision prevents overwriting concurrent edits. Pending EPay orders prevent credential and checkout-field changes; enabling or disabling unchanged settings remains available and existing orders can still settle. Saves an append-only audit event and takes effect without restarting the gateway. This configures the classic EPay protocol; it does not establish merchant eligibility or live payment qualification. Supported method names and uniqueness are validated even when disabled; a disabled draft may use an empty methods list.

Supported scope: implemented