To process payments on your site, first set up your site to accept payments as described in About Accepting Payments. When setting up your site to accept payments, be sure to select the payment methods you want to offer and set your payment currency. You can also set up a list of alternative currencies to display your prices in. Use the currency objects and the currency conversion dropdown element to set up and display product prices in different currencies.
Note: The SDK frontend module contains only the Currencies submodule of the wix-pay-frontend
Velo API. The wix-pay-backend
Velo API has no equivalent module in the SDK.
Use this module's functionality, in conjunctions with the wix-pay-frontend
and wix-pay-backend
Velo APIs.
The following list outlines the steps taken in a typical payment lifecycle:
PaymentInfo
object containing information about
the payment, such as the payment amount, is created in the backend function.createPayment()
from the wix-pay-backend
Velo API using the
PaymentInfo
object and returns the generated
Payment
object to the calling client-side event handler.startPayment()
from the wix-pay-frontend
Velo API
with the id from the Payment
object, which opens
the payment popup on your site.PaymentResult
.onPaymentUpdate()
event.To use the Pay API, import * as wixSitePay
from the @wix/site-pay
module:
Note: To work with the Pay API, you need to save and publish your site.