#linqisnice_docs

1 messages ¡ Page 1 of 1 (latest)

inner pulsarBOT
#

👋 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/1220449220327112808

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

young ingotBOT
#

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.

fervent burrow
#
    public async Task<IReadOnlyList<Product>> CreateProducts(Dictionary<string, decimal> products, CurrencyCode currency)
    {
        var createdProducts = new List<Product>();
        var service = new ProductService();
        foreach (var product in products)
        {
            createdProducts.Add(await service.CreateAsync(new ProductCreateOptions
            {
                Name = product.Key,
                DefaultPriceData = new ProductDefaultPriceDataOptions
                {
                    Currency = currency.ToString(),
                    UnitAmountDecimal = product.Value
                }
            }));
        }

        return createdProducts;
    }

    public async Task<string> CreatePaymentLink(Dictionary<string, decimal> products, CurrencyCode currency, string connectedAccountId)
    {
        var createdProducts = await CreateProducts(products, currency);


        var options = new PaymentLinkCreateOptions
        {
            LineItems = createdProducts.Select(x => new PaymentLinkLineItemOptions
            {
                Price = x.DefaultPriceId
            }).ToList()
        };


        var requestOptions = new RequestOptions
        {
            StripeAccount = connectedAccountId
        };

        var service = new PaymentLinkService();
        var paymentLink = await service.CreateAsync(options, requestOptions);

        return paymentLink.Url;
    }

this is the code.

#

it rejects the id saying ```cs
"message": "No such price: 'price_1Owqx2GPWwmX339cuGvjyelz'",

dusky magnet
#

Can you share the erroring request ID? req_123 for example

fervent burrow
#

not sure i follow, the id of what resource?

#

the id of the product?

dusky magnet
#

The request where you get that error

#

My guess is that you might be mixing up IDs across different accounts

fervent burrow
#

the request id isnt available in the response here in the .net sdk

dusky magnet
#

That price exists, but I don't see a failing request matching the exampel you shared in that account's logs

fervent burrow
#

is it because the product is not being created for that connect probably?

#

do i need to specify for whom the product is created?

#

all im doing is creating a product and immediately using that products priceid to create a link

#

for a specified connect customer

dusky magnet
#

In the result of your method call, can you inspect StripeResponse? It should have the request id

fervent burrow
#

lemme see

#

req_u5Kpa3B7SHdpyv

dusky magnet
#

Ok, yep, this is a conenct context mix up

fervent burrow
#

so how do i create products for the dconnect account? so i can allow the connect account to issue a payment link

#

thats what im trying to achieve

#

we have connected merchants -> we want them to be able to send a payment link with minimal effort

dusky magnet
#

You need to have that product/price also created on the that connected account (using the stripe-account header/option), or create the payment link on your platform

dusky magnet
fervent burrow
#

yes, but how? with the .net sdk i cant see that there is a stripeaccount field for ProductDefaultPriceDataOptions

dusky magnet
#

Its at the request level overall

fervent burrow
#

meaning?

dusky magnet
#
var options = new RequestOptions
{
  StripeAccount = "acct_123"
};
#

The same way you're doing it for the payment link

#

you would do when creating the price/product

fervent burrow
#

ahh right that definitely makes sense

#

thanks a lot!

dusky magnet
#

NP

fervent burrow
#

now im getting a different issue, Stripe.StripeException: 'Missing required param: line_items[0][

dusky magnet
#

Can you share the request ID again?

fervent burrow
#

yes sure wait

#

req_Zypidir6QbIv9m

dusky magnet
fervent burrow
#

ahhh!