Step 1: Go to https://stripe.com/ and
create your account and get API Keys.(I am using here a test account).
Step 2: Download attached project and get Sripe.dll and
Newtonsoft.Json.dll from Bin Foder and add referance to your project.
Step 3: Follow the code.
<%@
Page Language="C#"
AutoEventWireup="true"
CodeFile="Default.aspx.cs"
Inherits="_Default"
%>
<!DOCTYPE
html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<head
id="Head1"
runat="server">
<title></title>
</head>
<body>
<form id="form1"
runat="server">
<div>
<asp:Button
ID="Button1"
runat="server"
Text="Button"
OnClick="Button1_Click"
/>
</div>
</form>
</body>
</html>
.CS Code
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
Stripe;
public
partial class
_Default : System.Web.UI.Page
{
protected void Page_Load(object
sender, EventArgs e)
{
}
protected void Button1_Click(object
sender, EventArgs e)
{
StripeCustomer
current = GetCustomer();
// int? days = getaTraildays();
//if (days != null)
//{
int chargetotal = 100;//Convert.ToInt32((3.33*Convert.ToInt32(days)*100));
var mycharge = new
StripeChargeCreateOptions();
mycharge.AmountInCents = chargetotal;
mycharge.Currency =
"USD";
mycharge.CustomerId =
current.Id;
string key =
"sk_test_Uvk2cHkpYRTC2Rl4ZUfs4Fvs";
var chargeservice = new
StripeChargeService(key);
StripeCharge
currentcharge = chargeservice.Create(mycharge);
//}
}
private StripeCustomer GetCustomer()
{
var mycust = new
StripeCustomerCreateOptions();
mycust.Email =
"[email protected]";
mycust.Description =
"Rahul Pandey([email protected])";
mycust.CardNumber =
"4242424242424242";
mycust.CardExpirationMonth = "10";
mycust.CardExpirationYear = "2014";
// mycust.PlanId = "100";
mycust.CardName =
"Rahul Pandey";
mycust.CardAddressCity = "ABC";
mycust.CardAddressCountry = "USA";
mycust.CardAddressLine1 = "asbcd";
//mycust.TrialEnd = getrialend();
var customerservice =
new StripeCustomerService("sk_test_Uvk2cHkpYRTC2Rl4ZUfs4Fvs");
return customerservice.Create(mycust);
}
}
For more please download the code.