Forte.js - Credit Card Payment Form PHP

Modified on Mon, 29 Jul, 2024 at 2:26 PM

 

<!DOCTYPE html>

<html>
	<head>
		<script type="text/javascript" src="https://sandbox.forte.net/api/js/v1"></script>
		
		<script type="text/javascript">
			function onTokenCreated(response)
			{
				//do real transaction here by using the onetime_token
				alert("The onetime_token for this payment method is: " + "\n\n" + response.onetime_token);
			}
			function onTokenFailed(response)
			{
				//handle error here
				alert("Getting onetime_token failed for this payment method -\n\n" + "\t" + "response code: " + response.response_code + "\n" + " response description: " + response.response_description);
			}
		</script>
	</head>
	
	<body>
		Credit Card Number:<input type="text" forte-data="card_number" />
		
		Expiration Month:<select forte-data="expire_month">
		<option value="1">Jan - 1</option>
		<option value="2">Feb - 2</option>
		<option value="3">Mar - 3</option>
		<option value="4" selected>Apr - 4</option>
		<option value="5">May - 5</option>
		<option value="6">Jun - 6</option>
		<option value="7">Jul - 7</option>
		<option value="8">Aug - 8</option>
		<option value="9">Sep - 9</option>
		<option value="10">Oct - 10</option>
		<option value="11">Nov - 11</option>
		<option value="12">Dec - 12</option>
		</select>
		
		Exp Year:<select forte-data="expire_year">
		<option value="2014">2014</option>
		<option value="2015">2015</option>
		<option value="2016">2016</option>
		<option value="2017">2017</option>
		<option value="2018">2018</option>
		<option value="2019">2019</option>
		<option value="2020">2020</option>
		<option value="2021">2021</option>
		<option value="2022">2022</option>
		<option value="2023">2023</option>
		<option value="2024">2024</option>
		<option value="2025">2025</option>
		<option value="2026">2026</option>
		<option value="2027" selected>2027</option>
		</select>
				
		CVV:<input type="text" forte-data="cvv" />		
		
		<button type="submit" forte-api-login-id="xxxxxxxxxx" forte-callback-success="onTokenCreated" forte-callback-error="onTokenFailed">Submit</button>
	</body>
</html>

 


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article