Skip to main content
POST
/
oauth
/
permission_token
/
exchange
import cobo_waas2
from cobo_waas2.models.exchange_permission_token201_response import (
    ExchangePermissionToken201Response,
)
from cobo_waas2.models.exchange_permission_token_request import (
    ExchangePermissionTokenRequest,
)
from cobo_waas2.rest import ApiException
from pprint import pprint

# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
    # Replace `<YOUR_PRIVATE_KEY>` with your private key
    api_private_key="<YOUR_PRIVATE_KEY>",
    # Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
    host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cobo_waas2.OAuthApi(api_client)
    exchange_permission_token_request = cobo_waas2.ExchangePermissionTokenRequest(
        permission_type="payment_orders_payin"
    )

    try:
        # Get Access Token
        api_response = api_instance.exchange_permission_token(
            exchange_permission_token_request
        )
        print("The response of OAuthApi->exchange_permission_token:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling OAuthApi->exchange_permission_token: %s\n" % e)

{
  "access_token": "AnCEPEp5Q8qjAOA1Lb6kVd2OlkCyJnMTeMPdLbPOM8cz176Eb5y7EJoUjJJ0vkzz",
  "token_type": "<string>",
  "expires_in": 123,
  "refresh_token": "rK49jI0zt49gsttzscscik15Asmlpu1TdcxqguJJS8B9f6ilJEC0y3PbVqwsEAw5"
}
import cobo_waas2
from cobo_waas2.models.exchange_permission_token201_response import (
    ExchangePermissionToken201Response,
)
from cobo_waas2.models.exchange_permission_token_request import (
    ExchangePermissionTokenRequest,
)
from cobo_waas2.rest import ApiException
from pprint import pprint

# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
    # Replace `<YOUR_PRIVATE_KEY>` with your private key
    api_private_key="<YOUR_PRIVATE_KEY>",
    # Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
    host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cobo_waas2.OAuthApi(api_client)
    exchange_permission_token_request = cobo_waas2.ExchangePermissionTokenRequest(
        permission_type="payment_orders_payin"
    )

    try:
        # Get Access Token
        api_response = api_instance.exchange_permission_token(
            exchange_permission_token_request
        )
        print("The response of OAuthApi->exchange_permission_token:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling OAuthApi->exchange_permission_token: %s\n" % e)

Authorizations

BIZ-API-KEY
string
header
required

The API key. For more details, refer to API key.

In the API playground, enter your API secret, and your API key will be accordingly calculated.

Body

application/json

The request body to acquire an Access Token.

permission_type
string
required

Set the value to payment_orders_payin.

Example:

"payment_orders_payin"

Response

The request was successful.

access_token
string

The Access Token.

Example:

"AnCEPEp5Q8qjAOA1Lb6kVd2OlkCyJnMTeMPdLbPOM8cz176Eb5y7EJoUjJJ0vkzz"

token_type
string

The token type. This is always Bearer.

expires_in
integer

The time in seconds until the Access Token expires. This is always 3600, indicating the token expires 1 hour after issuance.

refresh_token
string

The Refresh Token. Use it to obtain a new Access Token when the current one expires. The Refresh Token is valid for 7 days.

Example:

"rK49jI0zt49gsttzscscik15Asmlpu1TdcxqguJJS8B9f6ilJEC0y3PbVqwsEAw5"