#nybo-pricing-table

1 messages · Page 1 of 1 (latest)

sand oliveBOT
twilit orchid
#

Hi, are you collecting this data on your end and where are you storing this data? Can you provide a bit more context here?

swift charm
#

Well. Im just using the "Pricing Tables" and then the post on my webserver.

app.post('/stripe-payment', bodyParser.raw({type: 'application/json'}), (request, response) => {
            const sig = request.headers['stripe-signature'];  
            
            
            try {
                event = stripe.webhooks.constructEvent(request.body, sig, endpointSecret);
            } catch (err) {
                console.log(`Error: ${err.message}`);
            }
            
            // Handle the event
            switch (event.type) {
                case 'payment_intent.succeeded':
                    paymentIntent = event.data;
                    logger.debug(JSON.stringify(event))
                break;
                default:
                    //logger.error(`${event.type}`)
            }
                response.json({received: true});
        });

So the "basic" event data. nothing else. Storing: Nowhere at the time. Just Console.

twilit orchid
sand oliveBOT
#

nybo-pricing-table

swift charm
# twilit orchid Ah, I do not think that is possible with Pricing Table but looking. You can see ...

So... actually... while i wroted my message i got an idea... and it is possible.

I know there are unhandled events. So i checked everyone of them. While making a Checkout, there are some events with the Phone number inside. Some has ' "phone":null '
but some has actually my phone number in it.

Here is one as example:

{
  "id": "evt_1OUakyHW************Z",
  "object": "event",
  "api_version": "2023-10-16",
  "created": 1704312577,
  "data": {
    "object": {
      "id": "cus_PJDB******h",
      "object": "customer",
      "address": {
        "city": null,
        "country": "DE",
        "line1": null,
        "line2": null,
        "postal_code": null,
        "state": null
      },
      "balance": 0,
      "created": 1704312576,
      "currency": "eur",
      "default_source": null,
      "delinquent": false,
      "description": null,
      "discount": null,
      "email": "ni*****************@gmail.com",
      "invoice_prefix": "5E*****74",
      "invoice_settings": {
        "custom_fields": null,
        "default_payment_method": null,
        "footer": null,
        "rendering_options": null
      },
      "livemode": false,
      "metadata": {},
      "name": "awdwad", //(Lol)
      "phone": "+49**********40",
      "preferred_locales": [
        "de-DE",
        "de"
      ],
      "shipping": null,
      "tax_exempt": "none",
      "test_clock": null
    },
    "previous_attributes": {
      "currency": null
    }
  },
  "livemode": false,
  "pending_webhooks": 1,
  "request": {
    "id": "req_s*********uy",
    "idempotency_key": "4a3**********2097188"
  },
  "type": "customer.updated"
}

i hope i got every important value censored...

#

I only got something like "set metadata while creating checkout" while searching an solution. so i never thought of checking the events...

twilit orchid
#

Looking at this on my end

swift charm
#
app.post('/stripe-payment', bodyParser.raw({type: 'application/json'}), (request, response) => {
            const sig = request.headers['stripe-signature'];  
            
            
            try {
                event = stripe.webhooks.constructEvent(request.body, sig, endpointSecret);
            } catch (err) {
                console.log(`Error: ${err.message}`);
            }
            
            // Handle the event
            switch (event.type) {
                case 'payment_intent.succeeded':
                    paymentIntent = event.data;
                    logger.debug(JSON.stringify(event))
                break;
                case 'checkout.session.completed':
                    phoneNumber = event.data.object.customer_details.phone
                    console.log(phoneNumber)
                break
                default:
                    //logger.error(`${event.type}`)
            }
                response.json({received: true});
        });

I used 'session.completed' and its working. Doesnt matter if i do a sub or one-time. I get the console

twilit orchid
#

You should test this on your end

swift charm
#

Yeah i actually did that but somehow with the first test i didnt got the phone value. But now it is working. And actually without your "details" question i would still search an solution 😄