Document checkout_session_params subscription_data merge behavior (#998)
Generated-By: mintlify-agent Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
This commit is contained in:
@@ -50,4 +50,25 @@ const response = await autumn.billing.attach({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```typescript Pass metadata to Stripe subscription
|
||||||
|
const response = await autumn.billing.attach({
|
||||||
|
customerId: "cus_123",
|
||||||
|
planId: "pro_plan",
|
||||||
|
checkoutSessionParams: {
|
||||||
|
subscriptionData: {
|
||||||
|
metadata: {
|
||||||
|
userId: "internal-user-id",
|
||||||
|
source: "upgrade-flow",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
</CodeGroup>
|
</CodeGroup>
|
||||||
|
|
||||||
|
### Stripe checkout session params
|
||||||
|
|
||||||
|
Use `checkoutSessionParams` to pass additional data to the Stripe checkout session. Values you provide are deep-merged with Autumn's internal parameters, so your fields are preserved alongside ones Autumn sets automatically (like `trial_end` or internal metadata).
|
||||||
|
|
||||||
|
This is useful for attaching custom metadata to the Stripe subscription created during checkout — for example, linking subscriptions to internal user IDs or tracking the source of the purchase.
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ description: "Some new things we've shipped at Autumn HQ"
|
|||||||
- New Express, Elysia, and Web Standard adapters for `autumnHandler` - [#985](https://github.com/useautumn/autumn/pull/985)
|
- New Express, Elysia, and Web Standard adapters for `autumnHandler` - [#985](https://github.com/useautumn/autumn/pull/985)
|
||||||
- Improved API reference field descriptions for preview endpoints - [#985](https://github.com/useautumn/autumn/pull/985)
|
- Improved API reference field descriptions for preview endpoints - [#985](https://github.com/useautumn/autumn/pull/985)
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
<Accordion title="Bug fixes">
|
||||||
|
- `checkout_session_params.subscription_data` (including `metadata`) is now properly deep-merged with Autumn's internal parameters instead of being overwritten - [#996](https://github.com/useautumn/autumn/pull/996)
|
||||||
|
</Accordion>
|
||||||
</AccordionGroup>
|
</AccordionGroup>
|
||||||
</Update>
|
</Update>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user