Error - Stripe API, send invoice

Hi,

I have a simple Stripe API for sending invoices.

But when it runs it gives the error below on the App connect page.
I have tested it multiple times with different invoice numbers and the same error appears.

Can anyone assist to where the issue could be?

{
    "code": 0,
    "file": "/var/www/vhosts/MY_DOMAIN.XYZ/httpdocs/dmxConnectLib/modules/api.php",
    "line": 65,
    "message": "http_build_query() expects parameter 1 to be array, null given",
    "trace": "#0 [internal function]: exception_error_handler()\n#1 /var/www/vhosts/MY_DOMAIN.XYZ/httpdocs/dmxConnectLib/modules/api.php(65): http_build_query()\n#2 /var/www/vhosts/MY_DOMAIN.XYZ/httpdocs/dmxConnectLib/lib/App.php(197): modules\\api->send()\n#3 /var/www/vhosts/MY_DOMAIN.XYZ/httpdocs/dmxConnectLib/lib/App.php(169): lib\\App->execSteps()\n#4 /var/www/vhosts/MY_DOMAIN.XYZ/httpdocs/dmxConnectLib/lib/App.php(137): lib\\App->execSteps()\n#5 /var/www/vhosts/MY_DOMAIN.XYZ/httpdocs/dmxConnectLib/lib/App.php(126): lib\\App->exec()\n#6 /var/www/vhosts/MY_DOMAIN.XYZ/httpdocs/dmxConnectLib/lib/App.php(104): lib\\App->exec()\n#7 /var/www/vhosts/MY_DOMAIN.XYZ/httpdocs/dmxConnect/api/admin/stripe_invoices/stripe_send_invoice.php(8): lib\\App->define()\n#8 {main}"
}
  1. Have you tried this doing this manually with an actual in_XXXX number from stripe and using your SK_ key? If not, do so, and make sure you can successfully run and define the API schema.

  2. If that works, it’s simply a case that 1 of your 2 parameters are wrong - inv_ or SK_

Let me know …

hi @scalaris,

thanks for the reply. Yes I have tried manually entering the inv and the sk_ manually, the same error appears. Its really strange, because I run other stripe APIs without a problem (thanks to your previous help :). But its the send_invoice api that fails. It also fails if I use the built-in stripe wappler ‘send_invoice’ api. Same error.

It sounds to me like a wappler error - there is a lot of reference made to wappler lib etc.

Try it with a 3rd party tool like insomnia

thank you. I will download and test it.

@scalaris, I tested with insomnia and the API works fine using a test invoice.
@George @Teodor , is this a #wappler-general:general-bugs?
I can’t get send_invoice to work with normal API server setup and also using the built in wappler send_invoice.
There error appears to be point to Wappler? But unsure.
Is there a way to force Wappler to recreate the dmxConnectLib?
PHP server model.

Can you delete your project lib directory and see what it’s line after rebuild

where do I delete it?

Delete the lib folder in your project directory

One other question - Does your {{stripe_api}} variable used in the API action above include the 'Bearer ’ string along with the SK_ variable ?

Yes I do I have Bearer along with the SK_value. My other APIs work and are a mix between the. Jolts in Wappler built in stripe API and normal API used to connect to Wappler.

After rebuilding the LIB, I still get the error. The query correctly outputs the invoice number, but fails not he API action.

The other APIs work.
Not sure what the issue is. Testing on Insomnia work find and updates Stripe correctly.

It’s a strange one. I use the latest wappler version with nodejs and if you want me to test it with your test keys and in_ number specifically, let me know. I don’t ever use that call in my code as stripe automatically sends invoices after transactions in live mode

it is a strange one. its not essential but desired. I am glad to know that stripe sends the invoice auto in live mode. The worst case they have a delay of 1 hour. But anyhow. I appreciate your help always @scalaris. :slight_smile:

@George @Teodor I think this is a Wappler Bug. It was tested externally and it works, but within Wappler it does not.

Seems there is a bug in the api module when using post with no data.

Please test the following update.

api.zip (2.8 KB) Unzip to dmxConnectLib/modules.

1 Like

Hi @Patrick - Yes! It works. Thanks you!
So glad, I’ve spent hours trying to resolve. :slight_smile:

Hi @Patrick /@George , I noticed a recent auto update that was pushed a day or so ago for api.php? I updated it and it still causing the same error. However the api.zip you provided above works! So I am not sure if the wrong update was sent live? can you provide advise?

There were no any Wappler updates since last Thursday. This fix will be included in today’s update.

Thanks Teodore.

This is what comes up when I restarted wappler. Its asking to update api.php - is that because I manually replaced the file with the one Patrick provided?