#Emil Sundberg-checkout

1 messages · Page 1 of 1 (latest)

karmic wadi
#

👋 happy to help

golden steppe
#

Great! :)

We have a subscriptions that we called PortfiloPremium and hade been priced to 4500 sek (Swedish currency). Now we wan't sell PortfolioPremium for 595 sek instead. As I said, I been trying to archive both the product, price and made the new price as default price. 

When I archived the product and created a new, with same name, then I get the new price in developer mode, but I didn’t worked. Stripe says there was an empty field in ”customer”.
req_HPYxBJApNzYakv

When I added the new prices as default price in sam product, it used the old price however.
req_r2ihYOFdvAivo3
req_oIHbOtgt4fZ324

I also got a error message in stripe that says reauthentication_requierd
req_tvn3yLjIqzbZFE

karmic wadi
#

req_HPYxBJApNzYakv this is a request for attaching a payment method to a customer, where yes you are not passing any customer to it, so it's normal to fail

#

in this request req_r2ihYOFdvAivo3 you tried to use the price which is inactive

#

could you please share your code?

golden steppe
#

yes, how do you want the code?

karmic wadi
#

for this request req_tvn3yLjIqzbZFE, some actions in the dashboard require you to reauthenticate (enter your password another time)

golden steppe
#

in this view you can see the jprice I want to use, but it go for the old one for 4500

karmic wadi
#

you need to copy the new price id and use it instead of the old

golden steppe
#

but we only use the prod_key, not the price_key

karmic wadi
#

could you please share the code snippet you're using?

karmic wadi
#

this is the line that matters for us
var subscription = _paymentService.CreateSubscription(req.PaymentMethod, req.Customer, req.Price, req.PromotionCodeId);

#

so you're sending from your front-end the price id

#

please check that

golden steppe
#

We don't use any stripe key i FE for subscriptions. Here's the code i FE to get the information about the product.

// Create subscription
function createSubscription({ customerId, paymentMethodId, priceId }) {
return fetch(${apiBaseUrl}/api/payments/subscriptions, {
method: "POST",
headers: {
"Content-type": "application/json",
Authorization: Bearer ${token},
},
body: JSON.stringify({
customerId: customerId,
paymentMethodId: paymentMethodId,
priceId: priceId,
}),
})
.then((response) => {
return response.json();
})
.then((result) => {
if (result.status === 500 || result.error) {
// If the card is declined, display an error to the user.
setErrorOpen(true);
throw result;
} else if (result.Status === "succeeded") {
setSucceeded(true);
startCountdown();
return result;
} else if (result.Status === "requires_action") {
return stripe
.confirmCardPayment(result.Id, { payment_method: paymentMethodId })
.then((resultConfirm) => {
if (resultConfirm.error) {
// If 3D Secure is declined, display an error to the user.
setErrorOpen(true);
throw resultConfirm;
} else {
if (resultConfirm.paymentIntent.status === "succeeded") {
setSucceeded(true);
startCountdown();
return resultConfirm;
}
}
})
.catch((error) => {
throw error;
});
}
})
.catch((error) => {
setErrorOpen(true);
setProcessing(false);
throw error;
});
}

karmic wadi
#

what is the priceId you're passing in the Front-end?

#

that's what you need to change

#

you need to find what's calling this function createSubscription and see the priceId that is passed to it

golden steppe
#

sry for taking so long, talked do one of the guys who was setting up stripe. we do a fetch in FE for prices and it comes from our Paymentservice.

    {
      var pricesOptions = new PriceListOptions
      {
        Active = true
      };
      pricesOptions.AddExpand("data.product");
      var pricesService = new PriceService();
      var prices = pricesService.List(pricesOptions);
      
      var res = prices.Data
        .Where(p =>
          p != null &&
          p.Active &&
          p.Deleted != true &&
          p?.Recurring?.Interval != null &&
          p.Product.Active &&
          p.Product.Metadata.ContainsKey("productkey")
        )
        .Select(p => new StripePriceDTO()
        {
          Id = p.Id,
          Amount = (decimal)p.UnitAmount / 100,
          Currency = p.Currency,
          RecurringInterval = p.Recurring.Interval,
          Product = p.Product.Name,
          ProductKey = p.Product.Metadata.GetValueOrDefault("productkey")
        })
        .ToList();

      return res;
    }```
#

is stripe doing a caching?