WebSite X5Help Center

 
Gert J.
Gert J.
User

Website payment type html code  en

Автор: Gert J.
Просмотрено 1940, Подписчики 1, Размещенный 0  

Dear Sir, I am from South Africa and I need to make Payfast my payment option, I have created the pay now button and have the html code to paste. The problem is that I need to add these 2 items below into the coding to make it work and have no idea where it should go, can you maybe help me?

[ORDER_NO] - the order number is entered here;

[PRICE] - the price is entered here.

The pay now code from Payfast is below:

<script language="JavaScript" type="text/javascript">

function click_119cbeb4c2d680676ffa0ccd425731b4( aform_reference ) {
var aform = aform_reference;
aform['amount'].value = Math.round( aform['amount'].value*Math.pow( 10,2 ) )/Math.pow( 10,2 );
aform['custom_amount'].value = aform['custom_amount'].value.replace( /^\s+|\s+$/g,"" );
if( !aform['custom_amount'].value || 0 === aform['custom_amount'].value.length || /^\s*$/.test( aform['custom_amount'].value ) ) {
alert ( 'An amount is required' );
return false;
}
aform['amount'].value = Math.round( aform['custom_amount'].value*Math.pow( 10,2 ) )/Math.pow( 10,2 );
}

</script>

<form action="https://www.payfast.co.za/eng/process" name="form_119cbeb4c2d680676ffa0ccd425731b4" onsubmit="return click_119cbeb4c2d680676ffa0ccd425731b4( this );" method="post">
<input type="hidden" name="cmd" value="_paynow">
<input type="hidden" name="receiver" value="14068907">
<input type="hidden" name="item_name" value="Yislike">
<input type="hidden" name="amount" value="0.00">
<input type="hidden" name="item_description" value="">

<table>
<tr><td><font color="red">*</font>&nbsp;Price</td><td><input type="text" name="custom_amount" class="pricing" value="0.00"></td></tr>
<tr><td colspan=2 align=center><input type="image" src="https://www.payfast.co.za/images/buttons/light-small-buynow.png" width="165" height="36" alt="Buy Now" title="Buy Now with PayFast"></td></tr></table>

Now this button works at logout but the way it is now it need the customer to add the amount manually while the Carrello software is suppose to do this automatically but is lack the ORDER and PRICE lines in the coding. I Tried playing around to inert in different places but then gets a error.

While the pay now button is working in the preview mode inside Website X5 it gives a generic script error when it is uploaded on the website. I have battled now a week and really need help with this. 

I have uploaded a screenshot in the preview mode, you will note the amount at the button is R0.00, here the customer must add manually the amount and this is because the [ORDER_NO]and [PRICE] is not in. The generic error it gives I am sure maybe have something to do inside the server or settings inside my Web X5.

The second image is the same settings but now loaded on the web in live mode, generic error.

I will so appreciate any help.

Kind Regards

Gert Jubileus

Размещено
6 Ответы
Gert J.
Gert J.
User
Автор

The second image attaced showing generic error when the same is uploaded onto the web

Читать больше
Размещено От Gert J.
Paul M.
Paul M.
Moderator

Hello Gert,

Incomedia unfortunately cannot provide support for custom code or payment methods not already integrated in WebSite X5.

However, I have modified your code for you...  please paste the following code into the 'HTML Code for Pay Now Button' section in the Shopping Cart within WebSite X5:

<form action="https://www.payfast.co.za/eng/process" name="form_119cbeb4c2d680676ffa0ccd425731b4" onsubmit="return click_119cbeb4c2d680676ffa0ccd425731b4( this );" method="post">
<input type="hidden" name="cmd" value="_paynow">
<input type="hidden" name="receiver" value="14068907">
<input type="hidden" name="item_name" value="Yislike Order Number: [ORDER_NO]">
<input type="hidden" name="amount" value=[PRICE, 1, #,###.@@]>

<input type="image" src="https://www.payfast.co.za/images/buttons/light-small-buynow.png" width="165" height="36" alt="Buy Now" title="Buy Now with PayFast">

The JavaScript portion of your previous code is not required and will not work with the cart in WebSite X5.

Please let us know how you get on.

Kind regards,

Paul

Search the WebSite X5 Help Center (multilingual)

Читать больше
Размещено От Paul M.
Gert J.
Gert J.
User
Автор

Hi Paul, you are super, thanks so much I appreciate you so much, I am going to test and come back to you, I appreciate your time and effort so much!

Читать больше
Размещено От Gert J.
Gert J.
Gert J.
User
Автор

Tested it, works like a charm, you are super clever Paul, I must say awesome indeed. Thanks so very much. The only problem now is the generic error when live but in preview mode it works 100%,I just now need to find the problem when it is live. Thanks again Paul. Cool cool, I am sure the generic error is just something small.

Читать больше
Размещено От Gert J.
Paul M.
Paul M.
Moderator

Check your error log on the server (ask your webhost for assistance if necessary) for an indication as to where the generic error lies.  That will usually lead you to the cause.

Two strong possibilities are as follows:

1.  PHP version on server older than 5.6 (or otherwise incorrectly configured)

2.  Incompatible email script type set in WebSite X5 in Step 1 Settings > Data Management

The Pro edition of WebSite X5 has a built-in testing facility for both of these in the online control panel:

https://help.websitex5.com/en/v2019.2/pro/index.html?pannello_controllo.htm

As you have the Pro edition you can make use of this feature.  Please read the reference entitled 'Commands in the WebSite Test Section' for full instructions.

Good luck!

Читать больше
Размещено От Paul M.
Gert J.
Gert J.
User
Автор

Thanks so much Paul, I appreciate you. I will let you know when I find the problem, must be in the server forsure. 

Читать больше
Размещено От Gert J.