Hello there. I am trying to use the payment provider SPI to implement a new payment provider on our website. The issue I am facing is that when I added the new payment SPI custom extension to my website together with the necessary code, NOTHING happens. No new payment provider is shown on the website settings. And, the worst part, I can’t see any logs that could help me out pointing what is going on and what is the problem.
Can you provide the following?
- The code that is not working
- The steps to reproduce the issue
So, to start off, the code was developed mostly based on the references found here, here and here.
My code is almost a copy of the tazapay example provided in the aforementioned links. Of course, the payment provider side and API is where most of the differences are. Furthermore, I have created most of it using Wix blocks so I can reuse it on other websites. But before I go into the code I created with blocks, first let me explain what I did on the website code.
On the website, the first thing I did was to add my custom app which I created with Wix blocks (as mentioned above). To do that I went to the Packages & Apps section => “Custom Apps” => “< plus symbol >” => “Install Custom Apps” => selected my app.
Then, I went to the code section and clicked on “Custom Extensions” => “< plus symbol >” => “Add payment SPI”. Let’s say I called the extension “payfo”. Then, within the two files that were created (payfo.js
and payfo-config.js
), I added the following code:
// payfo-config.js
import { getConfig as getPayFoConfig } from '@fabiomolinar/payfo-integration-backend';
export function getConfig(){
return getPayFoConfig()
}
And
// payfo.js
import { connectAccount as connectPayFoAccount } from '@fabiomolinar/payfo-integration-backend';
import { createTransaction as createPayFoTransaction } from '@fabiomolinar/payfo-integration-backend';
import { refundTransaction as refundPayFoTransaction } from '@fabiomolinar/payfo-integration-backend';
export const connectAccount = async (options, context) => {
return connectPayFoAccount (options, context)
}
export const createTransaction = async (options, context) => {
return createPayFoTransaction (options, context)
}
export const refundTransaction = async (options, context) => {
return refundPayFoTransaction (options, context)
}
Now, I really don’t want to copy and paste the entirety of the code within the payfo-integration
package because it would take too much space. Let me know if that’s really necessary and I can paste more stuff here.
What I can tell you is that within the Wix block environment, I have unit tested each one of the connectAccount as connectPayFoAccount
, createTransaction as createPayFoTransaction
, and refundTransaction as refundPayFoTransaction
functions. And they are working exactly as expected. That is, connectAccount
returns the credentials to connect to the payment provider, createTransaction
creates an order with the external payment provider and returns the external order ID and the redirect URL, and refundTransaction
creates a refund. These functions individually work as expected and are returning the objects as defined in the documentation here.
Now, what I don’t get is why I can’t see a new payment provider being listed in my website settings dashboard. Since I can’t see any new payment provider listed there, I am left without any clue as to why this is not working.
Yesterday I went through the website logs on my Google Operations account and I realized that the following log message (with a default
level) was created around the time I tried to add the Payment SPI. The message says: Custom integration wasn`t published due to an internal error - INVALID_ARGUMENT: Invalid filter. Filter expression cannot contain an empty condition. Try to publish your site again in a few minutes. Please contact Customer Care If the problem persists. Does this rings a bell?
I tried publishing the website a dozen of times and the problem isn’t resolved yet.
Hello Fabio, I am currently dealing with a challenge similar to the one you are posing in this post, unfortunately the first link that you show and that you can give me is no longer publicly visible. Is it possible for you to share some more information about how you solved the problem, could I contact you via email?
Hello Hamilton,
Sorry for the delay in my response.
Yes, I ended up getting the payment SPI to work. However, the issue was on Wix’s side and I had to resolve it together with their technical and support team.
Feel free to reach out.