I have a client that wants to sell individual software license keys for their software product; I have not seen a way to sell individual license keys using Wix store; does one exist?
Not available at this moment, just like the gift card selling using Wix Store
You must set up an individual checkout scenario using code.
So I’m trying to create this using this tutorial: [Velo Tutorial: Processing Payments | Help Center | Wix.com](Velo Tutorial: Processing Payments | Help Center | Wix.com
…)
[…](Velo Tutorial: Processing Payments | Help Center | Wix.com
…) combined with this tutorial: https://support.wix.com/en/article/velo-tutorial-sending-a-triggered-email-to-contacts
I’m not sure if I’m heading in the right direction, but I’m sure I’m stuck …
Here is where I’m trying to trigger the email:
if (result.status === "Successful") {
//Here is where I want to trigger the email
wixWindow.openLightbox("Success Box");
}
… but I’m not having any luck, trying to use this code:
wixCRM.emailContact("newsletter_signup", contactId, { "variables": { "name": $w('#nameInput').value, "interest_area": $w("#interestArea").value } })
I can’t figure out how to get the contactID (or even if I can)
You can definitely get the User ID and there are a few ways to do it, though I would start by having a look at this API reference:
This way is better and stable.
Sometimes when you create contact, you found error because the email address has been used to create another contact.
However, you must set the page as member’s only. That means they MUST login.
@burkedunnweb For security, the wixCRM . emailContact() should be handled in the backend. You can see that the stripe tutorial also save data to database once the payment is success, instead of after the data is sent back to front-end(user side)
@wingcc I’ve got my code working perfect in preview mode, but for some reason broken on the live site (payment button just does nothing)
Here is the code for the main page:
import {createMyPayment} from 'backend/pay';
import wixPay from 'wix-pay';
import wixWindow from 'wix-window';
import wixCRM from 'wix-crm';
import wixUsers from 'wix-users';
import wixData from 'wix-data';
$w.onReady(function () {
export function button1_click(event) {
createMyPayment()
.then( (payment) => {
wixPay.startPayment(payment.id, {
"showThankYouPage": false,
.then( (result) => {
if (result.status === "Successful") {
wixData.query("SampleUniqueCodes")
.find()
.then( (product) => {
wixData.remove("SampleUniqueCodes", product.items[0]._id)
.then( (removeItem) => {
let item = removeItem; //see item below
} )
.catch( (err) => {
let errorMsg = err;
} );
});
console.log('successful payment')
} else if (result.status === "Pending") {
console.log('payment failure')
}
} );
} );
}
events.js
import wixUsers from 'wix-users';
import wixCrm from 'wix-crm';
import wixCrmBackend from 'wix-crm-backend';
export function wixPay_onPaymentUpdate(event) {
let paymentId = event.payment.id;
let newTransactionStatus = event.status;
let userInfo = event.userInfo;
}
pay,jsw
import wixPay from 'wix-pay-backend';
import wixData from 'wix-data';
export async function createMyPayment(productId) {
return wixData.query("SampleUniqueCodes")
.find()
.then( (product) => {
let paymentInfo = ( {
items: [{
name: 'The Cool Product: Serial Key: ' + product.items[0].serialKey + ', Password: ' + product.items[0].password,
price: 1
}],
amount: 1
} );
return wixPay.createPayment(paymentInfo);
} );
}
In preview mode it does everything I need it to do, it completes the payment, and in the confirmation email it sends to the purchaser the serial key and password are appended to the name of the product, and the serial key and password I used are deleted from the collection … but in live mode … nothing …
(https://www.burkedunn.com/samplecustompayment
For what it’s worth, the problem started when I changed the permissions on the collection