Archives for: March 2016

Simple Braintree (PayPal) Payment gateway integration in PHP with DEMO Examples

ilovephp.net

Are you looking for Payment gateway which suites for your website as well as mobile app platform?

Then braintree makes your work much easier. It’s very simple, easier and quick to integrate using Braintree SDK.

Few important point need to consider while proceed to start on Braintree integration-

  1. PHP version of your server
  2. Braintree offer 2 ways API integration
    • Drop-in UI
    • Custom Integration

1. Depending on you server PHP version you can choise Braintree SDK –

Currently availble latest braintree SDK is (braintree-php-3.9.0) which requires PHP version >= 5.4.0 (https://developers.braintreepayments.com/client_libraries/php/braintree-php-3.9.0.tgz)
If your server runs on PHP version which is < 5.4.0?, don’t worry we have work arround for this issue, you can use (braintree_php-2.40.0) Braintree SDK. (https://codeload.github.com/braintree/braintree_php/zip/2.40.0)

2.a Drop-in UI
– Braintree’s Drop-in UI offers a complete, ready-made payment UI for a quick and easy way to accept payments. It’s equally as easy to maintain PCI compliance with Drop-in; it is eligible for SAQ A since Braintree hosts the form that captures customer payment information.

The UI includes a card entry form and, if enabled, PayPal/Venmo buttons (Venmo only on mobile). When a user completes the UI, your client code obtains a payment method nonce for use on your server.

The Drop-in UI is the quickest way to start accepting payments.    Considering security of customer credit card data handing at server end, the Drop-in UI is best choise. In drop in UI you will deal with only a single token (payment_method_nonce) which communicate from website client to website server and then website server to Brintree server.

2.b Custom Integration
In Custom integration, you can create your own payment form with custom colors and layout and collect the customer information before submit to payment gateway. If you need payment form with  multilingual support then you can use custom Brintree API integration. In custom Braintree integration you need more developer efferts compare to Drop in UI.

Ref. Link : https://developers.braintreepayments.com/guides/drop-in/javascript/v2

Before proceed for Braintree API integration, we need to sign up for Braintree SDK. Which is free of cost for everyone.
Follow the below link to Sign up to Braintree SDK.
https://www.braintreepayments.com/get-started

After successfull signup we will get –

Merchant ID: xxxxxxx
Public Key: xxxxxxxx
Private Key: xxxxxxxxxxxxxxx

Below are the 3 demo script of Drop-in UI, Hosted field and custom integration of Braintree Gateway API’s –

  1. Braintree – Payment Gateway integration (Drop-in UI) example :

 

2.  Braintree – Payment Gateway integration (Hosted Fields) example :

 

3.  Braintree – Payment Gateway Custom integration example :

 

Braintree Payment Gateway integration with 3D secure in Drop in-UI Example (Demo) :

 

Braintree – Payment Gateway integration with 3D secure (Hosted Fields) example

 

You can download all above demos from below link :
Download Source Code

Or

Browse source code in github : https://github.com/sagarsdeshmukh/Braintree_gateway_integration_demo_with_PHP

If you have any additional questions Or queries, don’t hesitate to let me know!, Just put comment below or contact @ my mail id sagarsdeshmukh@gmail.com

Hope you enjoy my post 🙂

) )
( (
……..
[|      |
\      /
`—-‘

Happy coding!

How to import excel file data into mysql database in PHP ?

To import excel file data into web application (in MySQL database) is one of simplest task.

Requirements:
– PHP version 5.2.0 or higher

Steps:

  1. Read Excel file data in PHP using “PHPExcel” library
  2. Insert the fetch data into MySQL database

We have excel file , example_file.xlsx

First we will create table in MySQL database to store excel file data. as per the our excel file the database query to create a table structure is as follows,

Fetch excel file data and insert into database as per below –

 

Download Source Code

Happy Coding 🙂

SOAP Web Service Demo using NuSOAP library

The main advantage of using NuSOAP library is it allow developers to create and consume web services based on SOAP without any SOAP related PHP extensions.
If we were not able to predict production server system configuration(Like PHP version) then using of NuSOAP based web service is better.
It’s very easy to create and test webservice using NuSOAP library.

First we created the NuSOAP server which process web service request

Note : The “<webservice_url>” is absolute path of your webservice script(nusoap_api.php).
Ex. <webservice_url> = http://www.ilovephp.net/nusoap_api.php

Download Source Code

 

To consume and test above webservice we use below webservice client script.

 

Download Source Code

That’s it about NuSOAP webservice.
Happy Coding 🙂