Request
Request type: POST URL:{{baseUrl}}/api/v1/customers/{{externalCustomerId}}/magic_link
Body (optional):
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
The API to create a Link which logs a user into the billing portal directly
{{baseUrl}}/api/v1/customers/{{externalCustomerId}}/magic_link
Body (optional):
{
"return_url": "https://merchant.example.com/manage_plans",
"intent": "new_purchase",
"plan_id": "45e46575-bf1d-4667-8acc-8b0ade8441e1"
}
| Parameter Name | Required? | Constraints | Remarks |
|---|---|---|---|
| return_url | no | When present, it should be a valid URL | Once the user is done with the billing portal, the user will be redirected to this URL. |
| intent | yes, when body is provided | It must be either new_purchase or cancel_subscription (as a string) | The intent will govern where the resulting magic link will take the user - to either the new plan purchase page or the cancel subscription page. |
| plan_id | yes, when body is provided | Must be the plan ID from one of the plans that you got from List Plans API | This is the plan to which the magic link will take the user. |
{
"magic_link": "{{mbsUrl}}/p/login?token={{userLoginToken}}"
}
| Field | Expected Value | Remarks |
|---|---|---|
| magic_link | A link to the MBS that takes the user to the intended page |