Skip to content

Paypal Finalize Subscription

POST
/api/payments/paypal/finalize
curl --request POST \
--url https://example.com/api/payments/paypal/finalize

Finalize a PayPal subscription created client-side via Smart Buttons.

Expects JSON body: { “subscription_id”: “I-XXXX” } Flow:

  1. Exchange client credentials for access token
  2. GET subscription details from PayPal Billing Subscriptions API
  3. Validate custom_id correlation (custom_id == “<user_id>:<package_id>” or startswith user_id)
  4. Map PayPal plan_id back to internal package id (reverse PAYPAL_PLANS mapping)
  5. Upsert subscription (status active/pending) so polling & UI can reflect state while awaiting webhooks Returns normalized status snapshot.

Successful Response

Media typeapplication/json
Examplegenerated
example