This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function selectPlan_click(event) { | |
let $item = $w.at(event.context); | |
$w('#selectPlan').hide(); //hide button | |
$item("#openingLb").show(); //show a loader animation on this item | |
let planData = $item("#plans").getCurrentItem(); //get the click item's data from its dataset | |
let deployData = { | |
name: planData.displayName, | |
price: planData.displayPrice, | |
planId: planData.planId, | |
currency: planData.currency |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//stripeProcessor.jsw | |
import stripe from 'stripe'; | |
const key = require("stripe")("sk_test_xxxxxx"); //Stripe SECRET API Key | |
//---------------------------------------------Create Customer---------------------------------------------// | |
export function createCustomer(token, emailId) { | |
return key.customers.create({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//lightbox code | |
import wixWindow from 'wix-window'; | |
import wixLocation from 'wix-location'; | |
import {stripeToken} from 'public/stripe.js'; | |
import wixData from 'wix-data'; | |
import wixUsers from 'wix-users'; | |
import {createCustomer, createSubscription} from 'backend/stripeProcessor.jsw'; | |
$w.onReady(function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {client, getAuthUrl, generateTokens} from 'backend/config.jsw'; | |
export function clientConfig_keyPress(event) { | |
if (event.key === "Enter") { | |
let str = $w('#clientConfig').value; | |
if (str.length === 0) | |
return; | |
client(str).then(item => { | |
$w('#configUploaded').show(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wixData from 'wix-data'; | |
const {google} = require("googleapis"); | |
const SCOPES = ['https://www.googleapis.com/auth/calendar']; //the url of the api | |
let options = { | |
"suppressAuth": true //suppress db auth to allow secure db permissions | |
}; | |
//-----------------------------Insert Client Config File Into Database----------------------------// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wixData from 'wix-data'; | |
const {google} = require("googleapis"); | |
let options = { | |
"suppressAuth": true //suppress db auth to allow secure db permissions | |
}; | |
export async function insertNewEvent(summary, location, description, start, end, attendees) { | |
const authorizedAuthClient = await createAuthorizedClient(); | |
return insertRow(authorizedAuthClient, summary, location, description, start, end, attendees); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {insertNewEvent} from 'backend/createEvent.jsw'; | |
$w.onReady(function () { | |
}); | |
var startdateNumber; | |
var startmonth; | |
var startyear; | |
var starttime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wixData from 'wix-data'; | |
$w.onReady(function () { | |
}); | |
export function dataset1_ready() { | |
$w("#repeater1").onItemReady( ($item, itemData, index) => { | |
$item("#price").text = itemData.price + ' ' + itemData.currency; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {createToken, encodeCard} from "public/stripeAPI.js"; | |
import {subscription, createCustomer} from "backend/stripe"; | |
import wixLocation from 'wix-location'; | |
$w.onReady(function () { | |
}); | |
var items = []; //your plan ID will go here (plan_XXXXXXXXXXXXXX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//stripeAPI.js | |
import {fetch} from 'wix-fetch'; | |
export async function createToken(card) { | |
const apiKey = "PUBLIC_API_KEY"; | |
const response = await fetch("https://api.stripe.com/v1/tokens", { | |
method: 'post', | |
headers: { | |
"Content-Type": "application/x-www-form-urlencoded", |