Skip to content
Indiana
Dashboard
Docs
Browse docs / Prepare automatic payment authorization

Prepare automatic payment authorization

POST/api/v1/billing/authorizations/prepare

Pin the product, entitlement and amount limits and prepare the Sandbox payment method. Preparation does not enable automatic payments.

API v1Updated

Make the request

Pin the product, entitlement and amount limits and prepare the Sandbox payment method. Preparation does not enable automatic payments.

Credential
Customer token only. Identity is bound to the token.
Permission
billing:write
Set the base URL and App ID from SDK setup. These examples use placeholders and do not execute requests. Never put a server key in browser code.
For this Web Beta, configure the Stripe Sandbox test account and fixed Product Prices before checkout. Redirects do not confirm payment.
request.shShell
curl -X POST "$INDIANA_BASE_URL/api/v1/billing/authorizations/prepare" \  -H "Authorization: Bearer $INDIANA_CUSTOMER_TOKEN" \  -H "X-Indiana-Project: $INDIANA_PROJECT_ID" \  -H "X-Indiana-Protocol: 0.5" \  -H "X-Indiana-Environment: sandbox" \  -H "Content-Type: application/json" \  -d '{  "requestId": "00000000-0000-4000-8000-000000000001",  "productVersionId": "00000000-0000-4000-8000-000000000001",  "internal_feature_id": "00000000-0000-4000-8000-000000000001",  "kind": "auto_topup",  "currency": "USD",  "threshold": "100",  "quantity": "1000",  "purchaseLimit": {    "interval": "day",    "intervalCount": 1,    "limit": 1  }}'

The response tab lists field types, not an example payload. Actual values depend on customer state.

Request parameters

JSON body

requestIduuid | uuidRequired

Business request UUID. Reuse for retries of one operation; generate a new value for a new operation.

productVersionIduuid | uuidRequired

The productVersionId value for this operation. Its accepted type and constraints are listed above and below.

internal_feature_iduuid | uuidRequired

The internal_feature_id value for this operation. Its accepted type and constraints are listed above and below.

currencyenum | enumRequired

Currency code supported by the published price.

kind"auto_topup" | "postpaid"Required

The kind value for this operation. Its accepted type and constraints are listed above and below.

thresholdstringOptional

The threshold value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^-?(0|[1-9]\d{0,11})(\.\d{1,6})?$

quantitystringOptional

Use the declared field type for business quantity. Credit operations use decimal strings to avoid floating-point error. quote/reserve/confirm/refund require positive quantities; consume can record zero-cost events.

pattern: ^(0|[1-9]\d{0,11})(\.\d{1,6})?$

purchaseLimitobjectOptional

The purchaseLimit value for this operation. Its accepted type and constraints are listed above and below.

Show child fields
intervalenumRequired

The interval value for this operation. Its accepted type and constraints are listed above and below.

Show allowed values

"hour""day""week""month"

intervalCountintegerRequired

Charging interval count: up to 156 weeks, 36 months or 3 years; omitted means 1. Not accepted for free or one_time. Allowance resets remain independent.

min: 1 · max: 12

limitintegerRequired

Maximum records per page, subject to the contract limit.

min: 1 · max: 1000000

maxAmountMinorPerPeriodstringOptional

The maxAmountMinorPerPeriod value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(?:[1-9]\d{0,7}|1\d{8}|200000000)$

maxOutstandingMinorstringOptional

The maxOutstandingMinor value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(?:[1-9]\d{0,7}|1\d{8}|200000000)$

Response fields

Successful responses include requestId and scope. Use the actual business status or accepted field to determine the result. Optional fields are omitted when unavailable.

HTTP 200 · application/json

requestIduuidRequired

Server-generated HTTP request UUID. Include it when reporting a failed request.

scopeobjectRequired

The App and environment of this response. Headers only verify scope; they cannot switch key scope.

Show child fields
projectIdstringRequired

App ID bound to the credential.

minLength: 1

environmentenumRequired

Separate data scope: sandbox or live.

Show allowed values

"sandbox""live"

preparedobjectRequired

The prepared value for this operation. Its accepted type and constraints are listed above and below.

Show child fields
authorizationIduuidRequired

The authorizationId value for this operation. Its accepted type and constraints are listed above and below.

termsobject | objectRequired

The terms value for this operation. Its accepted type and constraints are listed above and below.

Show child fields
productVersionIduuid | uuidRequired

The productVersionId value for this operation. Its accepted type and constraints are listed above and below.

internal_feature_iduuid | uuidRequired

The internal_feature_id value for this operation. Its accepted type and constraints are listed above and below.

currencyenum | enumRequired

Currency code supported by the published price.

kind"auto_topup" | "postpaid"Required

The kind value for this operation. Its accepted type and constraints are listed above and below.

thresholdobjectOptional

The threshold value for this operation. Its accepted type and constraints are listed above and below.

quantityobjectOptional

Use the declared field type for business quantity. Credit operations use decimal strings to avoid floating-point error. quote/reserve/confirm/refund require positive quantities; consume can record zero-cost events.

purchaseLimitobjectOptional

The purchaseLimit value for this operation. Its accepted type and constraints are listed above and below.

Show child fields
intervalenumRequired

The interval value for this operation. Its accepted type and constraints are listed above and below.

Show allowed values

"hour""day""week""month"

intervalCountintegerRequired

Charging interval count: up to 156 weeks, 36 months or 3 years; omitted means 1. Not accepted for free or one_time. Allowance resets remain independent.

min: 1 · max: 12

limitintegerRequired

Maximum records per page, subject to the contract limit.

min: 1 · max: 1000000

purchaseAmountMinorstringOptional

The purchaseAmountMinor value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(?:[1-9]\d{0,7}|1\d{8}|200000000)$

purchaseUnitsobjectOptional

The purchaseUnits value for this operation. Its accepted type and constraints are listed above and below.

maxAmountMinorPerPeriodstringOptional

The maxAmountMinorPerPeriod value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(?:[1-9]\d{0,7}|1\d{8}|200000000)$

maxOutstandingMinorstringOptional

The maxOutstandingMinor value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(?:[1-9]\d{0,7}|1\d{8}|200000000)$

cashPriceobjectOptional

The cashPrice value for this operation. Its accepted type and constraints are listed above and below.

Show child fields
currencyenumRequired

Currency code supported by the published price.

Show allowed values

"USD""EUR""CNY""GBP""JPY""CAD""AUD""NZD""CHF""HKD""SGD""KRW""INR""BRL""MXN""TWD""THB""IDR""MYR""PHP""VND""ZAR""AED""SAR""SEK""NOK""DKK""PLN""CZK""HUF""ILS""TRY""RON"

pricingobject | objectRequired

The pricing value for this operation. Its accepted type and constraints are listed above and below.

billingCycleobjectOptional

The billingCycle value for this operation. Its accepted type and constraints are listed above and below.

setupUrluri | nullRequired

The setupUrl value for this operation. Its accepted type and constraints are listed above and below.

Handle errors

Common failures
CodeRecovery
UNAUTHENTICATEDVerify the key or refresh the expired customer token once.
FORBIDDENCheck current key permissions and customer access.
INVALID_REQUESTCheck field types, UUIDs, decimal strings and mutually exclusive fields.
SCOPE_MISMATCHUse the App and environment bound to the credential.

Common failures

  • UNAUTHENTICATED

    Recovery
    Verify the key or refresh the expired customer token once.
  • FORBIDDEN

    Recovery
    Check current key permissions and customer access.
  • INVALID_REQUEST

    Recovery
    Check field types, UUIDs, decimal strings and mutually exclusive fields.
  • SCOPE_MISMATCH

    Recovery
    Use the App and environment bound to the credential.

Related:All request and error conventions·Back to endpoint index