Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent
with a free APIs.io key —
sign in with
GitHub,
Google or
LinkedIn.
No form to fill in; signing in shares your email address with us (Privacy).
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
title: V³ News API v3 Billing Apple API
version: 0.1.0
tags:
- name: billing-apple
paths:
/billing/apple/validate-receipt:
post:
tags:
- billing-apple
summary: Validate Receipt
description: 'Verify a StoreKit purchase and upsert the member''s Apple
subscription row.
Flow:
1. Verify the signed JWS against Apple''s CA chain (SignedDataVerifier).
2. Cross-check against the App Store Server API for the
authoritative subscription state (refunds, grace periods).
3. UPSERT member_subscriptions ON CONFLICT
(apple_original_transaction_id).
4. Return the row''s gating-relevant fields so the mobile client
can update its local subscription state without a second
GET /billing/subscription round-trip.
Auth: standard ``current_member`` — mobile attaches the Clerk JWT
via apiV3Fetch''s auth bridge. We refuse anonymous calls; a stolen
receipt without a session can''t grant access to a different
member.'
operationId: validate_receipt_billing_apple_validate_receipt_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ValidateReceiptRequest'
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ValidateReceiptResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/billing/apple/webhook:
post:
tags:
- billing-apple
summary: Apple Webhook
description: 'Receive App Store Server Notifications V2.
Apple posts a single JSON object: ``{ "signedPayload": "" }``
where the payload contains ``notificationType``, ``subtype``,
``data.signedTransactionInfo`` (also JWS), and
``data.signedRenewalInfo`` (also JWS).
We:
1. Verify the outer JWS against Apple''s CA chain and decode
notificationType + UUID.
2. Idempotency check against apple_notifications.
3. Verify the inner transaction JWS to get
originalTransactionId + the new status.
4. UPDATE the corresponding member_subscriptions row.
5. Mark the apple_notifications row processed.
Apple expects a 2xx within ~30s. Anything else triggers retries
on a backoff. We respond 200 even on "couldn''t process" so Apple
doesn''t retry forever — the row stays in apple_notifications with
processing_error set so we can replay manually.'
operationId: apple_webhook_billing_apple_webhook_post
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Apple Webhook Billing Apple Webhook Post
components:
schemas:
ValidateReceiptRequest:
properties:
transaction_id:
type: string
title: Transaction Id
description: StoreKit transactionId
original_transaction_id:
type: string
title: Original Transaction Id
description: StoreKit originalTransactionId — stable per-subscription ID
product_id:
type: string
title: Product Id
description: App Store Connect product ID
signed_transaction:
anyOf:
- type: string
- type: 'null'
title: Signed Transaction
description: Signed JWS transactionInfo from StoreKit 2 (preferred path)
transaction_receipt:
anyOf:
- type: string
- type: 'null'
title: Transaction Receipt
description: Base64 receipt from StoreKit 1 (fallback path)
environment:
type: string
enum:
- Sandbox
- Production
title: Environment
description: Apple environment the purchase was made in. Mobile detects from the receipt; defaults to Production for live App Store buyers.
default: Production
type: object
required:
- transaction_id
- original_transaction_id
- product_id
title: ValidateReceiptRequest
description: "Mobile client POST body after a successful StoreKit purchase.\n\nThe mobile SDK (react-native-iap) hands back two shapes depending\non platform / API version:\n\n * ``transactionId`` + ``originalTransactionId`` + ``productId``\n + ``signedTransaction`` (JWS) — modern StoreKit 2 path.\n * Legacy ``transactionReceipt`` (base64) — StoreKit 1 fallback.\n\nWe accept either. The signed JWS is preferred (already verifiable\nagainst Apple's CA chain) — if absent we fall back to a transaction\ninfo lookup using the originalTransactionId via the App Store\nServer API."
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
ValidateReceiptResponse:
properties:
ok:
type: boolean
title: Ok
subscription_source:
type: string
const: apple
title: Subscription Source
status:
type: string
title: Status
plan_period:
type: string
title: Plan Period
current_period_end:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Current Period End
type: object
required:
- ok
- subscription_source
- status
- plan_period
- current_period_end
title: ValidateReceiptResponse
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
input:
title: Input
ctx:
type: object
title: Context
type: object
required:
- loc
- msg
- type
title: ValidationError