For anyone looking for a method to know that a user has completed payment from the iframe checkout without supplying the redirect_uri var, here is your method.

The WePay Iframe sends a PostMessage back to the parent window during the transaction. The message sent when the payment is completed is:

{ “wepay_message_type”:”iframe_checkout_complete”, “checkout_id”:”CHECKOUT_ID” }

Now there are many ways to handle this and the way I prefer is via Jquery. How I did this is using the plugin from Ben Alman. He has built a PostMessage plugin for jquery.

On the parent page make sure you have the plugin from Ben Alman and the lastest version of jquery.

Here is the script I came up with:

<script>
$.receiveMessage(function(e) {
if (e.data.indexOf("iframe_checkout_complete") > 1)  {
alert("Payment Processed");
}
});
</script>

There are many other ways to do this but I like this method. Simple and short. Easy to work with. When the customer processed the payment and gets to the order total page it will post a message saying “Payment Processed.”

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

required


SimplyCaptcha