#thedarthjosh

1 messages · Page 1 of 1 (latest)

fresh briarBOT
bright mesa
#

You can set it per request ^

#

Or change your account's default

proud cairn
#

Yea I know that, but there's nowhere in the test dashboard to change it globally, and the package thats integrated (before I joined the company) doesnt reference it anywhere

bright mesa
#

You only want to change it for test mode?

proud cairn
#

I want to test it in test mode before moving it to production

#

I looked in the package we're using, and all I see is that its loading the checkout.js

bright mesa
#

Then the recommended way to do that is to set it in the sdk specifically

proud cairn
#

I was afraid of that 😦

bright mesa
proud cairn
#

I saw, was just hoping for a turnkey instead of a re-write.

#

If we're loading just the js file remotely, does that automatically go to the next versions?

#

loading the source code it has a references to /v3 on some calls

bright mesa
#

I think the calls made through stripe.js will be the latest, but API version is mostly relevant for your server-side calls

#

That's what api version changes behavior for largely

proud cairn
#

Ok. We're just using the checkout part, and no headers set, but we have most calls with 2018-02-28, a few with 2020-08-27, and 0 with 2022-11-15

bright mesa
#

Oh

#

Just to clarify, are you creating your checkout session server side?

proud cairn
#

Yes, we have a few packages, they put in their name/cc info, and it processes with a succes/fail

#

we use hosted pages for a few products but they wont be affected

bright mesa
#

Well if you're creating sessions server-side, you'll need to update api version in your server side sdk

proud cairn
#

I would think that anything in the prod environment could be tested in the test environment

#

We just use the react library

#

and just checkout, not an IPN or anything

bright mesa
#

Can you share a code snippet of you creating a checkout session?

proud cairn
#

import React from 'react';
import StripeCheckout from 'react-stripe-checkout';
import * as zenApi from '../../generics/zenApi';

const CURRENCY = 'USD';
const PAYMENT_SERVER_URL = process.env.API_URL + '/billings';

const successPayment = data => {
alert('Payment Successful:- ' + data);
};

const errorPayment = data => {
alert('Payment Error:- ' + data);
};

const onToken = (amount, description) => token =>
zenApi.post(PAYMENT_SERVER_URL,
    {
    description,
    source  : token.id,
    currency: CURRENCY,
    amount  : amount
    })
    .then(successPayment)
    .catch(errorPayment);

const Checkout = ({ name, description, amount, pub_key }) =>
<StripeCheckout
    name={name}
    description={description}
    amount={amount}
    stripeKey={pub_key}
    token={onToken(amount, description)}
    currency={CURRENCY}
/>;

export default Checkout;
#

Thats the only place that loads react-stripe-checkout

bright mesa
#

Oh

proud cairn
#
bright mesa
#

That's a third party library

proud cairn
#

Yea

bright mesa
#

Yeah that's not maintained by Stripe, so we can't support it in here unfortunately. I'm not sure how to set API version within their library

proud cairn
#

So thats why I was asking if we could upgrade the API in the test dashboard and see if it works

bright mesa
#

No only in live mode

#

Testing api version upgrades are supposed to be done on a per request basis with the sdk

#

But that's not our sdk

#

So you will either have to reach out to its developer or look into their open source code to figure out how

proud cairn
#

Yea I wasnt expecting support on that, it was more on the stripe side as far as the test dashboard

bright mesa
#

Right

#

Which isn't possible in test mode

#

That message is accurate

proud cairn
#

Right. But shouldnt it be? I would think test would be a mirror of prod, so people can test before deploys

bright mesa
#

You can reach out to support with that feature request if you like: https://support.stripe.com. Currently that's just not how it works. API version is account-wide (both test and live)

proud cairn
#

Ok, will do. Thanks!