#jimmiller-product-type

1 messages · Page 1 of 1 (latest)

ripe reef
#

You can't do that. type: 'good' has been deprecated for multiple years so you shouldn't use it. But you can't update it, you have to set it on creation (and create a new one)

normal flame
#

Ok. I am doing a Stripe tutorial on Webhooks that CJ did. How can I change this code to work on an average product?

          var stripe = Stripe('pk_test_51KJkdjLpLZKroIWviC1dW61ChRxXLw1JDqjmyVUu1siVW4VttsHscT7xvuPYMxQgxiFmnDC1AROBoMBpiCdGeMqo00nu3WrB2a');
          var checkoutButton = document.getElementById('checkout-button');
          checkoutButton.addEventListener('click', function(event) {
                      event.preventDefault();
                      stripe.redirectToCheckout({
                                  customerEmail: "jenny.rosen@example.com",
                                  items: [{sku: 'sku_Fy62JwNX8W9Fsk', quantity: 5}],
                                  successUrl: 'http://localhost:3000?success',
                                  cancelUrl: 'http://localhost:3000?cancel',
                                });
                    });
        </script>```
ripe reef
#

1/ you don't need to change this code at all, it works fine with normal product, no need to change anything
2/ That solution has been deprecated a long time ago now. You should use Payment Links really https://stripe.com/docs/payments/payment-links

normal flame
#

I get this error when I try it:
No such sku: 'sku_Fy62JwNX8W9Fsk'

#

I'll look at your 2

ripe reef
#

yeah there's absolutely no reason to use SKU in this case

#

but mostly avoid that entire integration

#

do you have a link to the tutorial you are looking at?

abstract wave
#

@normal flame Do you have any other questions here on the recommended integration?