#xfechx
1 messages · Page 1 of 1 (latest)
Hi alex
hello! if that's the case, why not consider using Payment Links instead? https://stripe.com/en-sg/payments/payment-links
because you cannot modify payment links, and also they are not formal
I want to INVOICE
with proper details and itemized, to clients
payment links are so informal
you also cannot delete them, only disable them
did you read my whole question before we opened this chat?
hi everyone
I am having an issue with creating invoices
I am creating product, then price, then line item, then invoice and when creating the invoice, the error is:
Nothing to invoice for customer```
Also, because I want my clients' businesses to keep a record of their invoices and transactions.
the app takes an amount, currency, connected account, and would like to create a invoice
first.
then I want to have a repeater form field, so that the user can create multiple line items for invoices.
I would prefer if the user does not have to input an email for their customer, just need to obtain the created stripe_hosted_url from the invoice created, so that they can share it with their customers.
// Set the custom branding settings
/*
$settings = array(
'logo' => 'https://example.com/logo.png',
'primary_color' => '#0085c5',
'footer' => 'Thank you for your business!',
);
*/
//1. CREATE A PRODUCT:
$product = $stripe->products->create(
[
'id' => $post_id . '_' . $timestamp,
'name' => $reference,
'active' => true,
],
$connected_account
);
//2.CREATE A PRICE USING THE PRODUCT (CAN BE ONE-TIME OR RECURRING):
$price = $stripe->prices->create(
[
'unit_amount' => $amount,
'currency' => $currency,
'product' => $product,
//'recurring' => ['interval' => $interval, 'interval_count' => 1],
],
$connected_account
);
//Create a new customer
$customer = \Stripe\Customer::create(array(
'email' => 'noreply@example.com',
), $connected_account
);
//Create an invoice with the items, customer, and custom branding settings
$invoice = \Stripe\Invoice::create(array(
'customer' => $customer->id,
'due_date' => strtotime('+7 days'),
//'auto_advance' => true,
'collection_method' => 'send_invoice',
//'line_items' => $line_items,
'description' => $reference,
//'settings' => $settings,
), $connected_account
);
$stripe->invoiceItems->create([
//'customer' => $customer->id,
'price' => $price->id,
//'amount' => $amount,
//'currency' => $currency,
//'quantity' => 1,
'invoice' => $invoice->id,
], $connected_account);
// Retrieve the hosted invoice link and save in the post meta
$stripe_hosted_invoice = update_post_meta($post_id, 'stripe_hosted_invoice_url', $invoice->hosted_invoice_url);```
Also, is it really neccessary to create prices and products before?
in my case, my app will have to create them on the spot for each invoice
I am creating product, then price, then line item, then invoice and when creating the invoice, the error is:
There was a problem with your transaction
Nothing to invoice for customer
Do you have the request id for this error?
also, how can I create an invoice, with a dummy customer, so that the customer fills in their details themselves, I want to make a stripe hosted invoice
I would prefer if the user does not have to input an email for their customer, just need to obtain the created stripe_hosted_url from the invoice created, so that they can share it with their customers.
This isn't possible
So what is possible?
sure, please feel free to check the latest requests:
req_t3kQ9p14CnAQsE
I just want to make a regular invoice with line items, programatically
you'll need to collect all of the customer details up front to create a customer beforehand - i strongly discourage using a dummy customer because that's going to make tracking payments and revenue tracking difficult. The customer also isn't going to be able to fill in their own details on the hosted invoice page
sure, but what are those errors I am getting from?
so to make an invoice I MUST enter the customer details myself, how fun
??
can you plase help me with the errors of my shared request?
I don't know what I am doing wrong
try creating the invoice items first (instead of creating the invoice first)
also, i do not want the invoices to be auto-sent
how can i stop this
the invoice was created but for EUR 0.00
and got the error:
There was a problem with your transaction
Missing required param: customer.
i believe is from the line item, but it doesn't appear on the logs
you'll want to include the customer id
There was a problem with your transaction
The price specified supports currencies of aud which doesn't include the expected currency of eur.
what is this from"
The price specified supports currencies of `aud` which doesn't include the expected currency of `eur`.```
req_67AlWjH8WdPgcr
hello?
is it because the customer defaults to eur?
so annoying and frustrating the limitation of currencies per customer with stripe
gimme a while to get back to you
the customer defaults to EUR because of the first invoice i.e. the $0 invoice in EUR. However, we do support multicurrency customers - https://stripe.com/docs/invoicing/multi-currency-customers. Try passing in the currency parameter when creating an Invoice. For your situation, pass in currency=aud, since you have an AUD price
I got the invoice, but the stripe hosted url is not there?
sure
in_1N38YtHlZBj3A1TOZbXgB73R
ah it says invoice will be finalised and sent in 1 hour
I need the invoices to be finalised as soon as they are created, so that I can provide the user of the app the url of the stripe invoice
https://stripe.com/docs/invoicing/integration/workflow-transitions#status-transitions-endpoints - you can finalize it immediately if you call https://stripe.com/docs/api/invoices/finalize
i would also pass in auto_advance=false to prevent it from sending emails
you can read more about auto-advancement here https://stripe.com/docs/invoicing/integration/automatic-advancement-collection
Please tell me with this where I can insert connected account as per my examples above
'in_1N38iWDt9VTrLgAoGHxPulf6',
[]
);```
have you tried passing it in the same way you've been doing for all your other requests?
I did this, I just don't know what is that array in the middle:
$stripe->invoices->finalizeInvoice($invoice->id, [], $connected_account);
it worked, i guess
I want to ask , how to add programatically for example a tax id, and a footer, and change icon, etc. of the invoice
that array in the middle is for the auto-advance parameter
you can update the branding logo for the connected account here : https://stripe.com/docs/api/accounts/update#update_account-settings-branding-logo
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
when creating the invoice, you can also pass in the footer to be displayed here : https://stripe.com/docs/api/invoices/create#create_invoice-footer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
what tax id are you planning to pass in?
Just want to know where to add custom data in both the header and footer of the invoice programatically
for the footer : https://stripe.com/docs/api/invoices/create#create_invoice-footer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
The user's tax id
Or abn, or steuernummer depending on country
Some invoices require to have that info
In some countries*
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
what are you trying to pass into the header? we don't have a specific header parameter
Ok, just the tax id
Hmm so no custom info can go like where the phone is? I remember making an invoice with some custom info there, with info added somewhere in dashboard?
you can try passing in data via custom fields and see if that works for you : https://stripe.com/docs/api/invoices/create#create_invoice-custom_fields
Can you please give me an example of usage of this? Can it be done on the spot for an invoice?
How can I save this conversation?
Can you please give me an example of usage of this? Can it be done on the spot for an invoice?
You shouldn't be doing this on the spot (although you can), depending on what the connected account type is - Standard, Express, Custom, the connected account may do it via the Dashboard, or for Custom accounts you would typically get the account holder to do it when they onboard with you
what connected account types are you using? Standard, Express or Custom?
Standard
btw, i missed this earlier, but the StripeAccount headers are all passed in incorrectly : https://stripe.com/docs/connect/authentication
it should be something like
'stripe_account' => '{{CONNECTED_ACCOUNT_ID}}'
also with this
account_tax_ids
optional
The account tax IDs associated with the invoice. Only editable when the invoice is a draft.
$connected_account = array('stripe_account' => xxyyzz); I've used connected accounts for years 😉
alright, if you're certain. Cause for the previous requests you provided, i don't see a StripeAccount header being passed in
what's your question for account_tax_ids?
For Standard Stripe accounts, the connected account holders should be updating their branding logo via their Dashboard : https://dashboard.stripe.com/settings/branding
I get invalid array with this req_0p2jtHFqWkVFG9
Does each connected account always have them?
How can I save this chat? to check all of this later?
is it possible
?
How can I save this chat? to check all of this later?
https://discord.com/channels/841573134531821608/1102766688367292557 - you can view the conversation via this link
and will it stay there?
Does each connected account always have them?
I don't understand the question of whether each connected account always have them ? Weren't you asking if you can pass a tax id in?
Do they have a default one? And how does they get passed?
In app, the user enters their tax number and this is saved in their meta, for now
whether each connected account would have a tax id isn't something that i would know. That's something to do with what type of connected account you onboard and the regulations in that country - if you're onboarding a business and the regulations in that country stipulate that all businesses need to register then probably yes?
the tax id isn't provided by Stripe
so how do i retrieve it to be displayed in an invoice
i know tax id is not provided by stripe
i am trying to make the invoices for users as legal as possible, so if they have a tax id (at least in the countries that I am registered to operate) you need to on each invoice.
so, stripe by default doesn't include your tax id on their hosted invoices, that is why I am asking and to maybe pass this info through custom fields. Which by the way, did you have a look at the request error I sent you?
https://stripe.com/docs/tax/invoicing/tax-ids - i think you may want to take a look at this with regards to tax ids
how to do this programatically?
can you share your code for req_0p2jtHFqWkVFG9?
for the connected account's tax id, since you're using Standard accounts, that's something which the Standard account should really be updating via their dashboard
And like the document mentions
You can add account tax IDs when creating a new invoice using the invoice create endpoint by passing a list of object IDs to the account_tax_ids parameter.
for the customer tax ids, there're examples shown here
$invoice = \Stripe\Invoice::create(array(
'customer' => $customer->id,
'due_date' => strtotime('+7 days'),
'currency' => $currency,
'auto_advance' => false,
'collection_method' => 'send_invoice',
//'line_items' => $line_items,
'description' => $reference,
//'settings' => $settings,
'pending_invoice_items_behavior' => 'include',
'custom_fields' => array(
'custom field 1' => 'example',
'custom field 2' => 'example',
),
), $connected_account
);```
How can i retrieve this on behalf of the user You can add account tax IDs when creating a new invoice using the invoice create endpoint by passing a list of object IDs to the account_tax_ids parameter.
hrm, looking into this a bit more
also I cannot seem to save the hosted_invoice_url
sorry, got it
still cannot figure the custom fields
isn't the custom_field supposed to have name and value parameters? where did custom field 1 come from?
name and value?
so like name => xxyyzz
can the invoice have any memo? apart from footer and custom fields?
you might want to take a look at the parameters here : https://stripe.com/docs/api/invoices/create#create_invoice-custom_fields
this is where you can update the memo : https://stripe.com/docs/api/invoices/update#update_invoice-description
regarding including multiple account tax ids on the invoice - since you have Standard connected accounts, i think the best way to go about this is to get the connected account user to manage that via their Dashboard (https://dashboard.stripe.com/settings/billing/invoice) instead of you explicitly passing it in via the API
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
The only way i can see to retrieve the account tax id is by manually copying the object id in the Dashboard right now
So definitely no way of retrieving it through the API?
Hi @dawn egret I'm taking over this thread.
I'm afraid there's no public API for retrieving account tax IDs.
OK, what other custom info can I add to the invoice, apart from the footer and the memo?
custom fields, how do I pass them? It is not clear for me by reading the API
apparently this is not correct:
'custom field 1' => 'example',
'custom field 2' => 'example',
),```
https://stripe.com/docs/invoicing/customize#custom-fields You can learn more about custom fields, and you can also see how they works through Invoice Editor.
still not resolving my issue sorry
I need an example of two custom fields passed in an invoice object, in php please.
I tried this before and it did not like it:
'custom field 1' => 'example',
'custom field 2' => 'example',
),```
Did you get any errors? if so, share with me the request ID.
As the error suggests, you need to pass in an array for custom_fields, not an object.
can you give me an example please
is that not an array?
is it very hard to provide a working example?
I asked chatgpt, super fast
thanks anyway
now I get this:
There was a problem with your transaction
Received unknown parameters: value, name
Another question, can I pass line items directly onto the invoice?
A hosted stripe invoice doesn't load..
I figured it out , did not give me an error, but now i produce a invoice that doesnt load
No you can't, you need to use the invoice item API to create an invoice item https://stripe.com/docs/api/invoiceitems/create?lang=node#create_invoiceitem
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.