Friday, January 30, 2009

How to Integrate paypal with HTML

How to Integrate paypal with HTML

Paypal is very common payment gate way and mostly used in HTML ,PHP,.NET web sites for sub mit payment to vendor.


Now I am explain steps of integrating in Paypal in our application.

Suppose we have a page where we set the item and price and other inforamation in html hidden fields.
General structure of page is as follows.


[form id="Form1" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"]
[input type="hidden" name="cmd" value="_xclick"] [input type="hidden" name="business" value="mca.mk_1233244379_biz@gmail.com"]
[input type="hidden" name="item_name" value="Item1"]
[input type="hidden" name="amount" value="100.00"]
[input type="hidden" name="currency_code" value="USD"]
[input type="hidden" name="return" value="http://localhost/eStoreFrontCS/Default2.aspx"]
[input type="hidden" name="cancel_return" value="http://localhost/eStoreFrontCS/Default.aspx"]
[asp:Label id="Label2" style="Z-INDEX: 101; LEFT: 784px; POSITION: absolute; TOP: 8px" runat="server"
ForeColor="White" BackColor="#C04000" Font-Bold="True" Width="20045px"]Loading payment process.....[/asp:Label]
[asp:Label id="Label3" style="Z-INDEX: 102; LEFT: 16px; POSITION: absolute; TOP: 8px" runat="server"
Font-Bold="True"]Wait ...[/asp:Label]
[/form]

In action tag we give the url of sandbox. This is starting step with paypal. Open the paypal.com

1)https://developer.paypal.com/ -] Signup now
2)after it you will recive a message “ Sandbox Signup Complete”
3)Check Email account which u specify in signup process. And click link for confermation.
4)Open paypal site with given link.
5)Choose option “Create a preconfigured buyer or seller account.” under TEST ACCOUNT tab.
6)Create a Buyer Account (Use to represent your customer's experience) must open “ Show Advanced Options “ link and give starting balance amout as 5000 USD or as your requirement. In Add note section copypaste the password so u can check it any time in test account secton.
7)Create a Seller Account (Use to represent yourself as the merchant) and also provide sum banalce under “ Show Advanced Options “ In Add note section copypaste the password so u can check it any time in test account secton.
8)Now the work with paypal site is over. Now come on your HTML page. And copy paste all code under form tag.
9)And after it put this script which submit page when it will load
10)[script language="JavaScript"]Form1.submit()[/script]
11) and now this will redirect u on this link https://www.sandbox.paypal.com/us/cgi-bin/webscr? With querystring.
12)Now in “ LOG IN TO PAYPAL “ frame put details of Buyer Account which u created for above code the details ar e as follows mca.mk_1233244323_per@gmail.com / pwd is testpwdtestpwd
13)enter pwd testpwdtestpwd
14) now confermation screen will come
15) Click on pay now button. And u wil get thanks msg window.
16)Now we have to check the effects on murchent and buyer account. So opent sandbox account.
17) Buyer account is debit form 100 USD
18)And murchant account is Credit by 96.8 USD.
Hope with above steps u can get basic idea of paypal account.

Thanks
HelpOnDesk Team

Friday, January 9, 2009

Retrive CSV from DATABASE

HI
Aprox in every project we need to send mail to all registred user then we can retrive emailAddress
in CSV format and form frontend we can fetch all values from for loop and send these emails to user
in single database cycle.

Basic example of this type SP is as follows :-


create proc SelectEmailAddressInCSV
as
set nocount on
DECLARE @xyz VARCHAR(100)
declare @abc varchar(100)

set @abc=''

declare selemail cursor for

select email from dataadi

open selemail
fetch NEXT from selemail into @xyz
WHILE @@Fetch_status = 0
begin


set @abc= @abc+ @xyz+','

FETCH NEXT FROM selemail INTO @xyz
END
print @abc
CLOSE selemail
DEALLOCATE selemail


Table of dataadi is as follows

CREATE TABLE [dbo].[dataadi](
[ID] [int] NOT NULL,
[FirstName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LastName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Email] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_dataadi] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]


So Run this script and modified as your need


simppily we can add these three lines

DECLARE @values varchar(150), @delimiter char
SET @delimiter = ','
SELECT @values = COALESCE(@values + @delimiter, '') + u_name FROM tblsplit
SELECT @values AS [List of Emails]

Thanks
HelpOnDesk Team