Paypal IPN Process More Than One Custom Field
- Article
- Comment
Paypal IPN Process More Than One Custom Field. While processing with PayPal IPN, we may have to use custom variables and fields to pass on to the cart and receive it together on the IPN to validate it. But in PayPal , they allow use to pass our custom things on the custom field. so if we need to pass more than one variable, how we do that. Lets try a trick to pass more attributes on the same one.
Just provide all your custom parameters in one custom field as like the following one.
<input type="hidden" name="custom" value="var1=summa&var2=143&jo=thi&etc.."/>
Likewise put all your variables in one field with & just like the GET Method.
Than the IPN will be returned to your specified URL, Now, you need to parse the string before start working with it. Just use the following function to parse it.
function kv_parse_ipn_custom_variable($POST['custom']) { parse_str($_POST['custom'],$_KVCODES); return $_KVCODES; } kv_parse_ipn_custom_variable($_POST['custom'] );
The above function will parse it and return you, now you can use it like the following one .
echo $_KVCODES['var1']; echo $_KVCODES['var2'];
So, this way you can work on multiple fields with it.