Skip to main content

create_access_token Method

Overview

The create_access_token method generates a short-lived authentication token for accessing payment processor APIs.

Business Use Case: Your frontend needs to initialize a payment widget. Generate a temporary token for client-side use.

Purpose

ScenarioBenefit
Frontend SDKsSecure client-side initialization
Delegated accessScoped tokens for third parties

Request Fields

FieldTypeRequiredDescription
scopestrNoToken scope
expires_inintNoToken lifetime in seconds

Response Fields

FieldTypeDescription
access_tokenstrThe token string
token_typestrBearer
expires_inintSeconds until expiry
status_codeintHTTP status code

Example

SDK Setup

from orchestratorx_prism import MerchantAuthenticationClient

auth_client = MerchantAuthenticationClient(
connector='stripe',
api_key='YOUR_API_KEY',
environment='SANDBOX'
)

Request

request = {
"scope": "payment:write",
"expires_in": 3600
}

response = await auth_client.create_access_token(request)

Response

{
"access_token": "sk_test_xxx",
"token_type": "Bearer",
"expires_in": 3600,
"status_code": 200
}

Next Steps