mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 20:34:02 +03:00
Updated checkout flow to pre-fill member email
refs https://github.com/TryGhost/members.js/issues/10
- Takes advantage of change here - 24b83bdc49
- to pre-fill customer email in anonymous checkout flow
- Member cannot change their email in this checkout session, allowing consistency and correct linking post checkout
This commit is contained in:
parent
f813185cc3
commit
d11afe363f
@ -144,11 +144,11 @@ export default class ParentContainer extends React.Component {
|
||||
page: 'magiclink'
|
||||
});
|
||||
} else if (action === 'signup') {
|
||||
const {plan} = data;
|
||||
const {plan, email} = data;
|
||||
if (plan.toLowerCase() === 'free') {
|
||||
await this.GhostApi.member.sendMagicLink(data);
|
||||
} else {
|
||||
await this.GhostApi.member.checkoutPlan({plan});
|
||||
await this.GhostApi.member.checkoutPlan({plan, email});
|
||||
}
|
||||
this.setState({
|
||||
action: 'signup:success',
|
||||
|
@ -111,7 +111,7 @@ function setupGhostApi({adminUrl}) {
|
||||
});
|
||||
},
|
||||
|
||||
async checkoutPlan({plan, checkoutCancelUrl, checkoutSuccessUrl}) {
|
||||
async checkoutPlan({plan, checkoutCancelUrl, checkoutSuccessUrl, email: customerEmail}) {
|
||||
const identity = await api.member.identity();
|
||||
const url = endpointFor({type: 'members', resource: 'create-stripe-checkout-session'});
|
||||
|
||||
@ -125,7 +125,8 @@ function setupGhostApi({adminUrl}) {
|
||||
plan: plan,
|
||||
identity: identity,
|
||||
successUrl: checkoutSuccessUrl,
|
||||
cancelUrl: checkoutCancelUrl
|
||||
cancelUrl: checkoutCancelUrl,
|
||||
customerEmail: customerEmail
|
||||
})
|
||||
}).then(function (res) {
|
||||
if (!res.ok) {
|
||||
|
Loading…
Reference in New Issue
Block a user