Lesson notes
How it works
How the banner finds cancelled members
MemberScript #227 reads the logged-in member's plan connections. It treats a plan as cancelled when its status is cancelled (or expired, past due or unpaid), and as a scheduled cancel when the plan is still active but set to end on a future date. By default the banner stays hidden if the member still has another active paid plan, so you never nag a paying member.
When it shows the banner, it fills in the member's first name (from the first-name custom field), the plan name and the cancel date.
Two kinds of cancelled, two buttons
A member whose plan ends in the future still has access until that date. They can undo the cancellation in the Stripe customer portal by clicking Renew, with no new payment details. So their button is data-ms-action="customer-portal", labelled something like Reactivate my plan.
A member whose plan has already ended needs to buy again. Their button uses data-ms-price:add with the plan's price ID, which starts checkout for that plan, or you can link to your pricing page. Saved payment details mean it only takes a few clicks. The script works out which button to show, as long as each one also has data-ms-reactivate="button": it treats a customer-portal button as the scheduled one and a data-ms-price:add button as the cancelled one.
Build the banner
Paste MemberScript #227 into the page or site body code.
- 1Build a banner, set it to display none, and add
data-ms-reactivate="banner". The script shows it when it should. - 2In the text, add spans with
data-ms-reactivate="first-name",data-ms-reactivate="plan-name"anddata-ms-reactivate="cancelled-date". - 3Add the renew button with
data-ms-price:add="prc_..."and the reactivate button withdata-ms-action="customer-portal". Give bothdata-ms-reactivate="button"so the script can switch between them. - 4Add a Maybe later button with
data-ms-reactivate="dismiss". It savesdismissed_untilin the member's JSON underreactivation_banner, hiding the banner for 7 days (change it withms-reactivate-dismiss-days). - 5Test with a member whose plan is set to cancel later, then cancel it now and refresh.