Payfort Error code: 00002 Invalid parameter format - forms

I'm trying to add payfort as a payent gateway to a new section in a website. The same code works correctly in another section. I always get "Error code: 00002 Invalid parameter format"
<form method="post" action="https://checkout.payfort.com/FortAPI/paymentPage" class="pay_form" name="form1">
<input type="hidden" name="access_code" value="access_code">
<input type="hidden" name="amount" value="1000.00">
<input type="hidden" name="command" value="PURCHASE">
<input type="hidden" name="currency" value="USD">
<input type="hidden" name="customer_email" value="user#mail.com">
<input type="hidden" name="customer_name" value="customer name">
<input type="hidden" name="language" value="en">
<input type="hidden" name="merchant_identifier" value="identifier_code">
<input type="hidden" name="merchant_reference" value="order_id">
<input type="hidden" name="return_url" value="my_return_url">
<input type="hidden" name="signature" value="form_signature">
</form>
I compared this form to another form in the other section and they are similar to each other but order id, return url and amount are different but the first form works without any issues. Any ideas?

It's because payfort only accepts whole number as amount. You need to multiply the actual amount by 100 and before sending request to payfort make sure its whole number.

Related

Front end entry form with Craft CMS

I am trying to create a form with Craft that allows users to rate entries in a specific section. The section that tracks the ratings has three fields: the ratings drop-down field, a user field, and an entry field. Here is my form right now:
<form method="post" accept-charset="UTF-8">
{{ getCsrfInput() }}
<input type="hidden" name="action" value="entries/saveEntry">
<input type="hidden" name="redirect" value="viewentry/{slug}">
<input type="hidden" name="sectionId" value="userRatings">
<input type="hidden" name="enabled" value="1">
<input type="text" id="user" name="ratings" value="{{currentUser}}" style="display:none;" readonly>
<input type="text" id="restaurant" name="restaurant" value="{{entry.id}}" style="display:none;" readonly>
<label for="ratings">Rate This Restaurant</label>
<select id="ratings" name="ratings" required>
{% for option in entry.ratings.options %}
<option value="{{ option.value }}">{{option.label}}</option>
{% endfor %}
</select>
<input class="button" type="submit" value="Rate">
I have two text boxes that are recording the current user and the Entry ID of the entry I am trying to rate (we are on the _entry.html for this entry). Before I added the "display:none" they were both showing the correct information. Then I am pulling the options for the ratings field that I set in craft and setting them as the values for the drop down here (which is working).
When I try to submit I get a craft error: "Internal Server Error Trying to get property of non-object." Any help or suggestions would be greatly appreciated!
You're missing the 'title' field ..
<input type="hidden" name="title" value="Free Registration Title">
It's a requirement

Why is PayPal saying Invalid Regular Period even when values are correct?

I am submitting the following form and PayPal always gives an error message that says:
Invalid Regular period. You must specify valid values for the A3, P3, and T3 parameters for a subscription.
Question : What is wrong with my html form where the A3,P3 and T3 have valid values?
PayPal Html form for Subscription Payment
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="business" value="someValidValue">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="return" value="http://www.xyz/pc.aspx" />
<input type="hidden" name="custom" value="23V125,new,architect" />
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="A3" value="200" />
<input type="hidden" name="T3" value="M" />
<input type="hidden" name="P3" value="1" />
<input type="hidden" name="item_name" value="Gold" />
<input type="hidden" name="max_text" value="Commit up to 50 loads per month and unlimited viewing/searching" />
<input type="hidden" name="src" value="1"> <!-- recurring=yes -->
<input type="hidden" name="sra" value="1"> <!-- reattempt=yes -->
<div style="display:inline-block;margin-top:50px;">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</div>
</form>
I needed to specify A3,T3 and P3 in lower case. This solved my problem.
Also, always make sure that a3 does not have a value with more than 2 decimal places; having a value without decimal places for a3 is fine. So a value of 200 or 200.34 or 200.1 would work, but 200.0000 or 200.345 would not work.
I came across a useful fact regarding this issue on PayPal documentation at https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/
IPN and PDT variable names are case-sensitive. All constant values are lowercase, except those for payment_status, whose constant values have an initial capital letter.
Try changing the names of the input boxes to lowercase: a3, p3, t3.
<input type="hidden" name="t3" value="M" />

PayPal Item Name/Description on separate lines using forms

I am processing a simple form to PayPal's Express Checkout using the basic standard free account and the standard form "_xclick" option.
When passing through the item name or description, I understand you are limited to 144 characters but I want to have the information inside the title or the description on different lines to separate the information when on PayPals checkout area so the user can clearly see what they are paying for.
I have tried to use "\r" and "\n" to seperate the lines, as seen below in the "item_name" input using "This is line 1\r\nThis is line 2\r\nThis is line 3", but it just ignores the "\r" and the "\n" when passed through to the PayPal payment page and when sent in the receipt email.
Current Example Code:
<form name="TheForm" method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="item_name" value="This is line 1\r\nThis is line 2\r\nThis is line 3">
<input type="hidden" name="price" id="price" value="" />
<input type="hidden" name="business" value="test#test.com">
<input type="hidden" name="amount" value="">
<input type="hidden" name="no_shipping" value="1">
<input type="submit" name="Submit" id="Submit" value="Process Payment" />
</form>
I have also tried using
, 
, <br> and <br /> and none of these work either and are passed through as text.
How can I achieve separating the item information on seperate lines using the form option INPUT value, as shown above, for the item description or title please as the way I have tried does not work and I cannot find any solution?
Thanks.
Currently there is not a way to do this. The standard buy now buttons do not support this. The closest you can come to putting things on a different line would be using a cart upload method. Instead of passing over 1 item, with 3 values in the item name that you want displayed on 3 different lines you would pass over 3 individual items which would cause them to be on 3 different lines.

Drupal 7: Have an Edit Field within a Viewed Node

I have a content type which is only viewable (not editable) to a certain role. I've customised the form output completely (manually outputting each field as they display in a certain way).
However there's one field I would like this user to be able to 'edit' which is a custom 'revision comment' field I've made. I can hardcode in the form fields, except of course it won't work without the token, build id etc that Drupal generates like this:
<input type="hidden" name="form_build_id" value="<?php print render($form['#build_id']); ?>">
<input type="hidden" name="form_token" value="<?php print drupal_get_token($form['#token']); ?>">
<input type="hidden" name="form_id" value="<?php print render($form['#form_id']); ?>">
So essentially I'm wondering what workaround I could use, as $form and it's variable are obviously only generated when 'editing' the node.
In case anyone else needs to know, I hardcoded this into the template file and it works:
<form class="node-form node-project-form" action="/dashboard" method="post" id="project-node-form" accept-charset="UTF-8">
<input type="hidden" name="nid" value="<?php print $nodeid; ?>">
<input type="hidden" name="uid" value="<?php print $user->uid; ?>">
<div id="revision-comments" style="margin:0">
<label for="log-comments">Log Message</label>
<textarea id="log-comments" name="log_comments"" cols="60" rows="4" class="form-textarea"></textarea>
</div>
<input type="submit" id="edit-submit" name="op" value="Post Comment" class="form-submit">
</form>

Strange JSP behavior while rendering a form in a forEach loop

i found a strange behavior in my JSP site and hope somebody have a good advice for me:
JSP-Code:
<c:forEach items="${info.moneyList}" var="mmRoles" varStatus="uStatus" >
....
<div class="paperback" id="delete_${uStatus.index}">
<form id="deleteMoneyMarketSpread_${uStatus.index}"
action="deleteMoneyMarketSpread" method="post">
<input type="hidden" name="currency"
value="${mmRoles.currency}" />
<input type="hidden" name="loan"
value="${mmRoles.loan}" />
<input type="hidden" name="lcfspread"
value="${mmRoles.lcfspread}" />
</form>
</div>
....
</c:forEach>
I generate a form element with hidden input fields in a forEach loop. The interesting point is that (only) in the first iteration no form element will be created. When i check the HTML code with Firebug i only find the hidden input fields, but no surrounding form tag.
HTML code:
<!-- first iteration -->
<div id="delete_0" class="paperback">
<input type="hidden" value="EUR" name="currency">
<input type="hidden" value="true" name="loan">
<input type="hidden" value="123.0" name="lcfspread">
</div>
...
<!-- second iteration -->
<div id="delete_1" class="paperback">
<form id="deleteMoneyMarketSpread_1" method="post" action="deleteMoneyMarketSpread">
<input type="hidden" value="FGH" name="currency">
<input type="hidden" value="true" name="loan">
<input type="hidden" value="1.0" name="lcfspread">
</form>
</div>
Have anyone an idea why this happens?
Regards
Sascha
I still don't found a solution or a reason for this so i used a workaround an create my Form on demand with javaScript when clicking the icon. Not the best way but it works.