Skip to content

Instantly share code, notes, and snippets.

View shanwixcode's full-sized avatar
🏠
Working from home

Shan shanwixcode

🏠
Working from home
View GitHub Profile
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);
import wixPay from 'wix-pay-backend';
export function createMyPayment(products, amt, cry) {
return wixPay.createPayment({
items: products,
amount: amt,
currency: cry
});
}
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()
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;
}
import {getAccess, order} from 'backend/payPal.jsw';
import wixLocation from 'wix-location';
$w.onReady(function () {
});
export function checkout_click(event) {
getAccess()
.then( (tok) => {
import {ok, created, serverError, response} from 'wix-http-functions';
import {capturePayment} from 'backend/payPal.jsw';
import wixData from 'wix-data';
export function post_payPal(request) {
let options = {
"headers": {
"Content-Type": "application/json"
}
};
import {fetch} from 'wix-fetch';
export async function getAccess() {
const response = await fetch("https://api.sandbox.paypal.com/v1/oauth2/token", {
method: 'post',
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Basic " + "" //ENTER ENCODED STRING
},
body: "grant_type=client_credentials"
@shanwixcode
shanwixcode / lightbox.js
Last active June 28, 2020 05:37
Stripe Tutorial - Dude Lemon
//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 () {
@shanwixcode
shanwixcode / stripe.js
Created January 20, 2020 18:22
Stripe Tutorial - Dude Lemon
//stripe.js
import {fetch} from 'wix-fetch';
const apiKey = "pk_test_xxxxxx"; //Stripe Public API Key
export async function stripeToken(cardObject) {
let values = encodeCard(cardObject);
@shanwixcode
shanwixcode / stripeProcessor.js
Last active June 28, 2020 05:35
Stripe Tutorial - Dude Lemon
//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({