#BidBird®

1 messages · Page 1 of 1 (latest)

snow radishBOT
winter lodge
#

I can see when stripe sends the updated PI it seems to strip the coupon_name is that expected behavior on the metadata

main heath
#

Let me test this with value 'null'..

winter lodge
#

ok! that sounds great

main heath
#

I am unable to reproduce this on my end and a value null is not ignored

winter lodge
#

interesting.

main heath
#

Here is what I see on my Dashboard and can see the values on my request in the Dashboard as well.

#

Can you confirm which library you're on?

crystal cedar
#

👋 yeah what are you really doing. You talk about axios or fetch which doesn't add up if you're using our API

winter lodge
#

Undefined array key "coupon_name" that's what I'm getting on the webhook which is returned. If the coupon_name is stripped prior to getting to stripe, then that makes sense.

What's happening is after a customer selects a number of credits the js updates the payment intent:

await (async () => {     

const response = await axios.post('https://bidbird.test/auctions/jobs/create/job-credits/update', {        
//method: "POST", // or 'PUT'        
// headers: {        
//     "Content-Type": "application/json",        
// },        
// body: JSON.stringify
({            
params: {                
    paymentIntent: paymentIntent,                
    quantity: quantity,                
    price: price,                
    coupon_name: coupon_name            
}    });

So when that posts to my updateStripeIntent on the server

#
public function updatePaymentIntent(Request $request): \Illuminate\Http\JsonResponse
{    
$amount = $request['params']['quantity'] * $request['params']['price'];    

$intent = \Stripe\PaymentIntent::update(        $request['params']['paymentIntent'],        
['amount' => $amount,            
'metadata' => [                
    'quantity' => $request['params']['quantity'],                  'price'    => $request['params']['price'],                     'coupon_name'    => $request['params']['coupon_name'],            ]        
]    );    
return response()->json(['status' => $intent]);}
crystal cedar
#

why are you mixing up some JS and some PHP, what's happening? Why isn't your webhook handler written in PHP like the rest of your integration?

#

also where are params: { paymentIntent: paymentIntent, quantity: quantity, price: price, coupon_name: coupon_name } even coming from. Are those values correct? Did you properly log those to confirm?

winter lodge
#

The params come from the PaymentElement. It's a laravel app, so we use js in the blade files.

crystal cedar
#

I'm super confused, you mentioned a webhook

#

I'm sorry but what is your real and exact question as the developer of this application. Which exact part of the code is failing?

#

Like do you have a concrete PaymentIntent id pi_123 where your PHP code updates it and sets some information properly?

#

@winter lodge do you have any additional information?