#amfpaulo_api
1 messages ¡ Page 1 of 1 (latest)
đ 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/1409891229524688958
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello @quasi onyx
Hey there. what is not working like you expect here?
I am ground zero, I have no idea if this is possible
Documentation is confuse
I tried this and got this error:
var paymentLinkService = new PaymentLinkService();
var paymentLink = await paymentLinkService.CreateAsync(new PaymentLinkCreateOptions
{
LineItems = new List<PaymentLinkLineItemOptions>
{
new PaymentLinkLineItemOptions
{
Price = request.PriceId,
Quantity = 1
}
},
SubscriptionData = new PaymentLinkSubscriptionDataOptions
{
Metadata = new Dictionary<string, string>
{
{ "student_id", request.StudentId.ToString() },
}
},
CustomerCreation = "if_required",
Metadata = new Dictionary<string, string>
{
{ "student_email", email },
{ "student_id", request.StudentId.ToString() }
}
});
ERRRO: "customer_creation can only be used if the payment link does not contain any recurring prices."
What are you your trying to do / figure out if it is possible?
I thougt it was the oposite looking the docs
I need to send to a current client a payment link to a subscription
Its a client the had membership expired he ask for a link to start a new membership, but I do not want another client being created
and stripe creates new clients using same email
You can't using a payment link for that then, what you want is a Checkout Session with an existing customer id specified:
https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Payment Links have no way to link to existing customers, they always create new customers when a customer is required
I see, thank you. So the checkou session using the api will generate a link right , that I can send to the client and they can just pay , correct ?
Yes, but note that the session url is only valid for 24h, not indefinitely like a payment link
so you either need tob e clear about this in whatever contact your send, or alternatively create it on demand when they visit a page you control and you can redirect them to the hosted session
Ok, got it, perfect, thank you