การควบคุมเจ้าของการสมัครสมาชิก
วัตถุประสงค์: อนุญาตให้เจ้าของบัญชีตรวจสอบแผนและดำเนินการตามวงจรการสมัครสมาชิก
โฟลว์ UI
- ผู้ใช้เปิดหน้าการเรียกเก็บเงินสำหรับบัญชีที่เลือกโทเค็น
- โหลด UI
GET /api/subscriptions - โหลด UI
GET /api/subscriptions/features - โหลด UI
GET /api/subscriptions/identity - โหลด UI
GET /api/subscriptions/merchants - UI สร้างเซสชันการชำระเงินหรือพอร์ทัลเมื่อเจ้าของเริ่มดำเนินการเรียกเก็บเงิน
- UI ดำเนินการซิงค์/เปลี่ยนแปลง/ยกเลิกจากการกระทำของเจ้าของอย่างชัดเจน
โฟลว์ไลบรารีไคลเอนต์
const subs = await api.subscriptions.list();
const features = await api.subscriptions.features();
const merchants = await api.subscriptions.merchants();
const checkout = await api.subscriptions.createCheckoutSession({
price_id,
success_url,
cancel_url,
});
await api.subscriptions.change(subscriptionId, {
interval: "year",
});
HTTP/ขดไหล
API_BASE_URL="https://api.inbox-manager.com"
curl -sS "${API_BASE_URL}/api/subscriptions" \
-H "authorization: Bearer ${BEARER_TOKEN}"
curl -sS "${API_BASE_URL}/api/subscriptions/features" \
-H "authorization: Bearer ${BEARER_TOKEN}"
curl -sS "${API_BASE_URL}/api/subscriptions/identity" \
-H "authorization: Bearer ${BEARER_TOKEN}"
curl -sS "${API_BASE_URL}/api/subscriptions/merchants" \
-H "authorization: Bearer ${BEARER_TOKEN}"
curl -sS -X POST "${API_BASE_URL}/api/subscriptions/stripe/checkout-session" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data "{\"price_id\":\"${PRICE_ID}\",\"success_url\":\"${SUCCESS_URL}\",\"cancel_url\":\"${CANCEL_URL}\"}"
curl -sS -X POST "${API_BASE_URL}/api/subscriptions/stripe/portal-session" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data "{\"return_url\":\"${RETURN_URL}\"}"
curl -sS -X POST "${API_BASE_URL}/api/subscriptions/sync?allow_deletes=false" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data '{}'
curl -sS -X POST "${API_BASE_URL}/api/subscriptions/${SUBSCRIPTION_ID}/change" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data '{"interval":"month"}'
curl -sS -X POST "${API_BASE_URL}/api/subscriptions/${SUBSCRIPTION_ID}/cancel" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data '{"timing":"period_end"}'
curl -sS -X POST "${API_BASE_URL}/api/subscriptions/stripe/checkout-session-sync" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data "{\"session_id\":\"${SESSION_ID}\"}"
หมายเหตุ
- เส้นทางการสมัครสมาชิกไม่มีบัญชี บริบทบัญชีมาจาก JWT
acc - การอนุญาตของเจ้าของถูกบังคับใช้โดยจุดสิ้นสุดการสมัครสมาชิกการตรวจสอบสิทธิ์อัปสตรีม
inbox-managerส่งต่อโทเค็นผู้ถือผู้ใช้โดยตรง- การเรียกกลับ Stripe webhook ไม่ได้ผ่านพรอกซีผ่าน
inbox-manager