#xfechx

1 messages ยท Page 1 of 1 (latest)

torpid sleetBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

  • xfechx, 22 hours ago, 11 messages
magic plover
#

Are these one-time invoices or subscription invoices?

Can you share an example?

shadow adder
#

One time invoices

#

sure

magic plover
shadow adder
#

evt_3OiexlABIsA579c61bbzjCg7

magic plover
shadow adder
#

No, I didn't

#

just want to know if I should send it on the product or on the invoice

magic plover
#

Depends on your usecase ๐Ÿ™‚

shadow adder
#

for it to appear under charge.succeded

#

so, for it to apper under charge.succeded?

#

Also, we would like to edit the description that comes up in the payments list, so that we can include our reference there. Can we also modify that when charge.succeded event?

#

this is in the use case of one-off invoices

magic plover
#

I'm not sure we automatically copy the metadata on the charge object.

if you set the metadata on the invoice then you can expand the invoice parameter when you receive charge.succeeded event

shadow adder
#

I am happy to do it alternatively, if there is a simpler way, for exmaple under product or price?

#

because for one off invoices I am creating the prouct and price on the fly

magic plover
#

price/product info doesn't show up on the charge directly, it's nested under invoice
I'm thinking but there's no way to get the metadata over to charge.succeeded

Taking a step back, is there a reason you're not listening to invoice.paid events instead?

shadow adder
#

you should see my listener (webhook) file, it already does so much with all different events, so I am trying to keep it cleaner by listening to less events. I have already setup a system that listens for charge.succeded, it also listens for invoice.payment.succeded, but for when there are subscriptions as before in stripe invoices where only related to recurring payments

magic plover
shadow adder
#

I added a note here on my listener:

if($collect_fees && $invoice->lines->data[0]->price->type != 'one_time'){ //for one-time invoices: only getting transfers from charge.succeded, not from invoice.payment_succeeded. 
                if($app_version === 'v1' || $app_version == null){
                    if($connected_account['stripe_account'] == null){
                        stripe_transfer_instantly();
                    } 
                    else{
                        collect_fees_application();
                        if(!empty($metadata['Affiliate'])){
                            collect_fees_affiliate($metadata['Affiliate']);
                        }
                    }
                } 
                else if ($app_version === 'v2'){
                    stripe_transfer_instantly();
                }
            }
magic plover
#

๐Ÿ‘

shadow adder
#

actually, can you help me expand

#

I see why I use the event with charge.succeded., because stripe_transfer_instantly() takes the charge details

#

as a source

#

uses the charge object, not the invoice object

#

but, I have this, under invoice.payment_succeded
$charge = \Stripe\Charge::retrieve($event->data->object->charge, $connected_account);

#

will that be sufficient to retrieve charge object from a one off invoice?

magic plover
#

It should be afaik, I'd say give it a try in test mode to be 100% certain