Module: Magenx_StripePaymentsGraphQl · requires the official Stripe module (stripe/module-payments)
The official Stripe module for Magento supports subscription products, but offers them only to Magento’s own theme. Its GraphQL covers payments alone. This module adds the subscription parts the headless storefront needs:
the subscription terms on the product page and in the cart ;
the customer’s subscriptions in their account;
cancelling a subscription from the account.
Subscriptions in the customer account.
Subscription products are set up in the Stripe module as usual. This module reads the same data the Stripe module’s own pages use. It has no settings or tables of its own.
Only simple and virtual products can be subscriptions (a Magento and Stripe limit).
A customer can only see and cancel their own subscriptions.
The subscription field is used on the product page and in the cart, not on category grids: it loads the product’s subscription options.
composer require magenxcommerce/module-stripe-payments-graph-ql
bin/magento module:enable Magenx_StripePaymentsGraphQl
bin/magento setup:upgrade
bin/magento setup:di:compile # production mode only
This module used to be called StripeIntegration_PaymentsGraphQl. The GraphQL schema is unchanged. Remove the old module, install this one, and delete any StripeIntegration_PaymentsGraphQl line left in app/etc/config.php before running setup:upgrade.
Mutations cancelStripeSubscription(subscription_id: String!): StripeCancelSubscriptionOutputCancels one of the logged-in customer's Stripe subscriptions.
Argument Type Description subscription_idString!The Stripe subscription ID (sub_...) to cancel.
Fields added to Magento types Field Type Description ProductInterface.stripe_subscriptionStripeProductSubscriptionStripe recurring-billing options for this product, or null when it is not sold as a subscription. CartItemInterface.stripe_subscriptionStripeProductSubscriptionStripe subscription options for this cart line, or null when the line is not a subscription product. Customer.stripe_subscriptions[StripeCustomerSubscription]The logged-in customer's Stripe subscriptions (active and recently canceled).
Types type StripeProductSubscription - Stripe recurring-billing options configured for a product.Field Type Description is_subscriptionBooleanAlways true when this object is present (the product is sold as a subscription). intervalStringBilling interval unit: day, week, month or year. interval_countIntNumber of intervals between billings, e.g. 3 for every 3 months. trial_daysIntNumber of free trial days before the first billing, 0 when there is no trial. initial_feeFloatOne-time setup fee added to the first payment, in the store's display currency. formatted_intervalStringHuman readable interval, e.g. '3 Months'. frequency_labelStringShort recurrence suffix, e.g. '/ month' or '/ 3 months'.
type StripeCustomerSubscription - A Stripe subscription belonging to a customer.Field Type Description subscription_idStringThe Stripe subscription ID (sub_...). labelStringA display name for the subscription, derived from its products. statusStringRaw Stripe status: active, trialing, past_due, unpaid, canceled, etc. status_labelStringTranslated, human readable status. is_activeBooleanTrue when the subscription is not canceled/incomplete. amountFloatThe recurring amount billed each period, in the subscription's currency. currencyStringISO currency code of the subscription amount. formatted_amountStringThe recurring amount formatted with its currency symbol. intervalStringBilling interval unit: day, week, month or year. interval_countIntNumber of intervals between billings. current_period_endIntUNIX timestamp when the current billing period ends / next billing occurs. created_atIntUNIX timestamp when the subscription was created at Stripe. Used by the storefront to list newest subscriptions first. can_cancelBooleanTrue when the customer is allowed to cancel this subscription from the storefront. order_increment_idStringThe Magento order increment ID that created this subscription, when known.
type StripeCancelSubscriptionOutput - Result of the cancelStripeSubscription mutation.Field Type Description successBooleanTrue when the subscription was canceled. messageStringA human readable result message. subscriptions[StripeCustomerSubscription]The customer's remaining subscriptions after the cancellation.