Can someone PLEASE share the backend code and the client side code for collecting payments based on QUANTITY? For example I need my clients to pay $25 per page for my Standard Editing service.
top of page
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
bottom of page
@Juanita Taylor
I believe this should work for you.
PAGE CODE
import {createMyPayment} from 'backend/pay'; import wixPay from 'wix-pay'; export function buynow_click(event) { createMyPayment($w('#productname').text, $w('#qty').value, $w('#price').text,) .then( (payment) => { wixPay.startPayment(payment.id); } ); }
BACKEND jsw
//pay.jsw import wixPay from 'wix-pay-backend'; export function createMyPayment(description,value, customamount){ let cPaymentString = { amount: customamount * value, quantity: value, items: [{name: description, quantity:value, price: customamount, }] }; return wixPay.createPayment(cPaymentString); }
Note that:
Name is a text field.
Quantity is an input field, but it could be a dropdown
Price is a text field that is a number
This is also attached to a database, but it doesn't have to be.
https://support.wix.com/en/article/wix-code-tutorial-processing-payments
https://www.wix.com/code/reference/wix-pay.html
https://www.wix.com/code/reference/wix-pay-backend.html
https://support.wix.com/en/article/wix-code-tutorial-using-the-wix-pay-api-to-collect-payments-for-a-single-product
https://support.wix.com/en/article/wix-code-tutorial-using-the-wix-pay-api-to-collect-payments-for-products-in-a-database-collection
https://www.wix.com/code/home/forum/wix-tips-and-updates/example-accept-payments-with-wix-pay-api