This is fresh out of the oven, and boy is it smelling good!
You can use Wix Code Pay API to collect payments from your site's visitors outside the context of a Wix App (like Wix Stores). The API allows you to collect a payment when triggered by any user interaction on any page.
Here are some examples:
Warning: Before starting with payments, it is important that you fully understand the security concerns that arise when collecting payments. For more details, see the article linked below.
Also: Due to the nature of the API, the API requires the site to be saved and published, to have a payment method setup for the site (in site settings -> accept payments), and to have currency selected for the site (in the site settings > general info).
How does it work?
The Pay API consists of three parts:
createPayment() - A backend function for securely creating a payment.
startPayment() - A client-side function for prompting your users to enter their payment information.
onPaymentUpdate() - A backend event for handling payment status updates.
A typical payment lifecycle looks something like this:
A site visitor clicks a button to start the payment process.
The click triggers a call to a backend function that securely creates the payment and its corresponding unique payment ID.
The payment ID is used client-side to open a payment popup.
The site visitor enters the payment information, such as credit card number.
Optionally, you can react to updates in the payments status that trigger a backend event.
To learn more about the payment process, security concerns, and for code examples see: