Skip to content

Instantly share code, notes, and snippets.

Avatar

Shan shanwixcode

View GitHub Profile
View wixStores.js
import wixData from 'wix-data';
$w.onReady(function () {
});
export function repeater1_itemReady($item, itemData, index) {
$item("#price").text = itemData.price + ' ' + itemData.currency;
}
View backendFile.js
//stripe.jsw
import {fetch} from 'wix-fetch';
export async function subscription(token, item) {
const cart = item;
const apiKey = "SECRET_API_KEY";
const response = await fetch("https://api.stripe.com/v1/subscriptions", {
method: 'post',
headers: {
View public.js
//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",
View stripePage.js
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)
View searchBar.js
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;
});
View Wix Users API Error
function signUpMember(response, cus, lastFour, brand, sourceData, referrer, donationValue) {
let email = $w("#email").value.toLowerCase();
let password = $w("#password").value;
let fname = $w("#fName").value;
let lname = $w("#lName").value;
registration(email, password, fname, lname)
.then( (res) => {
console.log(res);
if(res.status === 'Active') {
wixUsers.applySessionToken(res.sessionToken)
View Wix Users API Issue
function signUpMember(response, cus, lastFour, brand, sourceData, referrer, donationValue) {
wixUsers.register($w("#email").value, $w("#password").value, {
"contactInfo": {
"firstName": $w("#fName").value,
"lastName": $w("#lName").value
}
})
.then( (result) => {
$w("#processorText").text = 'Thank you for your patience, We are almost done';
updateStageOne(response, cus, lastFour, brand, sourceData, referrer, donationValue);
View mcbck.rb
import wixPay from 'wix-pay-backend';
export function createMyPayment(products, amt, cry) {
return wixPay.createPayment({
items: products,
amount: amt,
currency: cry
});
}
View mcck.rb
import wixUsers from 'wix-users';
import wixData from 'wix-data';
import {createMyPayment} from 'backend/wixPay.jsw';
import wixPay from 'wix-pay';
$w.onReady(function () {
let user = wixUsers.currentUser.id;
wixData.query('cart')
.eq('userId', user)
.find()
View mcPage.rb
import wixData from 'wix-data';
import wixUsers from 'wix-users';
export function dataset2_ready() {
$w("#forex").value = 'USD';
}
export function repeater1_itemReady($item, itemData, index) {
$item("#price").text = "USD " + itemData.price;
}
You can’t perform that action at this time.