Tag: Web Development

Python programming basics learning

Python-programming-basics

Python-programming-basics

If you are looking forword to learn basics of python programming, then you definitely like my below post. its quite simple and easy for those who have minimal programing knowledge.

How setup python on your local system and run it?

Basic programming syntax and code snippets

 

Reference/Usefull sites:

https://www.python.org/

http://www.newthinktank.com/2014/11/python-programming/

https://developers.google.com/edu/python/

 

Get the client/user/visitor IP address using PHP

The simplest way to get the visitor’s/client’s IP address is using the $_SERVER[‘REMOTE_ADDR’] or $_SERVER[‘REMOTE_HOST’] variables.

However, sometimes this does not return the correct IP address of the visitor, so we can use some other server variables to get the IP address.

 

Stripe API implementation error/exception handling

Stripe error handling

Stripe error handling

Stripe API libraries raise exceptions for many reasons, such as a failed charge, invalid parameters, authentication errors, and network unavailability. The Stripe recommends for writing code that gracefully handles all possible API exceptions.

Below Error Handling code is compatible with latest stripe API version

 

For old stripe versions i.e Stripe API v1.18.0 use below Error Handling code

For more details please check .

 

How can I offer a gzipped csv file for download using PHP?

Question:

I have a PHP script that creates  csv file from the db. I would like to have the script to create the csv data and immediately make a .gzip file available for download. Can you please give me some ideas?

Answer:

You can easily apply gzip compression with the gzencode function.

 

Stripe Payment gateway integration in PHP with DEMO Examples

Stripe payment gateway integration

Stripe payment gateway integration

Stripe payment gateway offers 2 ways of integration in PHP –

  • Stripe checkout integration
  • Stripe custom integration (Stripe.js)

Strip checkout integration:

The easiest way to integrate Stripe is via Checkout, an embedded tool that takes care of building an HTML form, validating user input, and securing your customers’ card data. Using Checkout, sensitive credit card information is sent directly to Stripe, and does not touch your server. Stripe returns to your site a token representation of the card, and this token can then be used in a charge request.

Embedding Checkout in your site

To get started, add the following code to your payment page:

Stripe Checkout Demo

Reference link : https://stripe.com/docs/checkout/tutorial

Stripe custom integration (Stripe.js):

For a more custom approach, you can instead use Stripe with your own payment form via Stripe.js.

Processing payments with Custom Stripe integration has two components:

Below code example show you demonstrate you the custom stripe integration with stripe.js.

Demo Link

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

Or

Browse source code in github : https://github.com/sagarsdeshmukh/Stripe_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 🙂

Braintree Hosted Fields integration with Custom Stylesheet(css) and validation

Braintree hosted field integration offer great flexibility in customization of payment form design with custom style sheet (css) and validation error handling. You can change complete look and feel of your payment form as per site theme with hosted fields solution and it being so easy to do.

We will have example of custom design of payment form below in that we added auto payment method detection logic with braintree on the basis of card number as well as added error handing style on form fields.

With this script you can handle/ Manage full form validation with braintree internal card validation too.

Custom design mock-up :

Braintree-Hosted-Fields-custom-css-validation-Demo

Validation error handling :

Braintree-Hosted-Fields-Demo-custom-validation-style

You can edit the all style content in below script as per your requirement-

 

hosted_field_style.css

 

hosted_field_style.js

 

You can download full script from here.

For any queries regarding above script put comments below or reach me vie mail  – sagarsdeshmukh91@gmail.com

Braintree (PayPal) Payment gateway integration with 3D secure option in PHP

ilovephp.net

By using 3D secure, we provide an additional layer of verification to cardholders and merchants. In checkout process, braintree verify the card details to check does the card has enabled for 3D secure verification OR not. If the card is enabled for authenticate using 3D Secure, the Braintree SDK will display a web page which is provided by the card issuer. The 3D secure authentication page will verify the cardholder’s identity, which is usually done by entering a password.

Note : Before proceed with Braintree 3D secure integration, the braintree Sandbox Account is need to enabled for 3D secure. To enroll in 3D Secure, please contact the Braintree support team at support@braintreepayments.com

If want to make 3D secure transaction with specific payment method just checkout below script.

 

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

Happy coding!

Ref. Link : https://developers.braintreepayments.com/guides/3d-secure/overview
Test card details : https://developers.braintreepayments.com/guides/3d-secure/testing-go-live/php

Simple RESTful API webservice demo in PHP

API URL :  http://domain_name/api.php

Input param :

API Call Request :

Successfull Output :

Error Output :

API Script (api.php) :