Payment success validation

Hi guys

I’ve set up a simple sandbox payment APK based on your js frontend template which works fine. For testing purposes, so far I get a success response I just redirect to the payment successful page:

        async function handlePaymentMethodSubmission(event, paymentMethod) {

          try {
            cardButton.disabled = true;
            const token = await tokenize(paymentMethod);
            const paymentResults = await createPayment(token);
            console.log('Payment Success', paymentResults);
            window.location.href = "{% url 'basket:paymentsuccess' %}"; # success reroute
          } catch (e) {
            cardButton.disabled = false;

I get this back with success true:

id: "LzZzX1omrC8lXQsJnklA1oQzKeVZY"
order_id: "V2W67zwWD8aKGgXZv4qInhKePLQZY"
receipt_url: "

Obviously, I can’t have the client simply entering the success page url and creating an order so there has to be serverside validation of the completed payment. Is there a token I can validate serverside to reroute to accept / kick the user? I assume I can query the id or order_id?

If you could point me to the right section in the docs with the request I need please? I couldn’t see it, apologies if it was staring me in the face.

Yeah, the ID: LzZzX1omrC8lXQsJnklA1oQzKeVZY is the payment_id you can use that to call GetPayment to validate the payment. Or you can call RetrieveOrder with the order_id if you’d like to get the order details. :slightly_smiling_face:

Perfect, thank you very much.