Account page
The account page is a page EdgeKit serves on your site’s own domain, at /edgekit/account. A signed-in user sees
there the user subscriptions they hold on that site and the invoices for them, can cancel one, can undo a cancel,
can change to another offer, and can replace their payment method. Two more tabs let them edit their details and
choose their newsletters.
You link to it from your own pages; you do not build it.
The page uses the site’s brand: its logo, its text and accent colours and its font. You pick how it is arranged and how it looks, see Layout and design. Its text is in English.
Switch it on
Section titled “Switch it on”The account page is set per site and is off until you switch it on.
- Open Delivery › Configuration › Hosted pages and pick the site under Site.
- Under Account page, set it to On and save.
- Deploy. The page is live on the site once the deploy is.
Switching it off works the same way and also takes a deploy.
Layout and design
Section titled “Layout and design”Each site has one layout and one design for its account page. Both are on
Delivery › Configuration › Hosted pages, under the site you picked. Save, then deploy.
The layout is how the page is arranged:
| Layout | What the user sees |
|---|---|
| Tabs | The links in a header across the top, and one tab at a time. This is the default. |
| Beside | The links in a column on the left, beside the tab that is open. There is no header. |
| One page | Every tab as a section of one long page. The links scroll to a section. |
The design is how the page looks. The three designs are the same as a checkout page’s, so the two pages of a site can match:
| Design | What the user sees |
|---|---|
| Statement | A white page with ruled sections. This is the default. |
| Member pass | A page tinted in your accent colour, with white panels and the user’s subscription drawn as a pass. |
| Cover | Your accent colour across the top of the page, with a white panel over it. |
Any design works with any layout. The layout and the design change only how the page looks: everything a user can do on it is the same.
The member pass is shown on the Tabs and One page layouts, for the first user subscription that has not ended.
The page needs two more things from the site:
- The
/edgekit/mount. The page is served on your site’s domain through the same mount as every other browser request. See First-party mount and site proxy. - Your site’s origin in the site’s Allowed origins. The page signs users in through the same requests your own pages make. See Site settings.
Where it is not served
Section titled “Where it is not served”On a site with the switch off, /edgekit/account, /edgekit/account/sign-in and every request under
/edgekit/v1/account/ answer 404.
The same is true on a site whose ID mode is external_only, whatever the switch says. EdgeKit creates no session on
such a site, so there is nobody for the page to show. Your own account page stays the only one. See
ID modes.
Signing in
Section titled “Signing in”A user who opens /edgekit/account without a session is sent to /edgekit/account/sign-in. They enter their email
address, receive a code by email, enter the code and land back on the account page. There is no password.
An email address EdgeKit has not seen before creates a user, exactly as signing in on your own pages does. That user has nothing to manage yet and sees an empty page.
A user who pays you but has never signed in can sign in the same way. This covers a user whose user subscription began before your organization used EdgeKit: they sign in with the email address they pay under and see the user subscription they already hold.
The user can sign out from the account page. That ends their session on the site, not only on the page.
On a site in dual mode with EdgeKit sign-in left off, the sign-in page answers 404. A user who already has a
session there still reaches the account page.
The same is true on a site with castle_required on. The sign-in page
does not run Castle, so it is not served there. The user signs in on your own sign-in page, then opens the account
page.
What the user sees
Section titled “What the user sees”The page has three tabs. A link of your own can open one directly: /edgekit/account#profile or
/edgekit/account#newsletters.
| Tab | What the user does there |
|---|---|
| Subscription | Sees their user subscriptions and invoices, and everything else on this page. It opens first. |
| Profile | Edits their first name, last name and the traits your organization collects, and changes their email address. |
| Newsletters | Ticks the newsletters of this site they want. Saving unsubscribes them from the ones left unticked. |
On the Profile tab:
- A trait your organization writes itself is not editable by the user.
- Changing the email address sends a code to the new address. Once the user confirms it, every session of theirs ends and they sign in again with the new address.
- The email address can be changed only on a site in
edgekit_onlymode. Indualmode your identity provider owns the address and the details, so the tab shows them and offers no change.
On the Newsletters tab, a newsletter waiting for the user to confirm it by email is shown and cannot be ticked or unticked until they do.
A user who is the owner or an admin of an organization also sees a Teams menu beside the tabs, listing each organization they manage. Choosing one opens its team, where they can:
- see every member and their role,
- make a member an admin, or an admin a member,
- remove a member,
- invite someone by email as a member or an admin,
- cancel an invitation that is still waiting.
An owner’s role cannot be changed here, and a user cannot remove themselves. A user who manages no organization sees no menu. The seat limit of the organization’s grant applies as it does everywhere: an invitation past it is refused.
On the Subscription tab, each user subscription is listed with:
- the offer it is on,
- its price and billing interval,
- its state: trial, active, payment failed, paused or ended,
- the next renewal date, or the date access ends when it is set not to renew,
- the date a trial ends.
Below them, each grant the user holds through a seat in a user organization is shown with its product or offer, the organization’s name, active or suspended, and the date it ends. These cards have no actions, also not for the organization’s owner: the grant comes with the seat. An expired or revoked organization grant is not shown.
Dates are shown in your organization’s time zone.
Which user subscriptions are listed
Section titled “Which user subscriptions are listed”The page lists a user subscription when all of these hold:
- It is the user’s own. A user subscription held by a user organization is never listed, also not for its members: they see the organization’s grant instead.
- Its price is on a deployed offer, so EdgeKit knows which product it is for. See Access and billing.
- That product is attached to the site the page is on.
It does not matter who sold it: EdgeKit checkout, your own checkout, or a sale made before your organization used EdgeKit.
Two cases follow from these rules. A user subscription whose price is on no offer appears on no account page. A user subscription whose product is attached only to sites with the account page off appears nowhere either.
Invoices
Section titled “Invoices”Below the list, the page shows the user’s invoices, newest first. Each row has:
- the date the invoice was issued,
- its total,
- its state: paid, due, processing, pending, unpaid, void or closed. A refund or credit is shown as a credit,
- a link to the receipt at your billing provider, labelled with the invoice number.
The page shows the invoices of the user subscriptions it lists, and the credits against those invoices. An invoice for a user subscription that is not listed is not shown. See Which user subscriptions are listed.
The page shows the newest 100 invoices. A draft that your billing provider has not issued yet is not shown.
EdgeKit reads invoices from its own copy of your billing provider’s data and does not call the billing provider when the page loads. Two things follow:
- A new invoice appears once your billing provider has reported it to EdgeKit.
- The receipt link is the one your billing provider gave EdgeKit. Stripe’s link stops working some time after the invoice is due, so the link on an old Stripe invoice can be expired.
A Recurly receipt link opens the invoice on Recurly’s hosted account pages. It needs hosted account management to be on for your Recurly site. An invoice with no link is still listed, with its number and no link.
The receipt link is the user’s own. Anyone who has it can open the invoice, so do not log or store it.
Cancel
Section titled “Cancel”A user cancels a user subscription with Cancel subscription on the account page.
A cancel takes effect at the end of the period the user has paid for:
- The user subscription does not renew. The user is not charged again.
- The user keeps access until the period ends. The page shows that date.
- There is no refund and no immediate end. To end a user subscription at once or to refund it, use your billing provider.
- A user in a trial keeps the trial until it ends and is not charged.
A user can cancel while the user subscription is in a trial, active, paused, or has a failed payment. A user subscription that has ended, or has not started yet, cannot be cancelled.
Your billing provider has the last word. Recurly accepts a cancel only on an active user subscription, so a paused one is refused there, and the page tells the user.
The cancel is made in your billing provider, Stripe or Recurly. Your billing provider sends its usual emails. EdgeKit sends none.
The grant does not change when the user cancels. It already expires at the end of the paid period, and it is not extended because the user subscription does not renew. See Access and billing.
If the billing provider refuses the cancel or cannot be reached, the page tells the user and nothing changes. The user can try again.
A user subscription that is not listed on the page cannot be cancelled there. See Which user subscriptions are listed.
Cancel reasons
Section titled “Cancel reasons”The page can ask a user why they cancel. You write the list of reasons, so they match how your organization talks about churn.
- Open Delivery › Configuration › Cancel flow and go to Cancel reasons.
- Select Add reason and give it a key and a label. For example
too_expensiveandIt costs too much. The label is what the user reads. The key is what you get in your data. - Save and deploy. The list is for your whole organization: every site’s account page asks the same.
A key has lowercase letters, digits and underscores, at most 64 characters. The page offers up to 20 reasons, in the order of the list.
Once you save a reason, its key cannot change and the reason cannot be removed, because users may already have picked it and your data carries the key. You can still change its label. To stop offering a reason, switch its Shown off, save and deploy: the page no longer lists it, and the reason stays in the list so its key keeps a label. Switch it on again to offer it again. A reason you have added but not saved yet can still be removed.
When the list has reasons, Cancel subscription opens a step with the question and a second Cancel subscription button. The question is optional. A user who leaves it on Prefer not to say cancels the same way.
With an empty list, the page asks nothing.
The reason is sent on the account_page_cancelled event and stored nowhere else. See Events. EdgeKit
does not send it to your billing provider, and the cancel reason your billing provider records is its own.
Undo a cancel
Section titled “Undo a cancel”Until the period ends, the page shows Undo cancel on a cancelled user subscription. Undoing sets it to renew again at the same price. Nothing is charged at that moment; the next charge is at the normal renewal date.
After the period ends, the user subscription has ended and cannot be brought back from the account page.
A user subscription that was set not to renew somewhere else, for example in your billing provider, shows Undo cancel too.
Save offer
Section titled “Save offer”A save offer is one alternative the page shows a user before they cancel. It is another offer of yours, and there are two kinds:
- A discount. The other offer is on the same billing provider price and has a discount. The user keeps the user subscription they hold and pays less.
- A switch. The other offer is on a different price, for example a cheaper product. The user subscription moves to that offer at the next renewal.
You set it per offer. An offer has at most one save offer.
Set a save offer
Section titled “Set a save offer”- Choose the offer to show. For a discount, create an offer with the same billing provider price as the offer your users are on, and give it a discount with a coupon from your billing provider. For a switch, use an offer with a different price at the same billing provider. See Offers.
- Open the offer your users are on from Revenue › Catalog › Offers and go to Save offer.
- Pick the offer to show and save.
- Deploy. The save offer is live once the deploy is.
To remove it, pick No save offer, save and deploy.
A deploy is refused when one offer has more than one save offer. This can only happen when offers are written outside the console.
What the user sees
Section titled “What the user sees”When the user presses Cancel subscription, the page shows the save offer with two buttons:
- Accept offer takes the save offer. The user subscription keeps renewing and the cancel does not happen.
- No thanks, cancel cancels at once, as described under Cancel. There is no further step.
For a discount, Accept offer puts the discount on the user subscription. It stays the same user subscription, with the same access and history. The discount is the coupon of the offer you picked, applied by your billing provider. The billing provider decides the amount and how long the discount lasts.
For a switch, the page shows the other offer and its price. Accept offer sets the user subscription to move to that offer at the next renewal. Nothing is charged or refunded at that moment, and the user keeps the access they paid for until the renewal. Until then the page shows the offer the user subscription changes to and the date. At the renewal your billing provider charges the new price, and the grant moves to the new offer and its product. See Access and billing.
EdgeKit sends no email.
When it is shown
Section titled “When it is shown”The page shows the save offer when all of these hold:
- The user subscription is active. A user in a trial, with a failed payment, or paused sees no save offer and goes straight to the cancel.
- The offer the user subscription is on has a save offer, and that save offer is deployed.
- The save offer is active.
- For a discount: the save offer is on the same billing provider price, in the user’s currency, and has a coupon.
- For a switch: the save offer has a price at the same billing provider, in the user’s currency, and no change is waiting for renewal.
- The user has not accepted a save offer on this user subscription before.
A user who declines sees the save offer again the next time they cancel. A user who accepts never sees one again on that user subscription: a later cancel goes straight through.
If the billing provider refuses the coupon or the switch, the page tells the user and nothing changes. The save offer is still there, and so is the cancel.
Limits:
- On Recurly, the coupon must be one that can be redeemed on a subscription. Recurly refuses a coupon that is set to be redeemed on the account.
- On Stripe, the coupon replaces any discount already on the user subscription.
- A switch that waits for renewal cannot be removed on the account page. Remove it in your billing provider. A cancel removes it.
- On Stripe, a switch needs a user subscription with exactly one item, and a discount on it ends when the switch applies.
Change to another offer
Section titled “Change to another offer”A user can move a user subscription to another offer. The page shows only the offers that the offer they are on leads to. You set those links per offer, as its upgrade and frequency change links. See Offers.
The kind of link decides when the change applies:
- Upgrade applies now. Before the user confirms, the page asks your billing provider what the change costs and shows that amount. The billing provider charges the prorated amount at once and the user subscription moves to the new offer. If the charge fails, nothing changes.
- Frequency change applies at the next renewal. Nothing is charged until then. Until the renewal, the page shows the offer the user subscription changes to and the date.
After an upgrade, the grant moves to the new offer and its product, so the user has the new access. This follows a moment after the change, and the page can show the old offer until it does. After a frequency change, the grant moves at the renewal. See Access and billing.
When it is shown
Section titled “When it is shown”The page shows an offer to change to when all of these hold:
- The user subscription is active and set to renew. A user in a trial, with a failed payment, paused, or who has cancelled sees none.
- The offer the user subscription is on links to the other offer as an upgrade or a frequency change, and that link is deployed.
- The other offer is active and has a price at the same billing provider, in the user’s currency.
- No change is waiting for renewal. While one waits, the page offers no other change.
Limits:
- A change that waits for renewal cannot be removed on the account page. Remove it in your billing provider.
- A cancel removes a change that waits for renewal.
- The amount shown for an upgrade is your billing provider’s estimate at that moment. The charge can differ by a small amount.
- On Stripe, the user subscription must have exactly one item. One with an add-on is refused, and the page tells the user.
- On Stripe, a discount on the user subscription ends when a frequency change applies.
- Your billing provider sends its usual emails. EdgeKit sends none.
Update the payment method
Section titled “Update the payment method”A user can replace the card a user subscription is paid with. The page shows an Update payment method button on each user subscription. The button opens a card form.
The card fields in that form belong to your billing provider. The provider serves them in its own frame, and the card number goes from the user’s browser straight to the provider. The provider answers with a token that stands for the card. Your site and EdgeKit receive only that token, never the card number.
When the user saves, EdgeKit asks the billing provider to replace the payment method with the one the token stands for. The page then shows the user subscription again.
A user can do this in every state except ended: before the start, in a trial, active, with a failed payment, or paused. A user who has cancelled can still do it until access ends.
After a failed payment
Section titled “After a failed payment”When a user subscription has a failed payment, the page says so and shows the card form first, already open, above everything else for that user subscription. The user does not need to look for a button.
What you need to set
Section titled “What you need to set”The card form needs your billing provider’s public key: Stripe’s publishable key, or Recurly’s public key. This key is made to be used in a browser and is not a secret. Ask EdgeKit to set it for your organization. Without it, the page shows no card form for that billing provider.
What changes at the billing provider
Section titled “What changes at the billing provider”- Stripe. The card is added to the user’s record at Stripe, set as its default for invoices, and set on the user subscription.
- Recurly. The card replaces the billing information of the user’s account. It pays every user subscription on that account, not only the one the user opened the form on.
Limits:
- Only cards. Other payment methods are not offered.
- On Stripe, the page does not ask the user to confirm the card with their bank. A card that needs this check can be declined at the next payment.
- On Stripe, a failed payment is not charged again at once. Stripe charges the new card at its next retry. Recurly retries the failed invoice itself when the card is replaced.
- On Recurly, the form asks for first name, last name, postal code and country. If your Recurly site requires a full address, Recurly refuses the card and the page tells the user.
- The page does not show which card is on file.
- If the billing provider refuses the card, the page tells the user and nothing changes.
Events
Section titled “Events”The account page sends five events to your organization’s analytics, so you can read a churn funnel: who opened the page, who was shown a save offer, who took it, who cancelled and why, and who came back.
| Event | Sent when | Fields |
|---|---|---|
account_page_view |
A signed-in user opens the account page. | subscriptions: how many user subscriptions the page listed. |
account_page_save_offer_shown |
A user presses Cancel subscription and sees the save offer. | subscription_id, offer_id, kind (discount or switch). |
account_page_save_offer_accepted |
A user accepts the save offer. | subscription_id, offer_id, kind. |
account_page_cancelled |
A user cancels. | subscription_id, reason: the key they picked, or null. |
account_page_cancel_undone |
A user undoes a cancel. | subscription_id. |
The events are in the cloud.edgekit vendor. Their schemas are already in your schema registry: you do not publish
them. See Schemas.
Each event carries the site as app_id, the user as user_id, and the device as network_userid, read from
the request’s network cookie, so a funnel can follow a device to the page. On a site whose
consent basis is consent_required, the event is sent without the user, the device and subscription_id, because
the account page cannot show that the user consented. See Consent.
EdgeKit’s server sends the events, not the user’s browser, so an ad blocker does not remove them. They are sent only for a change that happened: a cancel that the billing provider refused sends nothing, and pressing a button twice sends one event.
An event that cannot be delivered is dropped. It never stops or undoes a cancel, an undo or a save offer.
The events start after EdgeKit’s next deploy of your organization’s stack. Until then the page works and sends none.
Read the list from your own page
Section titled “Read the list from your own page”The same list is available to a page of yours, for the signed-in user:
curl https://<tenant>.edgekit.ai/edgekit/v1/account/subscriptions \ -H 'x-edgekit-site-id: site_example' \ -H 'Cookie: <the user session cookie>'const response = await fetch('/edgekit/v1/account/subscriptions', { headers: { 'x-edgekit-site-id': 'site_example' }, credentials: 'same-origin',});const { subscriptions } = await response.json();It answers 401 without a session and 404 wherever the account page is not served.
Each entry carries canCancel and canUndoCancel, so your page knows which action to offer.
Each entry also carries saveOffer. It is null when there is nothing to show. Otherwise it holds the offer (id
and name) and its kind, discount or switch. A discount carries discount: kind (percent or amount),
percent, amount, currency and periods. A switch carries the offer’s price instead, and after it is
accepted the entry’s pendingChange holds the offer and the renewal date.
Each entry also carries offerChanges, the offers the user can change to. Each holds the offer (id and name),
its kind (upgrade or frequency_change) and its price. pendingChange is the change that waits for renewal,
with its offer and the date at, or null.
The invoices are at /edgekit/v1/account/invoices, with the same headers and the same 401 and 404:
const response = await fetch('/edgekit/v1/account/invoices', { headers: { 'x-edgekit-site-id': 'site_example' }, credentials: 'same-origin',});const { invoices } = await response.json();Each entry carries number, kind (charge or credit), status, total (amount and currency), issuedAt
and receiptUrl. receiptUrl is null when EdgeKit holds no link for the invoice.
Cancel, undo and the save offer from your own page
Section titled “Cancel, undo and the save offer from your own page”A page of yours can make the same changes for the signed-in user. Use the id of a listed entry:
const response = await fetch(`/edgekit/v1/account/subscriptions/${id}/cancel`, { method: 'POST', headers: { 'x-edgekit-site-id': 'site_example' }, credentials: 'same-origin',});const { subscription } = await response.json();To send the user’s reason with a cancel, add a JSON body with the key of one of your cancel reasons:
{"reason":"too_expensive"}, with the header content-type: application/json. The body is optional. A key that is
not in your list is ignored and the cancel still happens.
To undo, send the same request to /edgekit/v1/account/subscriptions/<id>/undo-cancel.
To accept the save offer, send it to /edgekit/v1/account/subscriptions/<id>/accept-save-offer. Show the save offer
yourself first, from the entry’s saveOffer. To decline, send the cancel.
When your page shows the save offer to the user, send the same request to
/edgekit/v1/account/subscriptions/<id>/save-offer-shown. It changes nothing and answers {"success":true}. It
sends the account_page_save_offer_shown event, once for each request, so send it once for each time the user sees
the offer. The cancel, the undo and the accept send their own events.
All three answer the entry as it now stands. Sending any of them twice is safe: the second request answers the current state and changes nothing.
To change to another offer, send the id of one of the entry’s offerChanges offers:
const response = await fetch( `/edgekit/v1/account/subscriptions/${id}/change-offer`, { method: 'POST', headers: { 'content-type': 'application/json', 'x-edgekit-site-id': 'site_example', }, credentials: 'same-origin', body: JSON.stringify({ offerId }), },);const { subscription } = await response.json();curl -X POST https://<tenant>.edgekit.ai/edgekit/v1/account/subscriptions/<id>/change-offer \ -H 'content-type: application/json' \ -H 'x-edgekit-site-id: site_example' \ -H 'Cookie: <the user session cookie>' \ -d '{"offerId":"<offer id>"}'It answers the entry as it now stands, and sending it twice is safe. After an upgrade, offer can still name the
old offer for a moment.
To show the user what a change does before they confirm, send the same body to
/edgekit/v1/account/subscriptions/<id>/preview-offer-change. It changes nothing. It answers a preview with the
offer, kind and price, and:
charge(amountandcurrency): what your billing provider would charge now for an upgrade.nullfor a frequency change.appliesAt: the renewal date a frequency change applies at.nullfor an upgrade.
To replace the payment method, first get a token from your billing provider’s own card fields on your page: a Stripe
payment method id, or a Recurly.js token. Each entry’s billingProvider says which provider bills it, and
canUpdatePaymentMethod says if it can be replaced. Then send the token:
const response = await fetch( `/edgekit/v1/account/subscriptions/${id}/payment-method`, { method: 'POST', headers: { 'content-type': 'application/json', 'x-edgekit-site-id': 'site_example', }, credentials: 'same-origin', body: JSON.stringify({ token }), },);const { subscription } = await response.json();curl -X POST https://<tenant>.edgekit.ai/edgekit/v1/account/subscriptions/<id>/payment-method \ -H 'content-type: application/json' \ -H 'x-edgekit-site-id: site_example' \ -H 'Cookie: <the user session cookie>' \ -d '{"token":"<token>"}'Never send a card number. A token works once, so do not send this request twice: the second one answers
409 billing_provider_failed.
| Status | Meaning |
|---|---|
200 |
Done, or it was already so. |
401 |
No session. |
404 |
The user subscription is not listed for this user on this site, or the account page is not served. |
409 subscription_state |
It has ended or has not started. For a change of offer: it is not active, or it is set not to renew. For a payment method: it has ended. |
409 no_offer_change |
The offer is not one of the entry’s offerChanges. |
409 no_save_offer |
There is no save offer to accept on it. |
409 billing_provider_failed |
The billing provider refused or could not be reached. Nothing changed. |
409 no_billing_provider |
The site has no working connection to the billing provider. |