Jump to content

How to create a subscription stand alone link?


Gauravk

Recommended Posts

Posted

We have a special need where we need to segregate users into 4 segments and each segment should have 3 subscription options.

Showing 12 subscription in one page is confusing and overwhelming. So I am looking for a way to have subscription link that we can embed in a button and it fires to checkout page with invoice creation at backend.

Hope it's possible? Thanks in advance.

Posted

Thanks @Joel R for the great idea.

I think I was mistaken that every time someone click on select option on subscription page it loads a different key.

Just checked now and it loads same constant key with different ID of subscription.

Can anyone please confirm if these keys are always constant? Then life will be very easy.

  • subscriptions/12/?do=purchase&csrfKey=80ddb451cf44a14807f6285b8553989d
  • subscriptions/1/?do=purchase&csrfKey=80ddb451cf44a14807f6285b8553989d
  • subscriptions/6/?do=purchase&csrfKey=80ddb451cf44a14807f6285b8553989d
Posted

The key is the user's CSRF key so it's static, per-user per-session. Within templates, you can do

{expression="\IPS\Session::i()->csrfKey"}

or

{url="..." csrf="true"}

depending upon your needs.

Posted

Thanks @bfarber, can you please make one URL, as Im not well verse with coding.

Did you mean instead of this:

subscriptions/6/?do=purchase&csrfKey=80ddb451cf44a14807f6285b8553989d

Use this...?

subscriptions/6/?do=purchase&{expression="\IPS\Session::i()->csrfKey"}

Posted

So you're trying to link to purchasing a subscription in a template I gather? If so, then you'd want to do

{expression="(string) \IPS\nexus\Subscription::load( 6 )->url( 'purchase' )->csrf()"}

 

Posted

Thanks @bfarber can you please tell me where do I place this line of code as Im sure I can't place them as a backlink on link button with spaces in URL.

I intend of create 3 pages with 3 subscription option placed on each page to use above mention link/code

image.png.b49290d097663f2a1fc10e1b16be4c23.png

Posted

I don't know how to answer your question. You would place the line of code I gave you into a template - which  template would depend upon specifically where you want to show the button/link.

If you are creating a page in Pages or something along those lines, you can paste the code there instead.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...