Files
timelimit-server/docs/api/purchase.md
T
2026-06-15 02:00:00 +02:00

1.9 KiB

/purchase

This endpoint is used for handling purchases from the client. It currently only supports purchases using Google Play in app purchases.

see

POST /purchase/can-do-purchase

Use this before a purchase to check if a purchase is possible.

request

see this JSON schema

Note that type is not used at all.

response

On a invalid request body: HTTP status code 400 Bad request

On a invalid auth token: HTTP status code 401 Unauthorized

On success: a JSON object with the property canDoPurchase (string), googlePlayPublicKey (string, base64) and permitDebts (boolean, optional, default false).

possible values of canDoPurchase:

  • yes
  • no due to old purchase
  • no because not supported by the server

The googlePlayPublicKey is the key by which purchases using google play should be signed.

POST /purchase/finish-purchase-by-debts

Use this to unlock without payment. Limitations apply.

request

see this JSON schema

Note that type is not used at all.

response

On a invalid request body: HTTP status code 400 Bad request

On a invalid auth token: HTTP status code 401 Unauthorized

If not granted: HTTP status code 409 Conflict

On success: HTTP status code 200

POST /purchase/finish-purchase-by-google-play

Use this to report a purchase to the server/ unlock all features after a purchase using Google Play.

request

see this JSON schema

response

On a invalid request body: HTTP status code 400 Bad request

On a invalid auth token: HTTP status code 401 Unauthorized

On a invalid purchase: HTTP status code 409 Conflict

On success: {"ok": true}

error handling

  • if the purchase was already added (for the same or an other family), then this request is ignored and success is returned