Migrate your RPG Credentials
This guide is for partners who process payments via RPG on their merchants' behalf. Individual merchants don't need this — they can generate fresh credentials in the Teya Business Portal. To transact on the new ecommerce platform you need new client credentials, issued per store. You can obtain them by implementing the merchant registration flow, which is ideal for newly onboarding merchants. But to avoid disrupting your existing merchants or asking them to re-onboard, we have built a credentials exchange API that accepts RPG credentials and issues new ones.
1. How migration works
Repeat the exchange once per merchant store. Each store gets its own pair of credentials.
2. Exchange RPG credentials
Exchange a merchant's RPG private key for new ecommerce credentials:
POST https://ecom-gateway.teya.com/v1/ecommerce/legacy/credentials
Authentication
HTTP Basic with the merchant's existing RPG private key — the same scheme you already use for payments on RPG. The username is the private key exactly as it was provided to you; the password field is ignored.
Request
The body is optional. Provide webhook_url to register a payments webhook for the store — an endpoint on your platform where Teya sends a real-time notification when a payment succeeds (see Webhooks). It must be HTTPS with a publicly resolvable hostname, and it is what produces payment_webhook_public_key in the response.
Provide plugin_metadata if the merchant integrates through a plugin — it decides the application name recorded for the new credentials.
{
"webhook_url": "https://partner.example.com/teya/payments",
"plugin_metadata": {
"plugin_type": "ACME_SHOP",
"plugin_version": "1.0.0"
}
}
| Field | Required | Description |
|---|---|---|
webhook_url | No | Payments webhook to register for the store. Must be HTTPS with a publicly resolvable hostname |
plugin_metadata | No | The way for Teya to identify you as a partner. It helps us track partner usage, and debug and identify issues with your integration |
plugin_metadata.plugin_type | Yes, when plugin_metadata is supplied | The plugin the merchant integrates through, for example ACME_SHOP. When you begin your integration, Teya will assign an ENUM for you |
plugin_metadata.plugin_version | No | The version of the plugin |
Example: Exchange credentials
curl -X POST 'https://ecom-gateway.teya.com/v1/ecommerce/legacy/credentials' \
-u '<private_key>:' \
-H 'Content-Type: application/json' \
-d '{
"webhook_url": "https://partner.example.com/teya/payments",
"plugin_metadata": {"plugin_type": "ACME_SHOP", "plugin_version": "1.0.0"}
}'
Response
payment_webhook_public_key is null when no webhook_url was supplied.
{
"mid": "9256684",
"store_id": "3f2b8c14-7d5e-4a91-b8c2-9e1f0a6d4b73",
"client_id": "ecom_direct_8f41c9",
"client_secret": "cs_live_2Hq9...redacted",
"payment_webhook_public_key": "-----BEGIN PUBLIC KEY-----..."
}
| Field | Description |
|---|---|
mid | The RPG merchant ID the key authenticated as |
store_id | The Teya store mapped to that merchant ID |
client_id | OAuth client ID for the new ecommerce APIs |
client_secret | OAuth client secret for the new ecommerce APIs. Returned once and never stored — this is the only time it is available |
payment_webhook_public_key | Public key for verifying payment webhook signatures; null if no webhook_url was supplied |
| Response | Meaning |
|---|---|
200 | Credentials issued, and webhook registered when webhook_url was supplied |
400 | The supplied webhook_url or plugin_metadata cannot be used |
401 | The credentials are missing, malformed, or were rejected |
422 | The credentials are valid but the merchant is not eligible for migration |
500 | A service the flow depends on could not be reached |
Error codes
Error responses carry a JSON body with a code and a human-readable description:
{
"code": "MERCHANT_NOT_MAPPED",
"description": "Not yet available for this merchant."
}
| Code | Status | Meaning |
|---|---|---|
INVALID_WEBHOOK | 400 | The webhook_url is not HTTPS or not publicly resolvable |
BAD_REQUEST | 400 | The plugin_metadata is invalid — for example, plugin_type is missing or not a supported value |
UNAUTHORISED | 401 | The RPG key is missing, malformed, unknown or disabled |
MERCHANT_NOT_MAPPED | 422 | The merchant ID is not yet mapped to a Teya store — migration is not yet available for this merchant |
SUBSCRIPTION_NOT_FOUND | 422 | The store does not have an active ecommerce subscription |
INTERNAL_SERVER_ERROR | 500 | Credential verification is temporarily unavailable — retry later |
client_secret and payment_webhook_public_key in encrypted configuration or a secrets store. Never expose them in client-side code.
3. Use your new credentials
Exchange the client_id and client_secret for an access token, then call the Online Payments API on the merchant's behalf:
curl -X POST 'https://id.teya.com/oauth/v2/oauth-token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials' \
-d 'client_id=<client_id>' \
-d 'client_secret=<client_secret>' \
-d 'scope=<scopes for your products>'
The scopes you need depend on the products you integrate — see Required scopes by product.
Next steps
- Migration overview - The three-stage plan for migrating a merchant base
- Migrating from RPG - Map each RPG capability to its replacement
- Webhooks - Receive and verify payment notifications
- Embedded Components - Embed payment fields in your own UI
- Testing - Test cards and integration checklist
- API Reference - Full API endpoint documentation