Goedenavond allemaal,
Ik ben nou zover dat ik de api van targetpay (iDeal) werkend heb gekregen, alleen krijg ik een error dat ik een te laag bedrag mee stuur.
ErrorTP0002 Bedrag te laag (minimaal 0,84 euro)
Warning: Cannot modify header information - headers already sent by (output started at /home/onehosted/domains/onehosted.nl/public_html/msf/koopcredits.php:17) in /home/onehosted/domains/onehosted.nl/public_html/msf/test_betaling.php on line 101
Dit is het stukje waarin het bedrag (in centen) word bepaald:
Dit is de TargetPayIdeal.class.php:PHP Code:
<input type=radio name="aantal_credits" VALUE="1100">10 Credits - €11,-<br />
<input type=radio name="aantal_credits" VALUE="2500">25 Credits - €27,50<br />
<input type=radio name="aantal_credits" VALUE="5000">50 Credits - €55,-<br />
<input type=radio name="aantal_credits" VALUE="10000">100 Credits - €110,-<br />
En dit is de pagina waarop de betaling uitgevoerd moet worden:PHP Code:
<?php
/**
* TargetPay Example class
*
* SVE
*
* 11-01-2009
*/
abstract class TargetPay {
/**
* @var int rtlo partner ID
*/
protected $intRtlo = 0;
/**
* @desc construction class
* @Var int rtlo partner ID
*/
public function __construct( $intRtlo ) {
$this->setRtlo ( $intRtlo );
}
/**
* Get response for a targetpay request
*
* @param array $aParams
* @return string
*/
protected function getResponse( $aParams, $sRequest = 'https://www.targetpay.com/api/plugandpay?' ) {
# convert params
$strParamString = $this->makeParamString( $aParams );
# get request
$strResponse = @file_get_contents( $sRequest . $strParamString);
if ( $strResponse === false )
throw new Exception('Could not fetch response');
return $strResponse;
}
/**
* Make string from params
*
* @param array $aParams
* @return string
*/
protected function makeParamString( $aParams ) {
$strString = '';
foreach ( $aParams as $strKey => $strValue )
$strString .= '&' . urlencode($strKey) . '=' . urlencode($strValue);
# remove first &
return substr( $strString ,1 ) ;
}
/**
* Get the base request with IP, RTLO, domain,
*
* @return array
*/
protected function getBaseRequest() {
# return array with base parameters
$aParams = array();
$aParams['action'] = 'start';
$aParams['ip'] = $_SERVER['REMOTE_ADDR'];
$aParams['domain'] = $this->strDomain ;
$aParams['rtlo'] = $this->intRtlo ;
return $aParams;
}
/**
* @desc set domain
*
*/
public function setDomain ( $strDomain ) {
$this->strDomain = $strDomain;
}
/**
* @desc set rtlo partner id
* @Var int rtlo partner ID
*/
public function setRtlo ( $intRtlo ) {
$this->intRtlo = $intRtlo;
}
/**
* Return rtlo
*
* @return int
*/
public function getRtlo () {
return $this->intRtlo;
}
}
?>
Ik hoop dat iemand met verstand van de iDeal API van TargetPay mij kan helpen.PHP Code:
<?php
/**
* Ideal example on how to use the ideal class!
*
* SVE
*
* 11-01-2009
*
*/
require_once ( 'TargetPayIdeal.class.php');
$iRtlo = 60171;
# Set ideal amount in cents so 500 cent will be 5 euro
$iAmount = mysql_real_escape_string($_POST['aantal_credits']);
# Set return url from your website
$iReturnurl = "http://uwdomein.nl/idealExampleV2.php";
# Set report url to recieve the status of transactions not retreived by the returnurl
$iReporturl = "http://uwdomein.nl/reportscript.php";
$iIssuer = $_GET[ "bank" ];
/**
* This function will validate the payment after returning from the bank
*/
# ?action=validate&trxid= 'trxid'
if ( isset ( $_GET['ec'] ) && isset ( $_GET['trxid'] ) ) {
# Init the class
$oIdeal = new TargetPayIdeal ( $iRtlo );
// $oIdeal->setDomain ( 'www.mijndomein.nl' );
if ( $oIdeal->validatePayment ( $_GET['trxid'] ) == true ) {
echo 'De betaling was geslaagd';
}
else {
echo 'De betaling was (nog) niet geslaagd';
}
}
elseif($iIssuer == "")
{
/*
* Choose your bank
*/
?>
<form method=get name=idealform>
<i>Selecteer uw bank...</i><br /><br />
<select name="bank"><script src="http://www.targetpay.com/ideal/issuers-nl.js"></script></select>
<INPUT TYPE=submit VALUE="Ga verder"></form>
<?
}
else
{
/*
* Initiate payment
*/
ini_set ( 'display_errors' , '1');
# To initiate a payment, initiate the class
$oIdeal = new TargetPayIdeal ( $iRtlo );
# Set ideal amount in cents so 500 cent will be 5 euro
$oIdeal->setIdealAmount ( $iAmount );
# Set ideal issuer
$oIdeal->setIdealissuer ( $iIssuer );
# Set ideal description
$oIdeal->setIdealDescription ( 'Dit is een test betaling');
# Set return url, wich should return on succes
$oIdeal->setIdealReturnUrl ( $iReturnurl );
# Set report url
$oIdeal->setIdealReportUrl ( $iReporturl );
# Now we can initiate the payment
$aReturn = $oIdeal->startPayment();
# This is the transaction id
$intTrxId = $aReturn[0];
# this will be the bank url that will rederect to the bank.
$strBankURL = $aReturn[1];
# For check we can echo it here. (uncomment if you want to see. )
//echo 'Transaction ID: '. $intTrxId . '<br/>Bank URL: '. $strBankURL;
/**
* This haader function will redirect the browser to the bank
*/
header( "Location: ". $strBankURL );
}
?>
Gr.
Jos
- TargetPay iDeal bedrag instellen
-
30-11-2010, 21:35 #1
- Berichten
- 943
- Lid sinds
- 15 Jaar
TargetPay iDeal bedrag instellen
-
-
30-11-2010, 21:43 #2gast37595 Guest
Re: TargetPay iDeal bedrag instellen
Mischien is het handig om ze in een <form> te zetten.
omdat anders soms de $_POST[''] functie niet functioneert
mvg, tom
-
30-11-2010, 22:08 #3
- Berichten
- 943
- Lid sinds
- 15 Jaar
Re: TargetPay iDeal bedrag instellen
Helaas werkt dat ook niet...
-
30-11-2010, 22:43 #4
- Berichten
- 488
- Lid sinds
- 15 Jaar
-
30-11-2010, 23:03 #5
- Berichten
- 943
- Lid sinds
- 15 Jaar
Re: TargetPay iDeal bedrag instellen
Echt raar, ook dit werkt niet... Heb inmiddels ook een mailtje naar TargetPay gestuurd, benieuwd wat hun antwoorden!
-
01-12-2010, 07:00 #6
Elephant Media GbR
- Berichten
- 1.253
- Lid sinds
- 18 Jaar
Re: TargetPay iDeal bedrag instellen
je zet al variabelen voordat je de class start.
lees wat meer over classes, want volgens mij kun je ze beter op een andere manier devineren.
zit echter in de trein, dus kan niet zo snel even wat aanpassen.
wel is het hoogwaarschijnlijk hou script die het niet doet, en niet targetpay ;)
Plaats een
- + Advertentie
- + Onderwerp
Marktplaats
Webmasterforum
- Websites algemeen
- Sitechecks
- Marketing
- Domeinen algemeen
- Waardebepaling
- CMS
- Wordpress
- Joomla
- Magento
- Google algemeen
- SEO
- Analytics
- Adsense
- Adwords
- HTML / XHTML
- CSS
- Programmeren
- PHP
- Javascript
- JQuery
- MySQL
- Ondernemen algemeen
- Belastingen
- Juridisch
- Grafisch ontwerp
- Hosting Algemeen
- Hardware Info
- Offtopic