Product:
Wix Editor (not Wix Studio) and Wix Pay API.
What are you trying to achieve:
I am trying to implement a simple payment flow using wixPay.startPayment(). The user selects a quantity of items (drinks) and I need to start a payment for the correct amount when they click the submit button. I need to use Stripe, Paypal and Alipay as valid payment methods. The currency must be JPY.
What have you already tried:
I have tried numerous different code combinations, focusing on different aspects:
-
I have tried converting the payment amount to an integer using parseInt(amount, 10)
-
I have tried sending the payment amount as a string using String(amount)
-
I have tried various different combinations of payment options, including currency and valid payment methods.
-
I have tried using a minimal code example, where I call wixPay.startPayment() with a hardcoded integer for the amount, and a fixed list of payment options.
-
I have tried the same tests on the live and preview versions of the site.
-
I have tried to simplify the logic as much as possible.
-
I have double checked that Stripe, Paypal, and Alipay are correctly set up in the WIX settings.
Regardless of the code variations, the wixPay.startPayment() function fails with the same “invalid arguments” error . This error persists despite explicitly defining amount as a number (integer), and passing a currency parameter, and a valid payment method.
I have followed the Wix documentation on wixPay.startPayment(), and I believe my parameters are correct.
Here are the different forms of the error that I have received:
-
Error during payment wixPay.startPayment: invalid arguments
-
Wix code SDK error: The value of “amount” parameter that is passed to the startPayment method cannot be set to the value “1000”. It has an inappropriate data type. A number is expected instead of a string.
-
Wix code SDK error: The value of “amount” parameter that is passed to the startPayment method cannot be set to the value 4000. It must be of type string.
-
Wix code SDK error: The value of “amount” parameter that is passed in the startPayment method cannot be set to the value “6000”. Its length must be between 1 and 4. Please ensure that the length of the passed “amount” parameter can be set to the value 4000. its length must be between 1 and 4.
Additional information:
-
The site is configured with JPY as the main currency.
-
The console output consistently shows the same “invalid arguments” error.
-
My payment accounts (Stripe, Paypal, and Alipay) are all correctly connected.
-
I have added console logs to track exactly what is happening.
-
The issue occurs on both the preview and live site.
-
I have a very simple use case for this, that does not involve many dependencies or logic.
I’m at a loss as to why this simple payment process is not working. I suspect there might be a Wix platform issue, or an unexpected conflict. I have thoroughly analyzed the code, and I believe the code logic and values are correct.
I’m including screenshots of my console outputs.
I hope you can help me identify the cause and resolve this issue. Thank you.