#satvik-techie_code

1 messages ¡ Page 1 of 1 (latest)

bronze glacierBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1293183985069068359

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

vocal eagle
#

hi

wary merlin
#

hi there!

vocal eagle
#

req_M3NGB3M0E1a29I

#

i want to update price

#

StripeConfiguration.ApiKey = stripePaymentRequestViewModel.ApiKey;
var requestOptions = new RequestOptions
{
StripeAccount = stripePaymentRequestViewModel.AccountKey
};
var options = new PriceUpdateOptions
{
CurrencyOptions = new AutoConstructedDictionary<string, PriceCurrencyOptionsOptions>() {
{ "unit_amount_decimal", new PriceCurrencyOptionsOptions()
{ UnitAmountDecimal = Convert.ToDecimal(stripePaymentRequestViewModel.MTAAmount * 100)} }}

};
var service = new PriceService();
await service.UpdateAsync(stripePaymentRequestViewModel.PriceId, options, requestOptions);

#

but getting error

#

am is missing something ?

wary merlin
#

having a look

#

it should be something like currency_options.usd.unit_amount_decimal: xxx, notice the usd in the middle.

vocal eagle
#

ok let me check

#

but i am not getting the currency option

#

public class PriceCurrencyOptions : StripeEntity<PriceCurrencyOptions>
{
/// <summary>
/// When set, provides configuration for the amount to be adjusted by the customer during
/// Checkout Sessions and Payment Links.
/// </summary>
[JsonProperty("custom_unit_amount")]
public PriceCurrencyOptionsCustomUnitAmount CustomUnitAmount { get; set; }

/// <summary>
/// Only required if a <a
/// href="https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)">default
/// tax behavior</a> was not provided in the Stripe Tax settings. Specifies whether the
/// price is considered inclusive of taxes or exclusive of taxes. One of <c>inclusive</c>,
/// <c>exclusive</c>, or <c>unspecified</c>. Once specified as either <c>inclusive</c> or
/// <c>exclusive</c>, it cannot be changed.
/// One of: <c>exclusive</c>, <c>inclusive</c>, or <c>unspecified</c>.
/// </summary>
[JsonProperty("tax_behavior")]
public string TaxBehavior { get; set; }

/// <summary>
/// Each element represents a pricing tier. This parameter requires <c>billing_scheme</c> to
/// be set to <c>tiered</c>. See also the documentation for <c>billing_scheme</c>.
/// </summary>
[JsonProperty("tiers")]
public List<PriceCurrencyOptionsTier> Tiers { get; set; }

/// <summary>
/// The unit amount in cents (or local equivalent) to be charged, represented as a whole
/// integer if possible. Only set if <c>billing_scheme=per_unit</c>.
/// </summary>
[JsonProperty("unit_amount")]
public long? UnitAmount { get; set; }

/// <summary>
/// The unit amount in cents (or local equivalent) to be charged, represented as a decimal
/// string with at most 12 decimal places. Only set if <c>billing_scheme=per_unit</c>.
/// </summary>
[JsonProperty("unit_amount_decimal")]
public decimal? UnitAmountDecimal { get; set; }

}

#

this is the class

wary merlin
#

what SDK are you using? .NET?

vocal eagle
#

yes

tawny flame
#

Hey! Taking over for my colleague. Let me catch up.

#

Have you tried to use AddExtraParam?

vocal eagle
#

what to add in param ?

#

CurrencyOptions = new AutoConstructedDictionary<string, PriceCurrencyOptionsOptions>() {
{ "gdp.unit_amount_decimal", new PriceCurrencyOptionsOptions()
{
UnitAmountDecimal = Convert.ToDecimal(stripePaymentRequestViewModel.MTAAmount * 100),

} }}

#

will this work ?

#

where gdp is currency

tawny flame
#

You need to make something like this:
options.AddExtraParam("currency_options[usd][unit_amount_decimal]", 10000);

#

Where options is the Price update options PriceUpdateOptions

vocal eagle
#

ok let me check

#

ok worked, but one small query

#

will it update in the subscription ?

#

if i have created with that price ?

bronze glacierBOT
spare sentinel
#

Hey there, my understanding of currency option is that it affects only the presentment currency and payment

#

the price remains the price object you used.

vocal eagle
#

hi

#

i want to update subscription with price

#

so during subscription the price i have created with unit_amount_decimal let say --> 15
now i want to update subscription with the price unit_amount_decimal say --> 20

#

now if i update price with the price id which i had set in subscription , will it update subsription ?

spare sentinel
#

This sounds very different that using currency_options -- you're describing now that you want to change the price object used on a subscription item?

vocal eagle
#

yes

#

correct

spare sentinel
vocal eagle
#

okay