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) {
event.preventDefault();
try {
cardButton.disabled = true;
const token = await tokenize(paymentMethod);
const paymentResults = await createPayment(token);
displayPaymentResults('SUCCESS');
console.log('Payment Success', paymentResults);
window.location.href = "{% url 'basket:paymentsuccess' %}"; # success reroute
} catch (e) {
cardButton.disabled = false;
displayPaymentResults('FAILURE');
console.error(e.message);
}
}
I get this back with success true:
id: "LzZzX1omrC8lXQsJnklA1oQzKeVZY"
order_id: "V2W67zwWD8aKGgXZv4qInhKePLQZY"
receipt_url: "https://squareupsandbox.com/receipt/preview/LzZzX1omrC8lXQsJnk
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.