#arielbo-webhook-billing_details

1 messages · Page 1 of 1 (latest)

summer driftBOT
fast warren
#

Hi 👋 can you elaborate a bit?

raven turret
#

hello toby

#

I will need to listening "billing_details": { maybe do you have one event to do this with payment_intent ?

#

its possible ?

fast warren
raven turret
#

I put the data in stripe.confirmPayment and now I want to recovery with event with webhooks

fast warren
#

Gotcha, you're probably looking for the details on the associated Charge object then.

With the Payment Intent ID you get from the webhook Event, you can use this endpoint to list Charge objects and provide the ID of the Payment Intent in the payment_intent field to filter the results to just Charges associated with that Payment Intent.
https://stripe.com/docs/api/charges/list

Then you can find pull the billing_details from the Charge object.

raven turret
#

how can I recovery this data? $stripe->charges->all(['limit' => 3]);

#

I have Payment Intent ID but how can I recovery with charges ?

#

maybe $stripe->charges->Payment Intent ID ?

#

Im using php

fast warren
#

You provide the Payment Intent ID in the payment_intent field.

raven turret
#

Yes but where?

fast warren
#

You can use the limit included in the snippet as a framework. Change the limit parameter name to payment_intent to change what parameter you're providing, then change the 3 to a string with the ID of your Payment Intent.

raven turret
#

$stripe->charges->all(['payment_intent' => Payment Intent ID]); ?

#

And this works in my webhook ?

#

// Handle the event
switch ($event->type)
{
// Handle the event
case 'payment_intent.succeeded':

$stripe->charges->all(['payment_intent' => Payment Intent ID]); ?

....

fast warren
#

That looks right, once you replace Payment Intent ID with a string containing the ID of your Payment Intent.

raven turret
#

let me try

fast warren
#

arielbo-webhook-billing_details

raven turret
#

works

#

Stripe\Collection JSON: {
"object": "list",
"data": [
{
"id": "ch_3adfasfasdf",
"object": "charge",
"amount": 877,
"amount_captured": 877,
"amount_refunded": 0,

No please your help how can I access to this ?

#

$pi = $stripe->charges->all(['payment_intent' => $paymentIntentID]);

                    echo $billing_details = $pi->data->billing_details;
#

not work

fast warren
#

Did you try pointing to the first element of data since it is an array?

raven turret
#

how sorry ?

#

effective is array hoe access to this

near thicket
#

Hi 👋
I'm stepping in for @fast warren . What is it you are trying to access?

raven turret
#

data->amount

#

first $pi->data->amount; but not work

near thicket
#

As my colleague stated, data is an array so you cannot access data->amount

#

You will need to access an element in the array first

raven turret
#

yes but is rare the response of stripe

#

object(Stripe\Charge)#5240 (47) {
["id"]=>
string(27) "ch_3MSEEfHHulAmiNnD1n1wjglO"
["object"]=>
string(6) "charge"
["amount"]=>
int(877)
["amount_captured"]=>
int(877)
["amount_refunded"]=>
int(0)

#

as you can see

near thicket
#

You are talking about this response, correct?

Stripe\Collection JSON: {
    "object": "list",
    "data": [
        {
            "id": "ch_3adfasfasdf",
            "object": "charge",
            "amount": 877,
            "amount_captured": 877,
            "amount_refunded": 0, 
#

You should be able to examine the response from the API and determine what method you need to use to access the data

raven turret
#

its ok ..

#

Im access like

#

$pi = $stripe->charges->all(['payment_intent' => $paymentIntentID]);
$bd = (object) $pi->data[0];
$user_nombre_bi = $bd->billing_details->name;

#

works good !

#

thanks for your help

#

I don-t understand why your event payment_intent.succeeded dont send all data of the payment intent in success, its not practice, but with charges object works good

#

another how can I update metada in this same event ?

#

payment intent update ?

#

is possible ?

near thicket
raven turret
#

$stripe->paymentIntents->update(
$paymentIntentID,
['metadata' => ['Nombre' => $user_nombre,
'User Email' => $user_email,
'Teléfono' => $user_telefono]]
); NOT work

#

I need to add metadata in payment_intent.succeeded event can I do this with update?

near thicket
#

You cannot add metadata to the event but if you add metadata to the Payment Intent prior to the payment completing, then that metadata will be present in the Payment Intent object that is sent in the payment_intent.succeeded event

raven turret
#

good answer

#

not update

#

maybe i'm doing something wrong ? in my query please could you help me

near thicket
#

Can you share the request ID for the failed API request?

raven turret
#

"id": "evt_3MSOVHHHulAmiNnD1RVpa1c2",

#

"request": {
"id": "req_0UgyeEFGcqcbvy",

near thicket
raven turret
#

req_IBNuvnCj0rAM16

near thicket
#

That request was successful and set the s_name property. What about this didn't work?

raven turret
#

It seems to have been updated but it doesn't show up in the webbooks