Stripe.js - how to send an invoice by email for collection immediately?

Thanks for that.

I set up the call but am not receiving any emails when finalizing and receiving a code 200.

Do emails not get sent to customers in test mode?

If I remember, the email will not be sent if you are using the sandbox. But the webhook yes.

Strange… Even on the live side I’m not receiving the email for some reason despite the settings set to send for collection on Finalization…

I also don’t see any event suggesting that the email was sent

Do you have send_invoice for “billing” parameter in “create invoice” action?
https://stripe.com/docs/api/invoices/create

Yes, I believe that is part of the plugin @copilot has created:

image

The name seem to point to that right :stuck_out_tongue_winking_eye:
Do you get an API reply like the status after finalize? (the payload is longer than that)

I forget, But Stripe can wait a moment to send the invoice too.
I think you can force to send it using this endpoint:
https://stripe.com/docs/api/invoices/send

That managed to work OK and did indeed trigger the e-invoice, thank you.

What i’m trying to figure out now is how to setup the call to modify the line-item description because I think i don’t have the Argument ‘descripion’ set correctly or something…

You have set the description into a Header key and not in Parameters.

Isn’t that the way I currently have it though?

I also notice that the Stripe.js plugin to create the item shows “(body)” beside the paramater but mine shows “(headers)”

image

No. You are in header. Look after Body type and add parameter

I get an invalid POST request error when i set it up there.

Is this not correct?

image

Or is something to go into the little text box?

Can you give the full detail or error?
Be sure to use the right item ID

Here is what gets displayed in the error and yes i’m using a correct ID as it’s working up until I try and add the paramater. I get a code 200 just fine.

There was an issue setting up your call.

Raw response for the API
{
“error”: {
“message”: "Invalid request (check that your POST content type is application/x-www-form-urlencoded). If you have any questions, we can help at https://support.stripe.com/.",
“type”: “invalid_request_error”
}
}

Try to add the content type header
In header add
Content-Type with value: application/x-www-form-urlencoded

Looks like it’s the same error:

I don’t think that’s the issue…

Stripe.js plugins seem to have (body) before the paramater.

Now it reads (param.) before the paramater key.

image

I do a few test and see very strange behavior of the API connector.
I think it’S a bug and must be reported to Bubble.
Test a) Put only a parameter with no header
Content type is to application/json (wrong, if we consider that json body is empty, this should be application/x-www-form-urlencoded)
Test b) Put paramter with application/x-www-form-urlencoded in header. Bubble overwrite it to json again.
Test C) Put a body json (no parameter) and add header application/x-www-form-urlencoded… Header received is… application/x-www-form-urlencoded (Wrong, should be json, because there’s a json body!)
Test d) But form data body type, parameters, and header to application/x-www-form-urlencoded … Header stay form data (and I think this is the right think)
@neerja Can you confirm this? if yes, maybe add a body type for application/x-www-form-urlencoded and use parameters like we expect it to work

Now, You may try this:
add parameters, set querystring
In json body, set only {}
I really don’t know if this will work, but the header will stay application/x-www-form-urlencoded

Issue is solved.

You have to use the Json text box and put a parameter there in a specific format.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.