Skip to main content

Service Pre-Authorization

Endpoint:

https://api.betatel.com/api/billing/services/preauth

Method: POST

Description: Verify if a user has sufficient funds for a service and create a billing event.

Request Headers

The request must include an Authorization header with a valid API key for authentication:

HeaderValueRequiredDescription
x-api-key{{x-api-key}}YesThe authentication api key to verify the user's identity

Request Body

Your request should contain the userId,serviceId,phoneNumber,quantity:

{
"userId": "rzeureu2626323232",
"serviceId": "svc_mobile_sms",
"phoneNumber": "+4412345678",
"quantity": 150
}
ParamValueTypeRequiredDescription
userIdrzeureu2626323232StringYesThe user's Id
serviceIdsvc_mobile_smsStringYesThe service Id
phoneNumber+4412345678StringYesPhone nymber
quantity150IntYesQuantity

Let’s Dive Into the Code!

Choose your preferred programming language and use the provided examples to integrate the post service pre-Authorization.

Example - cURL
curl --location 'https://api.betatel.com/api/billing/services/preauth' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ••••••' \
--data '{
"userId": "rzeureu2626323232",
"serviceId": "svc_mobile_sms",
"phoneNumber": "+4412345678",
"quantity": 150
}'

Response

JSON Schema:

{
"correlationId": "evt_b4f82932",
"userId": "user123",
"serviceId": "svc_mobile_sms",
"status": "AUTHORIZED",
"estimatedCost": 1.80,
"currency": "USD",
"timestamp": "2025-03-18T14:32:05Z"
}
FieldTypeDescription
correlationIdstringA unique identifier for the authorization request (e.g., "evt_b4f82932").
userIdstringThe unique identifier for the user (e.g., "user123").
serviceIdstringThe identifier for the service being authorized (e.g., "svc_mobile_sms").
statusstringThe authorization status of the request (e.g., "AUTHORIZED").
estimatedCostnumberThe estimated cost for the service (e.g., 1.80).
currencystringThe currency in which the estimated cost is represented (e.g., "USD").
timestampstringThe timestamp of when the authorization was processed (e.g., "2025-03-18T14:32:05Z").