-
Notifications
You must be signed in to change notification settings - Fork 461
Quick Start
jziaja edited this page Mar 5, 2015
·
1 revision
For those looking to hit the ground running...
PM> Install-Package PayPal
Add the following to your web.config or app.config
<configuration>
<configSections>
<section name="paypal" type="PayPal.SDKConfigHandler, PayPal" />
</configSections>
<!-- PayPal SDK settings -->
<paypal>
<settings>
<add name="mode" value="sandbox"/>
<add name="clientId" value="_client_Id_"/>
<add name="clientSecret" value="_client_secret_"/>
</settings>
</paypal>
</configuration>
using PayPal.Api;
// Authenticate with PayPal
var config = ConfigManager.Instance.GetProperties();
var accessToken = new OAuthTokenCredential(config).GetAccessToken();
var apiContext = new APIContext(accessToken);
// Make an API call
var payment = Payment.Create(apiContext, new Payment
{
intent = "sale",
payer = new Payer
{
payment_method = "paypal"
},
transactions = new List<Transaction>
{
new Transaction
{
description = "Transaction description.",
invoice_number = "001",
amount = new Amount
{
currency = "USD",
total = "100.00",
details = new Details
{
tax = "15",
shipping = "10",
subtotal = "75"
}
},
item_list = new ItemList
{
items = new List<Item>
{
new Item
{
name = "Item Name",
currency = "USD",
price = "15",
quantity = "5",
sku = "sku"
}
}
}
}
},
redirect_urls = new RedirectUrls
{
return_url = "http://mysite.com/return",
cancel_url = "http://mysite.com/cancel"
}
});
...with PayPal!
Home | Installation | Make Your First Call | Samples | FAQ | Report Issues
Getting Started
Using the PayPal .NET SDK
Extras
Links