Home > Software engineering >  STRIPE API - Create payment link to custom account got wrong
STRIPE API - Create payment link to custom account got wrong

Time:11-25

How do i create payment link to custom account via stripe.net library? I have tried with these codes but its created product and payment link to my stripe connected account instead of custom account as i want.

// create payment link
            var plinkOpt = new PaymentLinkCreateOptions
            {
                LineItems = new List<PaymentLinkLineItemOptions>
                {
                    new PaymentLinkLineItemOptions
                    {
                        Price = new PriceService().Create(
                            new PriceCreateOptions
                            {
                                Currency = "usd",
                                Product = new ProductService().Create(new ProductCreateOptions { Name = "myproductname", }).Id,
                                CustomUnitAmount = new PriceCustomUnitAmountOptions { Enabled = true },
                            }).Id,
                        Quantity = 1,
                    },
                },
            };

            var plinkSer = new PaymentLinkService();
            plinkSer.Create(plinkOpt);

I hope to have codes to solve my problem or a solution to do it. Thank you

CodePudding user response:

You need to set the StripeAccount in RequestOptions (API ref):

var options = new RequestOptions
{
  StripeAccount = "acct_123"
};
plinkSer.Create(plinkOpt, options);
  • Related