Authorize Chain
Authorize a pending chain connection request. This allows a sub-merchant to approve a chain connection, granting the requesting account permission to create charges and perform actions on their behalf.
Request Parametersโ
Required - 1 fieldPath Parameters
`id`STRING(required)
Chain identifier matching pattern /acch(_test)?_[0-9a-z]+/. This is provided in the URL path.
Responsesโ
200
Successful authorizationChain authorized successfully. The chain connection is now active and the requesting account can perform actions on behalf of the sub-merchant.
Response includes:
id- Chain identifierkey- Authentication key for the sub-merchantemail- Sub-merchant account emailrevoked- Will be false after authorizationlivemode- Production vs test environment indicatorcreated_at- Creation timestamp
400
Bad requestRequest validation failed. Check the error message for details.
Common causes:
- Invalid chain ID format
- Chain is already authorized
- Chain has been revoked
401
UnauthorizedAuthentication failed. Invalid or missing API key.
Common causes:
- Missing Authorization header
- Invalid secret key
- Using public key instead of secret key
- Incorrect HTTP Basic Auth format
404
Not foundChain not found with the provided ID.
Common causes:
- Invalid chain ID format
- Chain does not exist
- Chain belongs to different account
- Using test key with live chain ID (or vice versa)
5xx
Server errorServer-side error occurred. These are rare but should be handled gracefully.
How to handle:
- Retry the request with exponential backoff
- Check status.omise.co for service incidents
- See Error Handling for detailed guidance
Code samplesโ
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/chains/acch_test_5xuy4w91xqz7d1w9u0t/authorize \
-X POST \
-u skey_test_5xuy4w91xqz7d1w9u0t:
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
chain = Omise::Chain.retrieve('acch_test_5xuy4w91xqz7d1w9u0t')
chain.authorize
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
chain = omise.Chain.retrieve('acch_test_5xuy4w91xqz7d1w9u0t')
chain.authorize()
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const chain = await omise.chains.authorize('acch_test_5xuy4w91xqz7d1w9u0t');
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$chain = OmiseChain::retrieve('acch_test_5xuy4w91xqz7d1w9u0t');
$chain->authorize();
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Chain chain = client.chains().authorize("acch_test_5xuy4w91xqz7d1w9u0t");
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var chain = await client.Chains.Authorize("acch_test_5xuy4w91xqz7d1w9u0t");
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
chain, _ := client.Chains().Authorize("acch_test_5xuy4w91xqz7d1w9u0t")
Error and result codesโ
Common Error Codesโ
| Code | Description | Resolution |
|---|---|---|
authentication_failure | Invalid API key | Verify your secret key is correct |
not_found | Chain not found | Check chain ID is correct and exists |
invalid_chain_id | Malformed chain ID | Ensure ID matches format acch(test)?[0-9a-z]+ |
already_authorized | Chain is already authorized | Chain has already been authorized |
chain_revoked | Chain has been revoked | Cannot authorize a revoked chain |
Chain Object Fieldsโ
| Field | Type | Description |
|---|---|---|
object | string | Always returns "chain" |
id | string | Unique chain identifier |
key | string | Authentication key for performing actions on behalf of the sub-merchant |
email | string | Sub-merchant account email |
livemode | boolean | Production vs test environment indicator |
revoked | boolean | Indicates if chain access has been revoked |
created_at | string | Creation timestamp (ISO 8601) |
API Credentials
Try it outโ
Your IP:
...Loading...