#Timo - Payment Links

1 messages ยท Page 1 of 1 (latest)

timber drum
novel depot
#

Alright, thank you very much.

#

I do have a question though, I don't fully understand how I can set the price etc.

timber drum
#

You would create a Product and Price in the Dashboard or via the API, then create a Payment Link for the Price you want to charge.

novel depot
#

So something like this should work?

        List<Object> lineItems = new ArrayList<>();
        Map<String, Object> product = new HashMap<>();
        product.put("price", "price_1Khgp6JxcER6HYwj81XXMDgN");
        product.put("quantity", 1);
        lineItems.add(product);
        
        Map<String, Object> params = new HashMap<>();
        params.put("line_items", lineItems);

        try {
            PaymentLink paymentLink = PaymentLink.create(params);
            Client.send(paymentLink.getUrl());
        } catch (StripeException e) {
            e.printStackTrace();
        }```
timber drum
#

My Java's pretty rusty, but I think that's the general idea, yep!

novel depot
#

and that will generate something like https://buy.stripe.com/uniqueidfortheclient?

#

And then I can retrieve that link and check if the client has paid, if so give him the product?

timber drum
#

It's a unique ID for the Payment Link, which is not unique to the specific client.

#

Payment Links are designed to be reused over and over again by many different customers.

novel depot
#

No but I mean, if I generate one for every client I can retrieve if he has paid?

timber drum
#

Can you describe what you're trying to build at a high level so I can make sure Payment Links are the best option for you?

#

By client do you mean your customer?

novel depot
#

Yea

#

I am trying to make a payment system in a minecraft plugin itself. So if a player/customer tries to buys something, he or she will receive a payment link where he or she can pay. And then every 5 minutes, its getting all the created links, check if it is paid, if so, give the player their ranks, if not, cancel/delete the link.

timber drum
novel depot
#

Does that generate links as well?

timber drum
#

Payment Links are intended to be create-once-use-many-times, which is not what you're describing. Checkout Sessions, on the other hand, are specific to a single customer and transaction, they expire on their own, and they generate a unique URL for each one.

novel depot
#

Alright, thanks for your help. I appreciate it.

timber drum
timber drum
#

I recommend reading through the guides I linked you to, which will explain how it all works, then come back here and ask us questions if you have any. ๐Ÿ™‚

novel depot
#

๐Ÿ‘