Documente Academic
Documente Profesional
Documente Cultură
ABOUT US
SERVICES
SKILLS
FAQ
INDUSTRIES
SITE MAP
CONTACT
KNOWLEDGE
GO
SEARCH
PROCESS
CLIENTS
MISCELLANEOUS
This tip explains about the Direct Payment API i.e how we can do online payment using
Direct Payment API.
n order to implement online payment for any website, we can use the PayPal
platform.PayPals platform accept both credit cards and PayPal account directly on the
website.
For the online payment, PayPal provides two API-based solutions: Direct Payment and
Express Checkout.
This tip explains about the Direct Payment API i.e how we can do online payment using
Direct Payment API.
In case of Direct Payment API,
the customer need not require to have a PayPal account for payment, rather they can
pay directly using the credit cards. We just need to display the user a page with text
fields, where the user will enter his credit card info and the amount to pay and of course
a submit button. In our case let's name the page as "Payment.aspx" and the button as
"btnPayment".
After entering the details of credit card info and the amount to pay, when the user click
on Submit button, the payment information is sent to PayPal using the PayPal
DoDirectPayment API operation. PayPal processes the payment information and the
amount sumitted by the user get transferred to the seller's paypal account. All these
API operation get executed in the background and when these are getting excuted, the
customer is still in the same payment page.
open in browser PRO version Are you a developer? Try out the HTML to PDF API
CAREER
pdfcrowd.com
Steps to implement the Online payment using Direct Payment PayPal API:
LET US CONNECT!
Newsletter
Select Website Payments Pro (Use to represent yourself as a merchant using Pro) for
the Account type, enter email and password, enter some amount, check "Add bank
account" and Click on create account. Once done, generate the API credentials from this
account and use it for testing. Lets say, the API credentials generated as below, these
credentials will be get used while doing online payment using DoDirectPaypalAPI.
Username = seller_1304145158_biz_api1.gmail.com
Password = 1304145176
Signature = AFcWxV21C7fd0v3bYYYRCpSSRl31A4leuYGgGdsuOs6VQyE-12KXdLQt
Create a buyer account:
Same procedure will be followed as that of seller, only the account type should be
"Buyer". After creation the details generated for buyer. Let's say in our case the details
is as below:
Credit Card: Visa 4060180243825030
Exp Date: 4/2016
Bank Account: Checking (Confirmed)
Routing Number: 325272063
Bank Account Number: 790406253446848
open in browser PRO version
pdfcrowd.com
pdfcrowd.com
FirstName, LastName,
With the absence of values for these required fields, the paypal transaction will get
failed.
The exection of
DoDirectPayment API operation results a response type of
DoDirectPaymentResponseType, which will contain the info like Ack code (Success,
SuccessWithWarning, or Failure), Amount of the transaction, PayPal transaction ID,
Error codes and messages etc.
we can also use DoDirectPaymentResponseType further to obtain various data about
the transaction made like PaymentStatus,paymenterrors,TransactionID etc
The information collected here is hardcoded, we can replace it with the value of the
corresponding text fields present in the Payment.aspx page. For the credit card info, we
are using the details generated for the buyer account .Below is the code for the button
click event.
protected void btnPayment_Click(object sender, EventArgs e)
{
//Initialize the paypal inteface ,i.e set the url and the credentials
InitializePaypalInterface();
DoDirectPaymentRequestDetailsType
DoDirectPaymentRequestDetailsType();
DoDirectPaymentResponseType
DoDirectPaymentResponseType();
try
dPRequestDetailsType
dpResponseType
=
=
new
new
{
//Set The Payer Address Type Info
AddressType addressInfo = new AddressType();
open in browser PRO version
pdfcrowd.com
pdfcrowd.com
pdfcrowd.com
if (dpResponseType.Ack.ToString() == "Success")
{
//Display the success message
}
else
{
//Display the error message
}
}
catch (Exception ex)
{
}
}
// Create PayPalAPISoapBinding object and set the merchant credential and url propety
public PayPalAPIAASoapBinding GeneratePaypalAPIAAService()
{
PayPalAPIAASoapBinding paypalAPIAAService = new PayPalAPIAASoapBinding();
paypalAPIAAService.RequesterCredentials = new CustomSecurityHeaderType();
paypalAPIAAService.RequesterCredentials.Credentials = _credential;
paypalAPIAAService.Url = _PaypalUrl;
return paypalAPIAAService;
}
// Generate paypal interface
public void InitializePaypalInterface()
{
PayPalAPISoapBinding PPInterface = new PayPalAPISoapBinding();
UserIdPasswordType cred = new UserIdPasswordType();
string url = string.Empty;
// Initialize the PayPal interface
PPInterface.RequesterCredentials = new CustomSecurityHeaderType();
open in browser PRO version
pdfcrowd.com
Related Tags:
Paypal API, C sharp.NET
Author: Tapaswini Mohanty.
open in browser PRO version
pdfcrowd.com
Share
Tweet
Back to Top
DeloitteFa st50
DB
ZInnov1
Na scome
DB
Stpi
This site uses cookies. We respect your privacy.copyright (c) Mindfire Solutions 2007-2015. Login
pdfcrowd.com