Paypal ipn catch payment cancel event -
i trying following: when user selects items , click "pay now" button on our website, mark selected items status "on hold" no 1 else can select these items. if receive "complete" ipn mark items "purchased" , other database change. if receive "canceled" ipn mark "on hold" items "available".
it works fine when user did make payment (complete). however, if user exit payment flow (for example close browser tab) didn't receive messages. not sure why happening. or ipn wouldn't give message if transaction not complete?
here code of paypal button:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="upload" value="1"> <input type="hidden" name="business" value="********-facilitator@gmail.com"> <input type="hidden" name="env" value="www.sandbox"> <input type="hidden" name="address_override" value="1"> <c:set var="index" value="${1}"/> <c:foreach items="${items}" var="item"> <input type="hidden" name="item_name_${index}" value="${item.title}"> <input type="hidden" name="amount_${index}" value="${item.askprice}"> <input type="hidden" name="tax_${index}" value="$<fmt:formatnumber type="number" maxfractiondigits="2" value="${item.askprice * taxrate}" />"> <c:if test="${index == 1}"> <input type="hidden" name="shipping_${index}" value="$<fmt:formatnumber type="number" maxfractiondigits="2" value="${shipmentfee}" />"> </c:if> <c:set var="index" value="${index + 1}"/> </c:foreach> <c:remove var="index"/> <!-- fill full name in first_name field --> <input type="hidden" name="first_name" value="${info.recipient}"> <input type="hidden" name="notify_url" value="<c:url value="https://********.localtunnel.me/payment/paypal/ipn"></c:url>"> <input type="hidden" name="address1" value="${info.addressline1}"> <input type="hidden" name="address2" value="${info.addressline2}"> <input type="hidden" name="city" value="${info.city}"> <input type="hidden" name="state" value="${info.state}"> <input type="hidden" name="zip" value="${info.zip}"> <input type="hidden" name="country" value="us"> <input type="hidden" name="email" value="${info.email}"> <input type="hidden" name="custom" value="${flowid}"> <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/webstatic/en_us/i/buttons/checkout-logo-large.png" alt="check out paypal"> </form>
Comments
Post a Comment