sam's bits

ramblings on technology and other stuff
3

Integrating PostFinance Payments into your website

You would think integrating Credit Card or PostFinance payment methods into your site would be hard, but it’s not. If you can setup an auto-submitting form, then your pretty much done.

Before you can do anything though, you must subscribe to one of PostFinance’s monthly plans. There is a free plan, but it has a 195 Fr. activation fee and it only supports PostFinance cards (no MasterCard/Visa).

So once you’ve setup your account you get access to the testing and production environment. Your access information comes via snail mail. Make sure you have planned enough time for this in your project, it can easily take a couple of days.

 Gateway Form

The form below must be placed in the last step of your purchasing process and you need to prefill the values with your application. It will then be submitted to PostFinance where the user can pay for his purchase. The action in this particular form posts the data to a test environment.

<form METHOD="post" action="https://e-payment.postfinance.ch/ncol/test/orderstandard.asp" id="form1" name="paymentform">
<input type="hidden" name="PSPID" value="your PSPID came with the post">
<input type="hidden" name="ORDERID" value="your order id (up to 8 digits)">
<input type="hidden" name="AMOUNT" value="amount of money">
<input type="hidden" name="CURRENCY" value="CHF">
<input type="hidden" name="LANGUAGE" value="de_DE">

<!-- layout information -->
<input type="hidden" name="TITLE" value="title to be displayed on the postfinance site">
<input type="hidden" name="BGCOLOR" value="#ffffff">
<input type="hidden" name="TXTCOLOR" value="#000000">
<input type="hidden" name="FONTTYPE" value="Arial">

<!-- post-payment redirection -->
<input type="hidden" name="ACCEPTURL" value="on succesful payment, where to redirect the buyer?">
<input type="hidden" name="DECLINEURL" value="on failed payment, where to redirect the buyer?">
<input type="hidden" name="EXCEPTIONURL" value="on exception/error, where to redirect the buyer?">
<input type="hidden" name="CANCELURL" value="if the buyer cancels, where to redirect the buyer?">
<input type="hidden" name="BACKURL" value="if the buyer hits the back button in the form, where to redirect the buyer?">
<!-- miscellanous -->
<input type="hidden" name="HOMEURL" value="">
<input type="hidden" name="CATALOGURL" value="">
<input type="hidden" name="CN" value="the buyers full name">
<input type="hidden" name="EMAIL" value="the buyers email">
<input type="hidden" name="PM" value="">
<input type="hidden" name="BRAND" value="">
<input type="hidden" name="OWNERZIP" value="">
<input type="hidden" name="OWNERADDRESS" value="">
<input type="hidden" name="OWNERADDRESS2" value="">
<!--<input type="hidden" name="SHASIGN" value="">-->
<input type="hidden" name="ALIAS" value="">
<input type="hidden" name="ALIASUSAGE" value="">
<input type="hidden" name="ALIASOPERATION" value="">
<input type="hidden" name="COM" value="">
<input type="hidden" name="COMPLUS" value="">
<input type="hidden" name="PARAMPLUS" value="">
<input type="hidden" name="USERID" value="">
<input type="hidden" name="CREDITCODE" value="">

<input type="submit" value="Click here if you are not redirected in 5 seconds..." id="submit2" name="submit2">

</form>


<script type="text/javascript">
      window.onload=function(){ 
            window.setTimeout(function() { document.paymentform.submit(); }, 2000);
      };
</script>

If you’ve setup the form correctly it will redirect you to the test environment. If you want to go live replace test with prod in the form action.

For more information and an explanation of the other form fields: Detailed PostFinance Documentation

Categories: Web Development, E-commerce

Tags: postfinance epayment, payment gateways

Comments: 3 Comments

3

Comments

  • Comment by Tejas on 31 July 2013 2:06 am

    Hi

    I have used the above form and got the following error:

    " Ein Fehler ist aufgetreten; bitte versuchen Sie es später erneut. Sollten Sie der Besitzer oder der Integrator dieser Website sein, melden Sie sich bitte in Ihrem PostFinance Back-Office an, dort erhalten Sie die Fehlerdetails. "

    Do you have any idea regarding this error?

    Thanks in advance.

  • Comment by sam on 6 August 2013 5:13 am

    Are you using Test or Production? Try logging in and checking the error message. Production requires the generation and exchange of a SHA1 signature.

  • Comment by Vishal on 24 December 2013 2:39 am

    Hi

    I have totally configure postFinance payment gateway

    In Amount i have to pass 728.80 so i got this error = "amount too long or not numeric: length 6 MAX:15"

    But when i pass 728 without floating point to it can run perfectly so what should i do (.80)

    Thank in Advance

Post a comment