Pesapal.com

Forum

Welcome, Guest
Username
Password:
 

IFrame not Loading on Symfony Framework
(1 viewing) (1) Guest
Welcome to the Pesapal integration forum!

This forum discusses everything about Pesapal integration on your web site. Having any problems? This is the right place to post a question and we are sure you will get an answer
  • Page:
  • 1

TOPIC: IFrame not Loading on Symfony Framework

IFrame not Loading on Symfony Framework 2 months, 1 week ago #2204

  • ddvev
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
I am trying to integrate Pesapal on an application built on the Symfony 2 Framework. I've used the sample PHP code but it is constantly giving me an "Problem: signature_invalid | Advice: > | " error when it comes to displaying the iframe. The consumer_keys and secret have been set up correctly.

Here is my integration code:

 
$consumer_key = 'XXXXXXXXXX'';
$consumer_secret = 'YYYYYYYYY';
$token = $params = NULL;
 
$signature_method = new \OAuthSignatureMethod_HMAC_SHA1();
$iframelink = 'http://demo.pesapal.com/api/PostPesapalDirectOrderV4';
 
//Grab payment details
$amount = $request->request->get('total');
$amount = number_format($amount, 2);//format amount to 2 decimal places
//$amount = number_format($amount, 2, '.', '');
$desc = $request->request->get('description');
$type = 'MERCHANT'; //default value = MERCHANT
$reference = $request->request->get('reference');//unique order id of the transaction, generated
$first_name = $request->request->get('first_name'); //[optional]
$last_name = ''; //[Optional]
$email = $firm_email;//Firm email is set at the beginning of the controller
$phonenumber = '';
 
//Build XML request
 
$post_xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><PesapalDirectOrderInfo >";
$post_xml = htmlentities($post_xml);
 
//Send
$consumer = new \OAuthConsumer($consumer_key, $consumer_secret);
//post transaction to pesapal
$iframe_src = \OAuthRequest::from_consumer_and_token($consumer, $token, "GET", $iframelink, $params);
$iframe_src->set_parameter("oauth_callback", $callback_url);
$iframe_src->set_parameter("pesapal_request_data", $post_xml);
$iframe_src->sign_request($signature_method, $consumer, $token);
 
//$iframepage .= $iframe_src;
 
$iframepage .='<!DOCTYPE html>
<html>
<head>
Pay Via
</head>
<body>
<p>Unable to load the payment page</p>
</body>
</html>'
;
 
return new Response($iframepage);
 


What could be the problem?
Last Edit: 2 months, 1 week ago by ddvev. Reason: Fixing grammartical mistakes

Re: IFrame not Loading on Symfony Framework 2 months, 1 week ago #2205

  • ddvev
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
The IFrame code in the sample above has been cleaned out by the forum software. Sorry about that.

Re: IFrame not Loading on Symfony Framework 1 month, 3 weeks ago #2208

  • ddvev
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
I have finally solved it. This could help someone out there.

This tidbit is not pointed at all in the forum responses or Pesapal's documentation: all user inputs assigned to these variables:

 
$desc;
$reference;
$first_name;
$last_name;
$email;
$phonenumber;
 


...should not have spaces in between them. It seems Pesapal's API is rejecting these variables with spaces in between them as wrong parameters.

At least this worked for me.
  • Page:
  • 1