Skip to content

How to get the checkout session url in custom module or controller via php #405

Open
@knufri

Description

Description

Hello,
I have a custom controller in Craft and I need to get the checkout session url from the price id and quantity and some custom metadata. I want to use the same logic like the checkout twig tag with php:

{% set stripeProduct = [
        {
            'price': priceId,
            'quantity': 1,
        }
    ]
%}

{% set stripeMetaData = {
        'subcriptionHandle': subcriptionHandle,
        'customer': '',
        'email': email ?? '',
    }
%}

{% set checkoutSession = craft.enupalStripe.checkout(stripeProduct, stripeMetaData) %}

How to achieve that?

Additional info

  • Craft version: 4
  • PHP version: 8.3
  • Plugin version: 5.5.2
  • Is SCA and Stripe Checkout enabled?: YES

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions