Skip to content

Record an App Store purchase

POST
/v1/purchases
curl --request POST \
--url https://api.pocketbell.dev/v1/purchases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "signed_transaction": "example" }'

After a purchase or a restore. The server checks Apple’s signature and that the purchase is this account’s.

Media typeapplication/json
object
signed_transaction
required

The transaction’s JWS, as StoreKit gives it.

string
>= 1 characters <= 16384 characters
Examplegenerated
{
"signed_transaction": "example"
}

Recorded; the account as it is now.

Media typeapplication/json
object
app_account_token
required

Set as the appAccountToken of every App Store purchase, so the purchase is tied to this account.

string format: uuid
plan
required
string
Allowed values: free pro
limits
required
object
sources
required

Null: no limit.

integer | null
monthly_messages
required
integer
history_days
required
integer
usage
required
object
sources
required
integer
messages_this_month
required
integer
quiet_hours
required

Minutes after midnight in time_zone; Normal notifications arrive silently between. Null: off.

object
start
required
integer
end
required
integer
time_zone
required
string
Example
{
"plan": "free"
}

Not a valid Pocketbell purchase.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
details

Which fields were wrong, for invalid_request.

Array<object>
object
field
required
string
message
required
string
Example
{
"error": {
"code": "invalid_request"
}
}

Missing or ended session.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
details

Which fields were wrong, for invalid_request.

Array<object>
object
field
required
string
message
required
string
Example
{
"error": {
"code": "invalid_request"
}
}

The purchase belongs to another account.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
details

Which fields were wrong, for invalid_request.

Array<object>
object
field
required
string
message
required
string
Example
{
"error": {
"code": "invalid_request"
}
}