How to integrate paypal using codeigniter

Hi,
Actually i’m using codeigniter framework that project need integrate paypal .Already i have paypal sandbox account but i don’t know to integrate. i refrer this link:

But this source code completly paid kindly anyone guide me how to integrate paypal in codeigniter

<?php echo form_open("https://www.sandbox.paypal.com/cgi-bin/webscr"); ?>
<!--                                <form id="jsReservationFrm" action="c" method="post">-->

                                <div class="form-group">
                                    <div><label for="collectionStore" class="control-label fs-0pt8">Check collection
                                            points nearby your location<span class="required">*</span></label></div>
                                    <div>
                                        <input type="text" name="treat" value="<?php echo $treat->treat_id; ?>"/>
                                        <input type="text" name="business" value="xxx@gmail.com"/>
                                        <input type="text" name="item_name" value="<?php echo $treat->name; ?>">
                                        <input type="text" name="userid" value="<?php echo $this->session->userdata['user_id']; ?>">
                                        <input type="hidden" name="credits" value="510">
                                        <input type="text" name="cpp_header_image" value="<?php echo profile_photo_url() . $treat->photo; ?>">
                                        <input type="text" name="currency_code" value="EUR">

                                        <input type="hidden" name="cancel_return" value="<?php echo $this->session->userdata['ref_page']; ?>">
                                        <input type="hidden" name="return" value="">

                                        <input type="hidden" id="postcode-value" value=""/>
                                        <input name="postcode" id="postcode-check" type="text" class="form-control"
                                               maxlength="10" placeholder="Enter your postcode"
                                               onblur="checkCollectionPoints()" required="required">
                                        <span class="text-danger"></span>
                                        <h5 class="hide" id="jsPointAddress"></h5>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <div><label for="quantity" class="control-label fs-0pt8">Quantity<span
                                                class="required">*</span></label></div>
                                    <div><input type="text" name="quantity" value="1" class="form-control"
                                                placeholder="Enter quantity" maxlength="3" size="1"
                                                onkeypress="return fnNotAlphabet(event);" required="required"></div>
                                    <span class="help-block fs-0pt8"></span>
                                </div>

                                <div class="form-group">
                                    <div><label for="collectionDate" class="control-label fs-0pt8">Collection Date<span
                                                class="required">*</span></label></div>
                                    <div>
                                        <?php
                                        $i = 0;
                                        $sid = "";
                                        $today = date("Y-m-d H:i");
                                        if ($user_timezone = $this->session->userdata('localtz')) {
                                            $today = getTimeZone($today, $user_timezone);
                                        }

                                        if ($is_lunch_avail) {
                                            $i = (date("H:i", strtotime($today)) < date("H:i", strtotime('10:00')) ? 0 : 1);
                                            $sid = "jsReserveDate";
                                        }
                                        if ($is_dinner_avail) {
                                            $i = (date("H:i", strtotime($today)) < date("H:i", strtotime('16:00')) ? 0 : 1);
                                        } ?>
                                        <select class="form-control" name='collection_date' id="<?php echo $sid; ?>"
                                                required="required">
                                            <option value="">Select collection date</option>
                                            <?php
                                            for ($i; $i < 7; $i++) {
                                                $date = date("Y-m-d", strtotime("$today +$i days"));
                                                $date1 = date("d M", strtotime("$today +$i days"));
                                                $date2 = date("l, d M", strtotime("$today +$i days"));
                                                $dateFormat;
                                                switch ($i) {
                                                    case 0:
                                                        $dateFormat = "Today, $date1";
                                                        break;
                                                    case 1:
                                                        $dateFormat = "Tommorrow, $date1";
                                                        break;
                                                    default:
                                                        $dateFormat = $date2;
                                                }
                                                echo "<option value='" . $date . "'>" . $dateFormat . "</option>";
                                            }
                                            ?>
                                        </select>
                                    </div>
                                    <span class="help-block fs-0pt8"></span>
                                </div>

                                <div class="form-group">
                                    <div><label for="mealType" class="control-label fs-0pt8">Select your meal<span
                                                class="required">*</span></label></div>
                                    <div>
                                        <select name="meal" id="jsReserveMeal" class="form-control" required="required">
                                            <option value="">Select your meal</option>
                                            <?php
                                            if ($is_lunch_avail) {
                                                echo "<option value='Lunch'>Lunch (12PM - 2:30PM)</option>";
                                            }
                                            if ($is_dinner_avail) {
                                                echo "<option value='Dinner'>Dinner (6PM - 9PM)</option>";
                                            } ?>
                                        </select>
                                    </div>
                                    <span class="help-block fs-0pt8"></span>
                                </div>

                                <?php if ($this->session->userdata('email')) { ?>
                                    <div><input type="hidden" name="email"
                                                value="<?php echo $this->session->userdata('email'); ?>"/></div>
                                <?php } else { ?>
                                    <div class="form-group">
                                        <div><label for="emailAddress" class="control-label fs-0pt8">Email address<span
                                                    class="required">*</span></label></div>
                                        <div><input type="email" name="email" placeholder="Enter email address" value=""
                                                    required="" class="form-control"></div>
                                        <span class="help-block fs-0pt8"></span>

                                        <p>We'll send your reservation confirmation here</p>
                                    </div>
                                <?php } ?>

                                <div class="form-group">
                                    <div><label for="mobileNumber" class="control-label fs-0pt8">Mobile number<span
                                                class="required">*</span></label></div>
                                    <div><input type="tel" name="mobile" class="form-control"
                                                placeholder="Enter mobile phone number" value=""
                                                onkeypress="return fnNotAlphabet(event);"
                                                onkeyup="validateUkPhone($(this))" onblur="validateUkPhone($(this))"
                                                required="required"></div>
                                    <span class="help-block fs-0pt8"></span>
                                </div>

                                <div class="form-group">
                                    <button type="submit" name="submitBtn" class="btn btn-default btn-block br-0 mg-t5">
                                        <span class="h4">CONFIRM RESERVATION NOW</span>
                                    </button>


                                </div>
                                <?php echo form_close(); ?>
                                <a href="https://www.sandbox.paypal.com/cgi-bin/webscr">
                                    <input type="image"
                                           src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif"
                                           border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
                                </a>
                            </div>
                        </div>
                    </section>
                    <?php if (!is_null($subPlan = $this->treat_subscription->get_plan_by_id($treat->treat_id))) {
                        echo "<section class='bg-col-cream mg-b2'>";
                        echo "<div style='padding: 10px 25px;'>";
                        echo "<button class='btn btn-default btn-block br-0' disabled>";
                        echo "<span class='h4 mg-0'>CLICK FOR WEEKLY RESERVATION</span>";
                        echo "<span class='h4 mg-0 pull-right'>";
                        echo "<i class='fs-0pt8 fa fa-gbp'></i>";
                        echo "<span class='fs-1'> " . getPriceByCountry($subPlan->weekly_price, $subPlan->currency_id) . "</span>";
                        echo "</span>";
                        echo "</button>";
                        echo "</div></section>";
                    } ?>
                <?php } ?>
                <section class="bg-col-cream mg-b2">
                    <h4 class="pd-l2 pd-t2">Treat collection points</h4>

                    <div id="map_canvas" style="width:100%; height:250px;"></div>
                    <script type="text/javascript"
                            src="https://maps.google.com/maps/api/js?sensor=false&libraries=places"></script>
                </section>
            <?php } ?>

i send directly sandboxpaypal account but i got only loginscreen only i didn’t get my post data.

Hi,
I’m using paypal in my codeigineter project all values send properly and same time paypal payment also working fine but response not working somebody told me enable ipn then only you get response and i m using local machine not using server.

I have edited your post so it does not show your real email address and PayPal account ID (assuming that was your email address).

1 Like

IPN is not something I have ever used. Have you checked with the PP documentation? AFAIK most of those fields you have as text fields should be hidden fields, although whether that’s the answer to your problem I don’t know.

i got a response for this type:

Array
(
    [_hipmob_details_f66e56d08992490b8d6f172ce798227b] => {"device_id":"yXytHZN0AKgVVrpoHKljsY1LqMNJoEPBgvKjUjPzZjYqFKzsRi36XAX4psoRs7w5"}
    [_ga] => GA1.2.2047752657.1493994446
    [first_session] => {"visits":4,"start":1493994450608,"last_visit":1493994489024,"url":"https://xxx.com/#/home","path":"/","referrer":"","referrer_info":{"host":"xxx.com","path":"/","protocol":"https:","port":80,"search":"","query":{}},"search":{"engine":null,"query":null},"prev_visit":1493994489006,"time_since_last_visit":18,"version":0.4}
)

but i’m not expert this type of response

i refer this link and implement

i expert this informations

paid amount,receipt number,buyer email id,merchand email id

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.