Hey, we’re excited to announce our new APIs for managing pricing plans!
These APIs work seamlessly with our existing paid plans APIs, which you can use to customize how your site members order and purchase pricing plans.
We now added plan management functions and backend events to Velo, so that you can perform managerial activities with APIs on your pricing plans, just as you do use the Dashboard. These activities include:
Creating and updating plans
Hiding, showing, and archiving plans
Rearranging the order plans appear on the site page
Deleting plans
Setting which plan is the primary plan, and clearing the primary plan
Getting statistics about a plan
Getting, listing, and querying plans.
Let us know what do you think? Thanks.
I've already created a post
https://www.wix.com/velo/forum/coding-with-velo/building-a-custom-paid-plan-section?appSectionParams=%7B%22origin%22%3A%22member_posts_page%22%7D
And its been more than a week since I asked wix support assistance.
We are under a very (very!) tight agenda.
I would deeply appreciate your help on this matter.
Thank you!!!!
hi @Antanas Dapkus !
Thank you for your response
I've already tried that and couldn't make it work.
Would you mind taking a look?
I haven't followed the all items (with repeater instructions) as they are working fine without any coding.
Js:
export function multiply(factor1, factor2) { return factor1 * factor2; } // Execute the sample function above by copying the following into your page code /* import {multiply} from 'backend/events'; $w.onReady(function () { multiply(4,5).then(product => { console.log(product); // Logs: 20 }) .catch(error => { console.log(error); }); }); */ /***************************** * Backend code in events.js * *****************************/ // For inserting data into a collection. import wixData from 'wix-data'; // The onPlanPurchased() event is fired when a plan // is purchased, or a free plan is ordered. // Get the order information // from the event's order object. export function wixPaidPlans_onPlanPurchased(event) { // The PlanEvents collection has a title field, // in which we insert the type of transaction. // The collection also has a data field, // where we will insert information about the order // from the event's order object (json). if (event.order.price.amount === 0) { let orderData = { "title": "Free plan purchased", "data": event.order }; wixData.insert("Tracking purchases", orderData); } else { let orderData = { "title": "Regular plan purchased", "data": event.order }; wixData.insert("Tracking purchases", orderData); } }
---------
On Item page:
#dataset1 - Plans - Planestestimonial
#tracking - Purchases - Tracking Purchases
#comprar -buy btn
Code: import wixWindow from 'wix-window'; import wixPay from 'wix-pay'; import wixPaidPlans from 'wix-paid-plans'; import wixUsers from 'wix-users'; $w.onReady( () => { const currentPlanObject = $w("#dataset1").getCurrentItem(); const planId = currentPlanObject._id; const planPrice = currentPlanObject.price; $w('#comprar').onClick((event) => { let user = wixUsers.currentUser; let isLoggedIn = user.loggedIn; if (!isLoggedIn) { wixUsers.promptLogin().then(() => { processPlan(planId, planPrice); }) } else { processPlan(planId, planPrice); } }); }); function processPlan(myId, myPrice) { if (myPrice > 0) { wixPaidPlans.orderPlan(myId).then(orderObject => { wixWindow.openLightbox("confirm", orderObject) .then((goForIt) => { if (goForIt) { wixPay.startPayment(orderObject.wixPayOrderId); } }); }) } else { wixPaidPlans.orderPlan(myId).then(orderObject => { wixWindow.openLightbox("congrats", orderObject); }) } } /** * Sets the function that runs when a new repeated item is created. * @param {$w.$w} $item, * @param {Object} itemData, * @param {Number} index */ export function repeater1_itemReady($item, itemData, index) { // This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4 // Add your code for this event here: } /** * Adds an event handler that runs when the element is clicked. * @param {$w.MouseEvent} event */ export function comprar_click(event) { // This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4 // Add your code for this event here: }
Hi there @Antanas Dapkus ,
I'm on a very very tight deadline and still cant make the plans wok correctly.
I'm unable to set which plans are primary and so.
Right now im trying to build them with repeaters and dynamic pages and it doesn't seem to work either.
What I'm trying to do:
- Set a basic plan
- Set a premium plan (if you have basic)
-Show only the basic plan on the plans page
-show only the premium plan on the members area
- delete archived plans
- Archived plans shouldn't display on members permission for pages.
any ideas?
Thank you!!!!
Hi I´ve started a new project tha is and online school i´ll have a bunch of diferent courses = differents plan prices but i´m having a problem i need that the member who bought a course ( plan ) see only the course that he has bought. i´ve tried different codes for it but i´m not having sucess i´ve got diferrents Database for each course, because it´s linked with dynamic pages with all the course content And have 1 Data for the member but i-m having trouble to show for that expecific member only the course or courses that he bought FOR EXAMPLE
i´ve bought a free course and a 100 U$ course in my member page nedd to be showed only these 2 courses not all the courses that i-ve got it´s that possible ?
Thanks a lot