Login member after subscription

Hi,

ich add subscribers through custom form. My JS-Code is like:

await stripe.checkout.sessions.create({
customer_email: req.body.email,
mode: ‘subscription’,
locale: “de”,
payment_method_configuration: ‘XXXXXXXXX’,
});

After successful subscription and redirect to the site, the new member is not logged in.

How can I login the new member - without the need of checking E-Mail and using provided magic link? Is it possible to get this magic link for redirecting or can i generate this token via API?

THX

It’s not possible to generate the token via the Ghost API using javascript in the user’s browser. (That would be super insecure.)

However, Ghost’s Portal does create checkout sessions and then log users in (without magic link email), so you might want to take a look at how it’s doing it and replicate that with your current form.