Ok, I decided to use securionpay as a payment method.
What I'm struggling is I don't know how I can verify on my server that the payment was successful
<script src = "https://securionpay.com/checkout.js"> </script>
<script src="https:/ / ajax.googleapis.com / ajax / libs / jquery / 3.1.0 / jquery.min.js "></script>
<script type="
text / javascript ">
$(function () {
SecurionpayCheckout.key = 'pk_test_ZVhCjD2Gz7OF222L00bxIdlD';
SecurionpayCheckout.success = function (result) {
// handle successful payment (e.g. send payment data to your server)
};
SecurionpayCheckout.error = function (errorMessage) {
// handle integration errors (e.g. send error notification to your server)
};
$('#payment-button').click(function () {
SecurionpayCheckout.open({
checkoutRequest: 'NTQ1NDAwYTczZTljMjUwYzNhZjA0NTdkOTFjNThiOTY5YzIxY2ViMjBhMDRmOTYwNjg1MDI3OWQ2OTZlN2VjMnx7ImNoYXJnZSI6eyJhbW91bnQiOjQ5OSwiY3VycmVuY3kiOiJFVVIifX0=',
name: 'SecurionPay',
description: 'Checkout example'
});
});
});
</script>
<button id="payment-button">Payment button</button>
it goes like this
- user picks a product
- user clicks order(the request is going to my server where I create signed 'checkout request'
- I render javascript file with checkoutRequest filled
- User clicks 'Payment button'
- user fills card information and clicks Pay
- SecurtionpayCheckout.success run
whatever 'result' will return to me it doesn't help to verify it on the server. I only generate checkout request on the server side.
My thought is that my server should generate some variable that I would store in order model and 'result' should return me that variable if success then i could verify it otherwise based on what I can verify it ? I propably missing something...
docs: https://securionpay.com/docs/tutorials/checkout
P.S I don't want to store card information on my server
Thanks
You should use metadata. Put whether data you need in checkoutRequest.charge.metadata attribute. It will be attached to charge and returned in result parameter in success method.