Welcome Guest, Not a member yet? Register   Sign In
Bean Stream payment gateway
#1

[eluser]megabyte[/eluser]
Does anyone have any experience with Bean Stream secure hosted payments?

I'm looking for any files, examples, etc......

I searched the web, and there isnt much. And their websites documents are not that detailed.

Care to share? Tongue
#2

[eluser]darkhouse[/eluser]
I really like Bean Stream, their system is pretty simple. Here's a library we use for them.

Code:
<?php

if( !defined('BASEPATH') )
    exit('No direct script access allowed');
    
class Beanstream
{
    var $CI = null;
    
    // PROD merchant ID
//    var $merchant_id = 'xxx'; //put your production merchant id here

    // DEV merchant ID
        var $merchant_id = 'xxx'; //put your development merchant id here
    

    function Beanstream()
    {
        $this->CI = &get;_instance();
    }

    
    function ProcessPayment($orderNumber, $amount, $cardOwner, $cardNumber, $expMonth, $expYear, $email, $name, $phone, $address1, $address2, $city, $provinceCode, $postalCode, $countryCode)
    {
        $pf = array(
            'requestType=' . urlencode('BACKEND'),
            'merchant_id=' . urlencode($this->merchant_id),
    
            'trnOrderNumber=' . urlencode(sprintf('d', $orderNumber)),
            'trnAmount=' . urlencode($amount),
            'trnCardOwner=' . urlencode($cardOwner),
            'trnCardNumber=' . urlencode($cardNumber),
            'trnExpMonth=' . urlencode(sprintf('d', $expMonth)),
            'trnExpYear=' . urlencode(sprintf('d', substr($expYear, -2))),
            
            'ordEmailAddress=' . urlencode($email),
            'ordName=' . urlencode($name),
            'ordPhoneNumber=' . urlencode($phone),
            'ordAddress1=' . urlencode($address1),
            'ordAddress2=' . urlencode($address2),
            'ordCity=' . urlencode($city),
            'ordProvince=' . urlencode($provinceCode),
            'ordPostalCode=' . urlencode($postalCode),
            'ordCountry=' . urlencode($countryCode)
        );
        
        $post_str = implode('&', $pf);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_URL, "https://www.beanstream.com/scripts/process_transaction.asp");
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str);        
        $txResult = curl_exec($ch);
        curl_close($ch);
        
        $response = array();
        parse_str($txResult, $response);
        
        return $response;
    }
}

And then usage in a controller is just like this:

Code:
$txnResult = $this->beanstream->ProcessPayment(
                $your_order_number,
                $total,
                $cardholder,
                $cc_number,
                $exp_month,
                $exp_year,
                $email,
                $first_name.' '.$last_name,
                $phone,
                $address,
                $address2,
                $city,
                $province,
                $postal,
                $country
            );

if($txnResult['trnApproved']){
   //process data and display receipt/thank you page
} else {
   $error = $txnResult['messageText'];
   //display error
}

Good luck.
#3

[eluser]megabyte[/eluser]
Wow, thanks very much for that.

I'm gona be using their secure hosted payment pages though.

Have you used bean stream that way before?
#4

[eluser]darkhouse[/eluser]
I have not, I prefer to use API's mainly for peace of mind for the user. I would suggest contacting them, they've always been nice to me.
#5

[eluser]megabyte[/eluser]
Hey darkhouse. After a few hours online i did find an example.

I'll be filing yours away though for later just incase. Tongue
#6

[eluser]Irfan Malik[/eluser]
Hi,

can any one tell me about how to complete make payment procedure with bean stream i am new and want to complete template and procedure separately with paypal, mastercard and visa card
#7

[eluser]Irfan Malik[/eluser]
hi darkhouse

can you please help me for complete beanstream payment method actually i am very new.

i hope you will response positivity.
#8

[eluser]darkhouse[/eluser]
Hi Irfan - just use the example I posted above, it should still work, just need to plug in your merchant id, and remember to use your test id for development purposes. I may end up packaging this up to make it easier to implement, but for now if you just grab the code and use it like I explained you should have no problems.
#9

[eluser]Irfan Malik[/eluser]
Sir,


Please tell me how i set error and transaction approve page with complete returns variable i want very easy steps plz guide me i am very new
#10

[eluser]Irfan Malik[/eluser]
Darkhouse


when i open this page which i created message appear "No direct script access allowed"
plz complete guide me how to configure




Theme © iAndrew 2016 - Forum software by © MyBB