Record an App Store purchase
POST
/v1/purchases
const url = 'https://api.pocketbell.dev/v1/purchases';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"signed_transaction":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
signed_transaction
required
The transaction’s JWS, as StoreKit gives it.
string
Examplegenerated
{ "signed_transaction": "example"}Responses
Section titled “Responses”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
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" }}