#xfechx

1 messages · Page 1 of 1 (latest)

iron pathBOT
dawn egret
#

Hi alex

rustic cove
dawn egret
#

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

rustic cove
#

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

dawn egret
#

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

rustic cove
#

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

dawn egret
#

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

rustic cove
#

try creating the invoice items first (instead of creating the invoice first)

dawn egret
#

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

rustic cove
#

you'll want to include the customer id

dawn egret
#

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"

rustic cove
#

where are you seeing that error?

#

do you have the corresponding request log id?

dawn egret
#
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

rustic cove
#

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

dawn egret
#

I got the invoice, but the stripe hosted url is not there?

rustic cove
#

is the invoice finalized?

#

can you share the invoice id so i can take a look?

dawn egret
#

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

rustic cove
#

i would also pass in auto_advance=false to prevent it from sending emails

dawn egret
#

Please tell me with this where I can insert connected account as per my examples above

  'in_1N38iWDt9VTrLgAoGHxPulf6',
  []
);```
rustic cove
#

have you tried passing it in the same way you've been doing for all your other requests?

dawn egret
#

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

rustic cove
#

that array in the middle is for the auto-advance parameter

#

what tax id are you planning to pass in?

dawn egret
#

Just want to know where to add custom data in both the header and footer of the invoice programatically

rustic cove
dawn egret
#

The user's tax id

#

Or abn, or steuernummer depending on country

#

Some invoices require to have that info

#

In some countries*

rustic cove
#

what are you trying to pass into the header? we don't have a specific header parameter

dawn egret
#

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?

rustic cove
dawn egret
#

How can I save this conversation?

rustic cove
#

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?

dawn egret
#

Standard

rustic cove
dawn egret
#

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 😉

rustic cove
#

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?

dawn egret
#

I get invalid array with this req_0p2jtHFqWkVFG9

dawn egret
#

How can I save this chat? to check all of this later?

#

is it possible
?

rustic cove
#

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

dawn egret
#

and will it stay there?

rustic cove
#

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?

dawn egret
#

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

rustic cove
#

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

dawn egret
#

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?

rustic cove
dawn egret
#

how to do this programatically?

rustic cove
#

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

dawn egret
#
    $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.

rustic cove
#

hrm, looking into this a bit more

dawn egret
#

also I cannot seem to save the hosted_invoice_url

#

sorry, got it

#

still cannot figure the custom fields

rustic cove
#

isn't the custom_field supposed to have name and value parameters? where did custom field 1 come from?

dawn egret
#

name and value?

#

so like name => xxyyzz

#

can the invoice have any memo? apart from footer and custom fields?

rustic cove
iron pathBOT
rustic cove
#

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

#

The only way i can see to retrieve the account tax id is by manually copying the object id in the Dashboard right now

dawn egret
#

So definitely no way of retrieving it through the API?

pearl oyster
#

Hi @dawn egret I'm taking over this thread.

#

I'm afraid there's no public API for retrieving account tax IDs.

dawn egret
#

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',
        ),```
pearl oyster
dawn egret
#

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',
        ),```
pearl oyster
#

Did you get any errors? if so, share with me the request ID.

dawn egret
#

req_0p2jtHFqWkVFG9

#
Invalid array```
pearl oyster
#

As the error suggests, you need to pass in an array for custom_fields, not an object.

dawn egret
#

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

pearl oyster
dawn egret
#

did you receive my last question?

#

invoice doesn't load

#

loads infinitely