Calculate credit operation
Preview the cost of a transfer or revert without moving any credits. Use this to confirm amounts before calling the transfer or revert endpoints. The response shape differs between forward transfers and reverts. See the examples.
Reseller accounts only. Request access.
Number of minutes to calculate for.
Rate per minute for a forward transfer (e.g. 0.20). Not required when is_revert is true.
Set to true to calculate a revert instead of a forward transfer.
curl -X POST 'https://backend.omnidim.io/api/v1/reseller/credits/calculate' \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "minutes": 100, "cost_per_min": 0.2 }'
{ "success": false, "my_cost": 0, "user_credit": 0, "profit": 0, "margin": 0, "reseller_balance": 0, "reseller_available_minutes": 0, "new_reseller_balance": 0, "refund_amount": 0, "deduction_amount": 0, "child_balance": 0, "child_available_minutes": 0, "new_child_balance": 0, "reseller_rate": 0, "currency_symbol": "string" }
BearerAuthAuthorizationBearer <token>Bearer token authentication. Obtain your API key from the OmniDimension dashboard.
application/jsonminutes*integerNumber of minutes to calculate for.
cost_per_min?numberRate per minute for a forward transfer (e.g. 0.20). Not required when is_revert is true.
is_revert?booleanSet to true to calculate a revert instead of a forward transfer.
falsechild_organization_id?integerID of the child organization to revert credits from. Required when is_revert is true.
Response body
application/jsonCalculated outcome.
application/jsonsuccess?booleanmy_cost?numberForward only. Amount deducted from the reseller balance.
user_credit?numberForward only. Credit value the child receives at cost_per_min.
profit?numberForward only. user_credit - my_cost.
margin?numberForward only. Per-minute margin.
reseller_balance?numberForward only. Current reseller balance before the transfer.
reseller_available_minutes?integerForward only. Minutes the reseller could still transfer at its own rate.
new_reseller_balance?numberForward only. Reseller balance after the proposed transfer.
refund_amount?numberRevert only. Credits added back to the reseller.
deduction_amount?numberRevert only. Credits removed from the child at its current rate.
child_balance?numberRevert only. Child balance before the revert.
child_available_minutes?integerRevert only. Minutes available in the child's balance.
new_child_balance?numberRevert only. Child balance after the proposed revert.
reseller_rate?numberReseller's wholesale rate (cost per minute).
currency_symbol?string