> For the complete documentation index, see [llms.txt](https://docs.getsphere.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.getsphere.com/features/integrations/api/stripe-integration-api/hand-off-a-completed-checkout-session.md).

# Hand off a completed Checkout Session

Hand the new subscription to Sphere so renewals are taxed when they're invoiced.

## Hand a completed Checkout Session's subscription to Sphere

> Call from your checkout.session.completed handler. Hands the new subscription over to Sphere so each renewal is taxed when it's invoiced, rather than reusing the rates from checkout. The first invoice is unaffected. Safe to call more than once.

```json
{"openapi":"3.1.0","info":{"title":"Sphere API","version":"1.0.0"},"servers":[{"url":"https://api.getsphere.com/v1"},{"url":"https://server.getsphere.com/tax_api/v1"}],"security":[{"apiKeyAuth":[]}],"components":{"securitySchemes":{"apiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY"}},"schemas":{"CompleteCheckoutSessionRequest":{"additionalProperties":false,"properties":{"stripe_account_id":{"anyOf":[{"pattern":"^acct_","type":"string"},{"type":"null"}],"default":null,"title":"Stripe Account Id"}},"title":"CompleteCheckoutSessionRequest","type":"object"},"CompleteCheckoutSessionResponse":{"description":"The Stripe objects the session produced, and what Sphere changed on them.","properties":{"stripe_account_id":{"title":"Stripe Account Id","type":"string"},"stripe":{"$ref":"#/components/schemas/StripeSettledObjects"},"sphere":{"$ref":"#/components/schemas/SphereCleanupResult"}},"required":["stripe_account_id","stripe","sphere"],"title":"CompleteCheckoutSessionResponse","type":"object"},"StripeSettledObjects":{"description":"The Stripe objects the completed session produced.","properties":{"id":{"title":"Id","type":"string"},"subscription_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Subscription Id"},"invoice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Invoice Id"},"payment_intent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Payment Intent Id"}},"required":["id"],"title":"StripeSettledObjects","type":"object"},"SphereCleanupResult":{"description":"The Sphere tax rates removed from the subscription, so renewals are\ntaxed when they're invoiced.","properties":{"status":{"allOf":[{"$ref":"#/components/schemas/SphereCleanupResultStatusEnum"}],"title":"Status"},"stripped_tax_rate_ids":{"items":{"type":"string"},"title":"Stripped Tax Rate Ids","type":"array"}},"required":["status"],"title":"SphereCleanupResult","type":"object"},"SphereCleanupResultStatusEnum":{"enum":["cleaned","already_clean","not_applicable"],"type":"string"}}},"paths":{"/stripe/checkout_sessions/{external_id}/complete":{"post":{"operationId":"stripe_checkout_sessions_complete_create","description":"Call from your checkout.session.completed handler. Hands the new subscription over to Sphere so each renewal is taxed when it's invoiced, rather than reusing the rates from checkout. The first invoice is unaffected. Safe to call more than once.","summary":"Hand a completed Checkout Session's subscription to Sphere","parameters":[{"in":"path","name":"external_id","schema":{"type":"string"},"description":"The Stripe Checkout Session id, e.g. cs_test_a1B2c3.","required":true}],"tags":["Stripe"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteCheckoutSessionRequest"}},"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/CompleteCheckoutSessionRequest"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/CompleteCheckoutSessionRequest"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteCheckoutSessionResponse"}}},"description":""},"403":{"description":"Missing/invalid API key, or Stripe account not enabled for Sphere tax."},"404":{"description":"No such connected account or Checkout Session."},"409":{"description":"The session wasn't created or taxed through Sphere."},"502":{"description":"Stripe refused the cleanup."}}}}}}
```
