#candy_cane

1 messages · Page 1 of 1 (latest)

versed lightBOT
long ermine
#

Hello

#

Can you provide me the PaymentIntent ID?

#

In text, instead of screenshot

strange rune
#

Hello, here: "pi_3O1wAtFd9r7pbKmK1vOsTLqk"

long ermine
#

Thanks, taking a look

#

Looks like you are trying to confirm a PaymentIntent that has already been confirmed successfully

strange rune
long ermine
#

Can you tell me what you are trying to do here?

strange rune
# long ermine Can you tell me what you are trying to do here?

Sure, I am trying to create a subscription for an existing customer. Code:

            const attachPaymentToCustomer = await stripe.paymentMethods.attach(
                paymentMethodId,
                { customer: stripeId }
                
              ); 

              stripe.customers.update(
                stripeId, 
                {
                    invoice_settings: { default_payment_method: attachPaymentToCustomer.id },
                },
                );

                console.log(attachPaymentToCustomer);

    const product = "prod_Oofvfy39kzYyuC";

    const subscription = await stripe.subscriptions.create({
      customer: stripeId,
      items: [
        {
          price_data: {
            currency: "EUR",
            product: product!,
            unit_amount: 1000,
            recurring: {
              interval: "month",
            },
          },
        },
      ],

      payment_settings: {
        payment_method_types: ["card"],
        save_default_payment_method: "on_subscription",
      },
      expand: ["latest_invoice.payment_intent"],
      default_payment_method: paymentMethodId,
    });
```, then send the "subscription?.latest_invoice?.payment_intent?.client_secret" back to client side and confirm the client secret like:```     const result = await stripe.confirmCardPayment(client_secret, {
        payment_method: paymentMethod.paymentMethod?.id
      });```
long ermine
#

You already have a PaymentMethod attached in this scenario though, yes?

#

So you don't need to confirm client-side unless 3DS is required

long ermine
strange rune
#

Okay, thanks. I will give it a try.

long ermine
#

Sure

strange rune
#

Okay, thanks! I have a webhook that doesnt seem to execute.

#

After the payment is completed.

long ermine
#

What does "doesn't seem to execute" mean?

#

Do you see an error?

#

Does your endpoint get hit at all?

#

Have you added logs?

strange rune
#

I dont see them getting hit in the logs

long ermine
#

Well that green check mark means they were delivered successfully...

#

Can you give me an Event ID that I can look at?

strange rune
long ermine
#

Okay can you give me a recent Event that fired but wasn't delivered to your endpoint?

strange rune
#

Couple of them:
xxx's subscription has changed
evt_1O1wPWFd9r7pbKmK9d6iiC5c
10/16/23, 9:25:06 PM
xxx's payment for an invoice for €10.00 succeeded
evt_1O1wPWFd9r7pbKmKUTfrpcVM
10/16/23, 9:25:06 PM
xxx's invoice for €10.00 was paid
evt_1O1wPWFd9r7pbKmKhjlXPU9p
10/16/23, 9:25:06 PM
xxx's invoice has changed
evt_1O1wPWFd9r7pbKmKGPKD0zxO
10/16/23, 9:25:06 PM
The payment pi_3O1wPUFd9r7pbKmK1o1RbduU for €10.00 has succeeded
evt_3O1wPUFd9r7pbKmK1geZG61Q
10/16/23, 9:25:05 PM
xxx was charged €10.00
evt_3O1wPUFd9r7pbKmK1E4RX6jv
10/16/23, 9:25:05 PM
xxx attempted to subscribe to price_1O1wPTFd9r7pbKmKqAXNjGxS
evt_1O1wPUFd9r7pbKmKPrAr2zck
10/16/23, 9:25:04 PM
A draft invoice for €10.00 to xxx was finalized
evt_1O1wPUFd9r7pbKmKaZd6nymH
10/16/23, 9:25:04 PM
A draft invoice was created
evt_1O1wPUFd9r7pbKmK0N0sy351
10/16/23, 9:25:04 PMCouple of them:
xxx's subscription has changed
evt_1O1wPWFd9r7pbKmK9d6iiC5c
10/16/23, 9:25:06 PM
xxx's payment for an invoice for €10.00 succeeded
evt_1O1wPWFd9r7pbKmKUTfrpcVM
10/16/23, 9:25:06 PM
xxx's invoice for €10.00 was paid
evt_1O1wPWFd9r7pbKmKhjlXPU9p
10/16/23, 9:25:06 PM
xxx's invoice has changed
evt_1O1wPWFd9r7pbKmKGPKD0zxO
10/16/23, 9:25:06 PM
The payment pi_3O1wPUFd9r7pbKmK1o1RbduU for €10.00 has succeeded
evt_3O1wPUFd9r7pbKmK1geZG61Q
10/16/23, 9:25:05 PM
xxx was charged €10.00
evt_3O1wPUFd9r7pbKmK1E4RX6jv
10/16/23, 9:25:05 PM
xxx attempted to subscribe to price_1O1wPTFd9r7pbKmKqAXNjGxS
evt_1O1wPUFd9r7pbKmKPrAr2zck
10/16/23, 9:25:04 PM
A draft invoice for €10.00 to xxx was finalized
evt_1O1wPUFd9r7pbKmKaZd6nymH
10/16/23, 9:25:04 PM
A draft invoice was created
evt_1O1wPUFd9r7pbKmK0N0sy351
10/16/23, 9:25:04 PM

long ermine
#

Would recommend redacting your email here

#

As this is a public server

#

It is only listening for 4 event types

#

So you need to edit it to listen for these other types if you want to receive them

strange rune
#

Oh, yes. Thanks. I forgot. I will add "
invoice.payment_succeeded".