Stripe Orders Beta - how to extend client and server side stripe?

I am wokring with ‘Stripe Orders’, which is in beta.

I need to do the following:
"please select a beta version by setting the Stripe-Version HTTP header to something like 2020-08-27;orders_beta=v4"

In their example code it looks like this, in client side js:

// This is your test publishable API key.
const stripe = Stripe("pk_test_51It********", {
  betas: ["process_order_beta_1"],
  apiVersion: "2020-08-27; orders_beta=v4"
});

And server.js:

const stripe = require('stripe')('sk_test_51*****', {
  apiVersion: '2020-08-27; orders_beta=v4'
});

I don’t think I can set this using the UI.
How can I extend both the client and server side striep components to include these 2 values?

Really wishing for easier ways to extend wappler components (both server and client side).

I’ve got it working by creating a custom component and changing the lib/modules/stripe.js, which the assets updater tries to undo every time I launch wappler :frowning:

For your entertainment:

  1. Created /public/js/wappler-extensions/dmx-kars-stripe.js
  2. On page I included it in the layout, and then created this componentit with:
<dmx-stripekars id="stripeKars" key="<%- $_SERVER.SERVER_NAME.includes('localhost') ? 'pk_test_51I******GnpzKg8tbHjmzsTPgKrA0meRzSA2c5PvVz25iPnjXM9YRAeeVzqsXO2X00dFk1yp28' : 'pk_live_51It6V*******' %>" dmx-bind:line-items="" checkout="server" account="<%= stripeConnAccID %>" dmx-bind:betas="['process_order_beta_1']" dmx-bind:apiVersion="'2020-08-27; orders_beta=v4'"></dmx-stripeKars>
  1. In lib/modules/stripe.js (WAPPLER TRIES TO OVERWRITE WITH ASSETS UPDATER) I added one line:

Thanks to @jonl for showing his custom component so I can learn from it.

1 Like

If you follow the instructions here, you can install extensions and formatters without them being overwritten (in the extensions/server_connect/modules folder)

Yeah I’d like to go that route but it’s a bunch of extra work to make a .hjson file from this.
There’s no easy way to copy paste (that I’m aware of) an existing server action.
So I first need to spend hours reverse engineering a .hjson file.

Unless there’s a better way?

1 Like