Did you read the Wix Pay API and Wix Pay Backend API sections as there are code examples there that can help you.
https://www.wix.com/corvid/reference/wix-pay.html
https://www.wix.com/corvid/reference/wix-site-backend.html
Along with the Thank You Page API itself.
https://www.wix.com/corvid/reference/$w.ThankYouPage.html
https://www.wix.com/corvid/reference/wix-pay.html#startPayment
Start a payment on button click with a custom thank you page
/**************************
* backend code - pay.jsw *
**************************/
import wixPay from 'wix-pay-backend';
export function createMyPayment() {
return wixPay.createPayment({
items: [ {
name: "Product Name",
price: 9.99
} ],
amount: 9.99
} );
}
/********************
* client-side code *
********************/
import {createMyPayment} from 'backend/pay';
import wixPay from 'wix-pay';
import wixWindow from 'wix-window';
export function myButton_click(event, $w) {
createMyPayment()
.then( (payment) => {
wixPay.startPayment(payment.id, {"showThankYouPage": false})
.then( (result) => {
if (result.status === "Successful") {
wixWindow.openLightbox("Success Box");
} else if (result.status === "Pending") {
wixWindow.openLightbox("Pending Box");
}
} );
} );
}