Implementing Purchase Type and Recurring Payments for Discounts

I would like to add purchase type to the discount .

I can implement this functionality by looking for the existence of a selling plan allocation on the cart line.
If it is null, then it’s a one-time purchase.
If it’s a non-null value, then it’s a subscription purchase.

https://shopify.dev/docs/api/functions/reference/product-discounts/graphql/common-objects/sellingplanallocation

However, I do not know how to implement recurring payments for subscriptions.