-
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathUpgradeLink.jsx
More file actions
32 lines (29 loc) · 839 Bytes
/
UpgradeLink.jsx
File metadata and controls
32 lines (29 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import planService from '../../services/planService';
const UpgradeLink = (props) => {
const checkout = (e) => {
e.preventDefault();
props.preActionCallback();
Paddle.Checkout.open({
product: planService.getPlanByType(props.planType).getProductId(),
email: props.userEmail,
passthrough: JSON.stringify({
userId: props.userId,
planType: props.planType,
}),
successCallback: () => {
alert('Please refresh the page later to display subscriptions.');
props.postActionCallback();
},
});
};
return (
<a
className="mt-2 block w-full bg-blue-500 border border-transparent rounded-md py-2 text-sm text-center hover:no-underline"
href="#"
onClick={checkout}
>
{props.upgradeBtnName}
</a>
);
};
export { UpgradeLink };