Good morning ! I come to ask for your help to create packages with direct payments for the members of my site. the second step is that as soon as a member takes a package his account is automatically credited with the credit value of said package, but also as soon as he uses his credits it counts down to 0 (no more credits available). help me with wix code proposals. thank you.
You can first offer these packages using Wix pricing plans .
Displaying these on a page for members to purchase, and then coding it so on payment successful, you add a certain number to a database with their info. So for example if I purchase the a plan with 5 credits, my user email and credits are added to a database.
Here is some example code on how it could be done.
import wixPaidPlans from 'wix-paid-plans';
import wixData from 'wix-data';
$w.onReady(function () {
$w("#button").onClick(()=> {
wixPaidPlans.purchasePlan("planId") // you can get the plan id from the paid plans db
.then((results)=> {
if (results.wixPayStatus === "Successful") {
let toInsert = {
email: "userEmail",
credits: 5
}
wixData.insert("DBNAME", toInsert)
.then((res)=> {
console.log(res)
})
}
})
})
});
Here are some more helpful links -
Wix Data
Wix Paid Plans
Hello Jarod! Happy New Year. I was sick that’s why I did not respond to your comment since the day you posted it. Thank you for your idea, imagine that I had the same idea but I did not know how to unfold it with the wix velo code. I will try to adapt your idea to my situation and I will get back to you.
Hello there! It is an old post but I was wondering if you had found a way to create a credited value system for WIX?
Would really appreciate any help!