<p>Got it!</p>
<pre><code>{% set chosenPlan = craft.app.request.getParam('plan') %}
{% set plan = craft.commerce.getPlans().getPlanByUid(chosenPlan) %}
{{ plan.gateway.getPaymentFormHtml({})|raw }}
</code></pre>

CC BY-SA 4.0
2021-07-16T07:12:16.127Z
2021-07-16T07:12:16.127Z
supazu
<p>I'm trying to make a 2-step subscription process. Where someone clicks 'subscribe' and it takes them to a new page.</p>
<p>Free trial button goes to <code>url('subscribe?plan=' ~ plan.uid)</code></p>
<p>I then retrieve that on the subscribe page with <code>{% set plan = craft.app.request.getParam('plan') %}</code></p>
<p>How can I pass that UID into the gateway form? I use <code>{{ plan.gateway.getPaymentFormHtml({})|raw }}</code> but get <code>Impossible to access an attribute (&quot;gateway&quot;) on a string variable (&quot;2c98700c-0839232&quot;).</code></p>
<p>Makes sense but I'm looking for a way to get the plan via the planUid. This is where my head goes, but I know it's not correct:</p>
<pre><code>{% set chosenPlan = craft.app.request.getParam('plan') %}
{% set plan = craft.commerce.getPlans().getAllPlans().uid(chosenPlan) %}
{{ plan.gateway.getPaymentFormHtml({})|raw }}
</code></pre>
<p>Does anyone know how I could get this (or something like it) to work?</p>

<plugin-craftcommerce>
Commerce 3 Subscription form
# Commerce 3 Subscription form

(Asked by: username_0 on 2021-07-15)

I'm trying to make a 2-step subscription process. Where someone clicks 'subscribe' and it takes them to a new page.
Free trial button goes to url('subscribe?plan=' ~ plan.uid)
I then retrieve that on the subscribe page with {% set plan = craft.app.request.getParam('plan') %}
How can I pass that UID into the gateway form? I use {{ plan.gateway.getPaymentFormHtml({})|raw }} but get Impossible to access an attribute ("gateway") on a string variable ("2c98700c-0839232").
Makes sense but I'm looking for a way to get the plan via the planUid. This is where my head goes, but I know it's not correct:
{% set chosenPlan = craft.app.request.getParam('plan') %}
{% set plan = craft.commerce.getPlans().getAllPlans().uid(chosenPlan) %}
{{ plan.gateway.getPaymentFormHtml({})|raw }}

Does anyone know how I could get this (or something like it) to work?

**Tags:** plugin-craftcommerce


---

## 1 answers

### Answer by username_0 on 2021-07-16. Score: 1 | Accepted answer

Got it!
{% set chosenPlan = craft.app.request.getParam('plan') %}
{% set plan = craft.commerce.getPlans().getPlanByUid(chosenPlan) %}
{{ plan.gateway.getPaymentFormHtml({})|raw }}


---

