Saturday, 12 January 2013 11:32

Pesapal Iframe

Written by 
Rate this item
(0 votes)

?php include_once('OAuth.php'); //pesapal params $token = $params = NULL; /* PesaPal Sandbox is at Use this to test your developement and when you are ready to go live change to */ $consumer_key = 'd77qEnLfsbAfaqPVFl1HTLFOHitUtA6J';//Register a merchant account on // and use the merchant key for testing. //When you are ready to go live make sure you change the key to the live account //registered on! $consumer_secret = 'JihNJmm93qkDanEaYbi3wxg1JUk=';// Use the secret from your test //account on When you are ready to go live make sure you //change the secret to the live account registered on! $signature_method = new OAuthSignatureMethod_HMAC_SHA1(); $iframelink = '';//change to // when you are ready to go live! //get form details $amount = $_POST['amount']; $amount = number_format($amount, 2);//format amount to 2 decimal places $desc = $_POST['description']; $type = $_POST['type']; //default value = MERCHANT $reference = $_POST['reference'];//unique order id of the transaction, generated by merchant $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $email = $_POST['email']; $phonenumber = '';//ONE of email or phonenumber is required $callback_url = ''; //redirect url, the page that will handle the response from pesapal. $post_xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><PesapalDirectOrderInfo xmlns:xsi=\"\" xmlns:xsd=\"\" Amount=\"".$amount."\" Description=\"".$desc."\" Type=\"".$type."\" Reference=\"".$reference."\" FirstName=\"".$first_name."\" LastName=\"".$last_name."\" Email=\"".$email."\" PhoneNumber=\"".$phonenumber."\" xmlns=\"\" />"; $post_xml = htmlentities($post_xml); $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); //display pesapal - iframe and pass iframe_src ?> <iframe src="/" width="100%" height="620px" scrolling="no" frameBorder="0"> <p>Browser unable to load iFrame</p> </iframe>'

Read 89558 times Last modified on Sunday, 13 January 2013 08:34
Super User

Many folks involved in social media are so ADD driven to the latest social network, they fail to fully explore and make use of the networks that they are already part of.

More in this category: « Contact Us


  • Comment Link Thursday, 26 May 2016 14:10 posted by

    It is discovered in certain meals consisting of barley, millet, and also sorghum, and some sorts of cacti.

  • Comment Link Jens Thursday, 26 May 2016 13:45 posted by Jens

    I'm not sure where you're getting your info, but good topic.

    I needs to spend some time learning much more or understanding more.
    Thanks for excellent info I was looking for this information for my

  • Comment Link Demi Thursday, 26 May 2016 13:40 posted by Demi

    Thank you for every other informative web site. The place
    else may just I get that type of information written in such an ideal way?
    I've a mission that I'm just now operating on, and I have been at the
    look out for such info.

  • Comment Link personal injury law Thursday, 26 May 2016 12:21 posted by personal injury law

    In California, like the County of Los Angeles, an approximate of 50,000 drivers is involved of automobile
    accident annually.

  • Comment Link Susanna Thursday, 26 May 2016 11:43 posted by Susanna

    I think the admin of this web page is actually working hard in favor of his web site, since here every information is quality based material.

  • Comment Link Thursday, 26 May 2016 10:46 posted by

    My spouse and I absolutely love your blog and find a lot of your post's to be
    just what I'm looking for. can you offer guest writers to write content for you
    personally? I wouldn't mind writing a post or elaborating on many of the
    subjects you write about here. Again, awesome site!

  • Comment Link Niamh Thursday, 26 May 2016 10:45 posted by Niamh

    Valuable info. Lucky me I discovered your site unintentionally, and I'm surprised why
    this twist of fate did not came about earlier! I bookmarked it.

  • Comment Link fat loss workouts for athletes Thursday, 26 May 2016 10:22 posted by fat loss workouts for athletes

    It calls for that you do a lot of little points right, with both your diet
    plan and also training.

  • Comment Link Thursday, 26 May 2016 09:59 posted by

    The insurance coverage business will not be quite supportive
    either as the injury lawyers state that the insurance firms are hunting for every
    way achievable so that they shouldn't have to pay income to cover the damages.

  • Comment Link Lilliana Thursday, 26 May 2016 09:32 posted by Lilliana

    I will immediately grasp your rss feed as I can't find your email subscription link or newsletter service.
    Do you have any? Please permit me recognize so that I may subscribe.


Leave a comment

Make sure you enter the (*) required information where indicated.Basic HTML code is allowed.

Online Shopping

Lipa Na M-Pesa

About Us

The Africa Nature Organization is a not-for-profit non-governmental organization registered in Kenya. Read More..

Contact Us

+254 (20) 2606100
+254 721 114 958

This email address is being protected from spambots. You need JavaScript enabled to view it.

University of Nairobi