Coder Social home page Coder Social logo

stripe-dotnet's Introduction

Stripe.net

NuGet Build Status Coverage Status

The official Stripe .NET library, supporting .NET Standard 2.0+, .NET Core 2.0+, and .NET Framework 4.6.1+.

Installation

Using the .NET Core command-line interface (CLI) tools:

dotnet add package Stripe.net

Using the NuGet Command Line Interface (CLI):

nuget install Stripe.net

Using the Package Manager Console:

Install-Package Stripe.net

From within Visual Studio:

  1. Open the Solution Explorer.
  2. Right-click on a project within your solution.
  3. Click on Manage NuGet Packages...
  4. Click on the Browse tab and search for "Stripe.net".
  5. Click on the Stripe.net package, select the appropriate version in the right-tab and click Install.

Documentation

For a comprehensive list of examples, check out the API documentation. See video demonstrations covering how to use the library.

Usage

Authentication

Stripe authenticates API requests using your account’s secret key, which you can find in the Stripe Dashboard. By default, secret keys can be used to perform any API request without restriction.

Use StripeConfiguration.ApiKey property to set the secret key.

StripeConfiguration.ApiKey = "sk_test_...";

Creating a resource

The Create method of the service class can be used to create a new resource:

var options = new CustomerCreateOptions
{
    Email = "[email protected]"
};

var service = new CustomerService();
Customer customer = service.Create(options);

// Newly created customer is returned
Console.WriteLine(customer.Email);

Retrieve a resource

The Retrieve method of the service class can be used to retrieve a resource:

var service = new CustomerService();
Customer customer = service.Get("cus_1234");

Console.WriteLine(customer.Email);

Updating a resource

The Update method of the service class can be used to update a resource:

var options = new CustomerUpdateOptions
{
    Email = "[email protected]"
};

var service = new CustomerService();
Customer customer = service.Update("cus_123", options);

// The updated customer is returned
Console.WriteLine(customer.Email);

Deleting a resource

The Delete method of the service class can be used to delete a resource:

var service = new CustomerService();
Customer customer = service.Delete("cus_123", options);

Listing a resource

The List method on the service class can be used to list resources page-by-page.

NOTE The List method returns only a single page, you have to manually continue the iteration using the StartingAfter parameter.

var service = new CustomerService();
var customers = service.List();

string lastId = null;

// Enumerate the first page of the list
foreach (Customer customer in customers)
{
   lastId = customer.Id;
   Console.WriteLine(customer.Email);
}

customers = service.List(new CustomerListOptions()
{
    StartingAfter = lastId,
});

// Enumerate the subsequent page
foreach (Customer customer in customers)
{
   lastId = customer.Id;
   Console.WriteLine(customer.Email);
}

Listing a resource with auto-pagination

The ListAutoPaging method on the service class can be used to automatically iterate over all pages.

var service = new CustomerService();
var customers = service.ListAutoPaging();

// Enumerate all pages of the list
foreach (Customer customer in customers)
{
   Console.WriteLine(customer.Email);
}

Per-request configuration

All of the service methods accept an optional RequestOptions object. This is used if you want to set an idempotency key, if you are using Stripe Connect, or if you want to pass the secret API key on each method.

var requestOptions = new RequestOptions();
requestOptions.ApiKey = "SECRET API KEY";
requestOptions.IdempotencyKey = "SOME STRING";
requestOptions.StripeAccount = "CONNECTED ACCOUNT ID";

Using a custom HttpClient

You can configure the library with your own custom HttpClient:

StripeConfiguration.StripeClient = new StripeClient(
    apiKey,
    httpClient: new SystemNetHttpClient(httpClient));

Please refer to the Advanced client usage wiki page to see more examples of using custom clients, e.g. for using a proxy server, a custom message handler, etc.

Automatic retries

The library automatically retries requests on intermittent failures like on a connection error, timeout, or on certain API responses like a status 409 Conflict. Idempotency keys are always added to requests to make any such subsequent retries safe.

By default, it will perform up to two retries. That number can be configured with StripeConfiguration.MaxNetworkRetries:

StripeConfiguration.MaxNetworkRetries = 0; // Zero retries

How to use undocumented parameters and properties

stripe-dotnet is a typed library and it supports all public properties or parameters.

Stripe sometimes has beta features which introduce new properties or parameters that are not immediately public. The library does not support these properties or parameters until they are public but there is still an approach that allows you to use them.

Parameters

To pass undocumented parameters to Stripe using stripe-dotnet you need to use the AddExtraParam() method, as shown below:

var options = new CustomerCreateOptions
{
    Email = "[email protected]"
}
options.AddExtraParam("secret_feature_enabled", "true");
options.AddExtraParam("secret_parameter[primary]", "primary value");
options.AddExtraParam("secret_parameter[secondary]", "secondary value");

var service = new CustomerService();
var customer = service.Create(options);

Properties

To retrieve undocumented properties from Stripe using C# you can use an option in the library to return the raw JSON object and return the property. An example of this is shown below:

var service = new CustomerService();
var customer = service.Get("cus_1234");

customer.RawJObject["secret_feature_enabled"];
customer.RawJObject["secret_parameter"]["primary"];
customer.RawJObject["secret_parameter"]["secondary"];

Writing a plugin

If you're writing a plugin that uses the library, we'd appreciate it if you identified using StripeConfiguration.AppInfo:

StripeConfiguration.AppInfo = new AppInfo
{
    Name = "MyAwesomePlugin",
    Url = "https://myawesomeplugin.info",
    Version = "1.2.34",
};

This information is passed along when the library makes calls to the Stripe API. Note that while Name is always required, Url and Version are optional.

Telemetry

By default, the library sends telemetry to Stripe regarding request latency and feature usage. These numbers help Stripe improve the overall latency of its API for all users, and improve popular features.

You can disable this behavior if you prefer:

StripeConfiguration.EnableTelemetry = false;

Beta SDKs

Stripe has features in the beta phase that can be accessed via the beta version of this package. We would love for you to try these and share feedback with us before these features reach the stable phase. To install a beta version of Stripe.net use the version parameter with dotnet add package command:

dotnet add package Stripe.net --version 40.3.0-beta.1

Note There can be breaking changes between beta versions. Therefore we recommend pinning the package version to a specific beta version in your project file. This way you can install the same version each time without breaking changes unless you are intentionally looking for the latest beta version.

We highly recommend keeping an eye on when the beta feature you are interested in goes from beta to stable so that you can move from using a beta version of the SDK to the stable version.

If your beta feature requires a Stripe-Version header to be sent, set the StripeConfiguration.ApiVersion property with the StripeConfiguration.AddBetaVersion function:

Note The ApiVersion can only be set in beta versions of the library.

StripeConfiguration.AddBetaVersion("feature_beta", "v3");

Support

New features and bug fixes are released on the latest major version of the Stripe .NET client library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.

Development

.NET 8 is required to build and test Stripe.net SDK, you can install it from get.dot.net.

The test suite depends on stripe-mock, so make sure to fetch and run it from a background terminal (stripe-mock's README also contains instructions for installing via Homebrew and other methods):

go install github.com/stripe/stripe-mock@latest
stripe-mock

Run all tests from the src/StripeTests directory:

dotnet test src

Run some tests, filtering by name:

dotnet test src --filter FullyQualifiedName~InvoiceServiceTest

Run tests for a single target framework:

dotnet test src --framework net8.0

The library uses dotnet-format for code formatting. Code must be formatted before PRs are submitted, otherwise CI will fail. Run the formatter with:

dotnet format src/Stripe.net.sln

For any requests, bug or comments, please open an issue or submit a pull request.

stripe-dotnet's People

Contributors

alexander-stripe avatar anelder-stripe avatar anniel-stripe avatar brandur avatar brandur-stripe avatar cjavilla-stripe avatar clement911 avatar ctrudeau-stripe avatar dcr-stripe avatar dplarina avatar helenye-stripe avatar jaymedavis avatar jon-armen avatar jslaybaugh avatar jt000 avatar kamil-stripe avatar karlr-stripe avatar khalidabuhakmeh avatar marydavis avatar ob-stripe avatar pakrym-stripe avatar ramon-stripe avatar ramya-stripe avatar remi-stripe avatar richardlawley avatar richardm-stripe avatar shengwei-stripe avatar stripe-openapi[bot] avatar winzig avatar yejia-stripe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stripe-dotnet's Issues

Question about StripeEvent implementation

I'm working with Stripe WebHooks and am working on an implementation using Stripe.StripeEvent. I'd like to get some feedback on the expected way of working with Stripe.StripeEvent.

As you're likely aware, Stripe sends some json back in a POST; a charge failed looks something like this:

{
"type": "charge.failed",
"livemode": false,
"created": 1326853478,
"data": {
"object": {
"refunded": false,
"livemode": false,
"invoice": "in_00000000000000",
"created": 1332385022,
"card": {
"type": "Visa",
"cvc_check": "pass",
"fingerprint": "mYrFXtt6T56RTeru",
"object": "card",
"exp_month": 5,
"last4": "4242",
"exp_year": 2012,
"id": "cc_00000000000000",
"country": "US"
},
"object": "charge",
"customer": "cus_00000000000000",
"paid": false,
"id": "ch_00000000000000",
"currency": "usd",
"amount": 4995,
"disputed": false,
"fee": 175
}
},
"id": "evt_00000000000000"
}

Using the StripeEventUtility, you can parse this into a StripeEvent as so:

StripeEvent stripeEvent = StripeEventUtility.ParseEvent(json);

and then you're left with a StripeEvent which has a StripeEventData property hanging off of it, which leads to my question.

StripeEventData has an Object property, which is dynamic, and you can query for values with something like this:

var customerId = stripeEvent.Data.Object.customer.ToString(); //returns "cus_00000000000000"

However, you can see that the entire object on this "Charge Failed" json is in fact a StripeCharge, and it would seem to be ideal to just parse it as a StripeCharge and then present a charge object with all of its properties, including customerId, StripeCard, etc. without having to query these individually.

We could do this ourselves if Mapper<> was public, instead of internal. So my question is: Are you happy with the current implementation and it's property-based access as shown above? Or, have I misunderstood how this particular class is supposed to be used?

If you're open to changes here, would you prefer to see changes in how the resulting json is parsed (to return Stripe objects like StripeCharge) or just simply change the access level for helpers like Mapper<>?

thanks

Stripe.Net For framework 3.5

Hi,

I am using stripe.net API in my code to make payments. In code behind i have used stripe.net library to create customer and charge him. It is working perfectly with my test page in dotnet 4.0. But my actual application is in dot 3.5 and i can't convert to 4.0 right now. when I am adding stripe.net.dll reference in my project its showing compatibility issues with 3.5.

Now I am compiling Stripe.net from source (https://github.com/jaymedavis/stripe.net) rather than using the
precompiled dll? But its not working.
what i did

  1. I opened the jaymedavis-stripe.net-1f66f78\src\stripe.sln file with VS 2010.
  2. Then changed the framework to 3.5 by right clicking project properties.
  3. Updated the Newtonsoft.Json.dll refrence to 3.5
  4. Build the project and its giving error:
    "Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' cannot be found. Are you missing a reference to System.Core.dll?
    C:\Users\rupinder.kaur\Desktop\jaymedavis-stripe.net-1f66f78\jaymedavis-stripe.net-1f66f78\src\Stripe\Entities\StripeEventData.cs"

I tried to update the system.core refrence. but its not working. Can you provide me Stripe.net.dll for framework 3.5.

Thanks In Advance
Rupinder

ILMerge messing with other libraries using JSON.Net

It's probably a good idea to make a version that build with JSON.Net ILMerged in and another that doesn't. I am having a hard time using this library.

Really frustrated at this point, I might just have to pull the files into my project and build them with the dependencies of JSON.NET as my project evolves.

Stripe Event Previous Attributes

I am not sure if this is an issue or I just cannot figure out how to access the PreviousAttributes of the StripeEventData object. I am retrieving a webhook event from Stripe as follows...

{
  "id": "evt_1kM7DYo5giINN9",
  "created": 1367380760,
  "livemode": false,
  "type": "customer.subscription.updated",
  "data": {
    "object": {
      "plan": {
        "interval": "month",
        "name": "Monthly (TEST)",
        "amount": 300,
        "currency": "usd",
        "id": "monthly_test",
        "object": "plan",
        "livemode": false,
        "interval_count": 1,
        "trial_period_days": 1
      },
      "object": "subscription",
      "start": 1367375555,
      "status": "unpaid",
      "customer": "cus_1kKhUFPKr7c30g",
      "cancel_at_period_end": false,
      "current_period_start": 1367375615,
      "current_period_end": 1370054015,
      "ended_at": null,
      "trial_start": 1367375511,
      "trial_end": 1367375615,
      "canceled_at": null,
      "quantity": 1
    },
    "previous_attributes": {
      "status": "active"
    }
  },
  "object": "event",
  "pending_webhooks": 1,
  "request": null
}

var json = new StreamReader(Request.InputStream).ReadToEnd();
var evnt = StripeEventUtility.ParseEvent(json);

var previousStatus;

// Does not work.
previousStatus = evnt.Data.PreviousAttributes.Status;

// Does not work.
previousStatus = evnt.Data.PreviousAttributes.status;

When I look at the PreviousAttributes property in source it is defined as "dynamic". When I look at the type using GetType().Name, I get back "JObject". I also tried casting to a JObject and then using myJObject["status"], but had issues even casting. I also tried using JObject.Parse(evnt.Data.PreviousAttributes.ToString()) to get a good JObject, but no luck.

This also does not work when I retrieve a StripeEvent object using the StripeEventService.

I am still trying to understand dynamic object in C#, so I may just be unaware on how to access this value.

I appreciate any help I can get on this.

Thanks!

StripeCustomer's card property is always null

Hi

var customerService = new StripeCustomerService();
var customer = customerService.Get(customerId);

// customer.StripeCard is null 

but if I do request via curl there is a list of credit cards and default_card property is set.

Shouldn't it be a array of credit cards instead of one card?

Cheers
aruss

edit: Looks like fix for this bug: ricec@4f732cb

Stripe Connect

Didn't see it on the front page. Wondering if its implemented?

Can't update card address with new multi-card api change

When trying to update just billing address via StripeCustomerService.Update() getting the below error from stripe API due to the card id not being passed so unable to update just the address

{
  "error": {
    "message": "The card object must have a value for 'number'.",
    "type": "card_error",
    "param": "number",
    "code": "invalid_number"
  }
}

New stripe fields available

I got the Stripe dev team to implement some new functionality in the last week and wanted to relay these new fields to you so you can account for them in your framework.

Subscription:

quantity
optional, default is 1
The quantity you'd like to apply to the subscription you're creating. For example, if your plan is $10/user/month, and your customer has 5 users, you could pass 5 as the quantity to have the customer charged $50 (5 x $10) monthly. If you update a subscription but don't change the plan ID (e.g. changing only the trial_end), the subscription will inherit the old subscription's quantity attribute unless you pass a new quantity parameter. If you update a subscription and change the plan ID, the new subscription will not inherit the quantity attribute and will default to 1 unless you pass a quantity parameter.

Plan:

interval_count
optional,default is 1
The number of the unit specified in the interval parameter. For example, you could specify an interval_count of 3 and an interval of 'month' for quarterly billing (every 3 months).

StripEvent.Data.Object should be strongly typed

I'm using the webhooks, and when I retrieve an event using StripeEvent.Data.Object, is returned as dynamic.

Code should return this as the appropriate type so that we can upcast appropriately and not have to reconstruct objects like StripeCharge manually.

{"Unexpected character encountered while parsing value: i. Path '', line 0, position 0."}

Executing below line of code with an invalid authorization code gives an exception:
JsonReaderException: Unexpected character encountered while parsing value: i. Path '', line 0, position 0.

The code:

var stripeService = new StripeOAuthTokenService(_secretKey);
var stripeTokenOptions = new StripeOAuthTokenCreateOptions() { Code = request.AuthorizationCode, GrantType = "authorization_code" };
StripeOAuthToken response = stripeService.Create(stripeTokenOptions);

Customer Property missing

Will the Customer.Account_Balance property be added to the API at some point? I have a need for this to be included in my code. Thanks!

Serializing Stripe objects using JsonConvert.Serialize() does not respect the JsonProperty attributes

Hi,

I have been having issues trying to test my Webhook handling class while trying to serialize various Stripe objects.
Here is my strategy: I programatically mock a Request with a ResponseStream and send it to my controller class that handles webhooks. From there, I can test my different events by deserializing the stream into StripeEvents, Customers ..

My problem is that I cannot Serialize a StripeEvent to pass it to the fake response stream because every time I try to, Json.Net refuses to respect the JsonProperty attributes in the class definitions! All the properties are just serialized with the default rules, leaving properties with different names ignored when deserializing the JSON.

Now, you might say that this concerns more JSON.Net then it does Stripe.Net, but I still wanted to post it here because there is no suggestion as to how to test the example code.

Thanks in advance.

StripeDispute

Simple issue, StripeDispute is not yet implemented. I might go ahead and do this but I wanted to open this up as a placeholder for now.

Webhooks Example

Your example for processing webhooks doesn't seem to be working correctly. When the code executes, the StripeEvent.Data.Object is of type 'Object' and the Mapper function requires a string.

Cannot Mock this library using Moq

I'm having difficult mocking stripe exceptions due to the internal nature of the constructor.

 stripe.Setup(s => s.Create(It.IsAny<StripeCustomerCreateOptions>())).Throws<StripeException>();

A small issue, nothing ground breaking, but would be nice if I could do things like above.

Oh also none of the service classes are mockable. The exception I am getting with Moq is the following:

System.NotSupportedException: Invalid setup on a non-virtual (overridable in VB) member: s => s.Create(It.IsAny<StripeCustomerCreateOptions>())

You could make all the public methods virtual or you could implement interfaces. I like the virtual route.

invoice.payment_succeeded event

I just upgraded via NuGet to the latest revision...and my code for processing the invoice.payment_succeeded event broke.

The invoice structure used to contain a StripeInvoiceSubscriptions member, from which I was getting information about the customer's subscription. This appears to have gone away...which is confusing, because as of 3 days ago, Stripe was sending this data in its events.

Why was this member removed? Is there another way to get the data I need?

Stripe.net missing strong name

I added Stripe.net from NuGet. I found that the dlls arent strong named. Since we have a mandate to use strong names ones, could you release one on nuget?

Create Token from customer id

In order to create a shared customer for Stripe Connect the ability is needed to create a token using a customer id instead of the card info as outline on

https://stripe.com/docs/connect/shared-customers

The Stipe call is supposed to look something like:

Stripe::Token.create(
{:customer => CUSTOMER_ID},
ACCESS_TOKEN # user's access token from the Stripe Connect flow
)

Seems like the StipeTokenCreateOptions needs to be updated to allow a customer id to be specified.

CardCity

Card City seems to be missing.

getting invoice item description from webhook

total noob. I need to get the description of the line item for a charge in the ashx file.
here's what I'm trying to do but I get Null Reference Error for stripeInvoice.StripeInvoiceLines.StripeInvoiceItems
thanks in advance.

var StripeCharge = Stripe.Mapper.MapFromJson(stripeEvent.Data.Object.ToString());

            var invoiceService= new StripeInvoiceService();
            StripeInvoice stripeInvoice = invoiceService.Get(StripeCharge.InvoiceId.ToString());

            var invoiceItemService = new StripeInvoiceItemService();


            List<Stripe.StripeInvoiceItem> ListInvoiceItems = stripeInvoice.StripeInvoiceLines.StripeInvoiceItems;


            StripeInvoiceItem invoiceItem;
            string InvoiceItemDescription = "n/a";

//there will always only be one item
foreach (Stripe.StripeInvoiceItem itemID in ListInvoiceItems)
{

                     invoiceItem = invoiceItemService.Get(itemID.Id.ToString());
                     InvoiceItemDescription = invoiceItem.Description.ToString();
                 }

Best practice for StripeEvent nested JSON objects

hello,
i have a invoice.payment_succeeded StripeEvent,
i know that in this case the posted API call contains the following datastructure:

object.lines.subscriptions[0].plan

i use

var stripeEvent = StripeEventUtility.ParseEvent(json);

The lines above is now on stripeEvent.stripeEvent.Data.Object, i need to Deserialize to get the Object to get the subscription property.

My question is is there a way to convert the JSON to StripeFriendy data, instead of .subscriptions get a

stripeEvent.StripeSubscription

?

compile for .net 2.0

because of my hosting company not having .net 4.0 I had to recompile your api to .net 2.0.
I had to use the JSon library for 2.0 but also had to make a change to the Mapper class.

In MapCollectionFromJson I changed it to the following so .net 2.0 can compile it without issues:

    public static List<T> MapCollectionFromJson(string json, string token = "data")
    {
        var jObject = JObject.Parse(json);
        List<T> retList = new List<T>();

        JToken tempToken = jObject.SelectToken(token);

        foreach (var tempObj in tempToken)
        {
            retList.Add(Mapper<T>.MapFromJson(tempObj.ToString()));
        }

        return retList;
    }

All this is FYI in case you feel like adding those changes in.

some checks not resulting in stripexception

apologies if this is the correct behaviour according to spec but when i use the test card numbers from stripe, some are not resulting in a stripeexception being thrown when i believe they should be:

my response from stripe contains these two failures: -
address_line1_check: "fail"
address_zip_check: "fail"

using this number (from https://stripe.com/docs/testing)
4000000000000010

but no stripeexception is being thrown

thanks

StripeCustomerService.Get doesnt work

I created a customer with the .NET api, verified it in www.stripe.com

I then deleted the customer created a new customer and wrote using the old customer ID:

var customerService = new StripeCustomerService();
StripeCustomer stripeCustomer = customerService.Get(customerId);

A stripeCustomer object is returned & no exception is returned. It looks like all the fields are blank other than the Id

How can I validate a customer ?

StripeInvoiceLines.StripeInvoiceItems is always null

I'm trying to get all the lineitmes from an invoice
stripe api says they have a function

Stripe_Invoice::retrieve({INVOICE_ID})->lines->all();

what is the equivalent in stripe.net?

I've tried List<Stripe.StripeInvoiceItem> stripeInvoice = invoiceService.Get("in_xxxxxxxxxx").StripeInvoiceLines.StripeInvoiceItems;
but it's null

and this
StripeInvoice stripeInvoice = invoiceService.Get("in_xxxxxxxxxx")
it's lines properties is always null

Nuget package

How about a nuget package for this. It looks pretty promising.

Consider using ServiceStack.Text over Newtonsoft.Json

It is faster, and you can remove all of the [JsonProperty] attributes in favour of conventional mapping (though you can also do this with Newtonsoft using JsonContractResolver). Just my two cents, I want to process lots of events from the API and would prefer a faster deserializer. I'd be willing to do the work to make the switch.

Need to support getting a total count from the StripeInvoiceService.

Thanks for your great wrapper! I noticed that there is no way to get the total record count of how many stripe invoices there are. This makes paging harder.. if you don't have a total count. Can this be added to the api as maybe an out parameter

var invoiceService = new StripeInvoiceService();
var invoices = invoiceService.List(pageSize, skip);

Web Matrix 2

I am having some problems getting this to work with Web Matrix 2. Any ideas?

Application Fee

Hey, I was using your awesome library and was wondering if you could add the application fee field into the StripeCharge object, and the ability to do something like _stripeClient.CreateCharge(amount, applicationFee, "usd", creditToken, description)?

Support for captured charges

Hi,

I'm using stripe.net and want to create a charge with captured flag set to false. Currently this is not possible - there is no option to set this flag.

Cannot set AmountOff on StripeCouponCreateOptions

Is there any road-map for expanding the StripeCouponCreateOptions functionality to create a StripeCoupon using a fixed AmountOff value?

I am running into an issue applying a coupon to a customer multiple times. Stripe does not allow this. After contacting Stripe's support department, they suggested that I create a new AmountOff coupon on the fly and apply it to the customer.

Coupon Property "Amount Off"

In addition to the "PercentOff" property already implemented for coupons, I'd love to see the amount_off property implemented as "AmountOff".

https://stripe.com/docs/api#coupon_object

Thanks for making Stripe not only trivial to use, but easy to transparently swap in/out as our payment processing needs change. Really good work.

trial_end not converting to unix timestamp for update

When setting the trial_end date in StripeCustomerUpdateSubscriptionOptions and then calling UpdateSubscription, Stripe returns an exception: "Invalid start: must be an integer Unix timestamp in the future".

On inspection, the trial_end date in the URL shows in the normal mm/dd/yy hh:mm format.

Invoice Items

On the section to create invoice items, there is one option missing from the assembly. The "invoice" option is missing which gives you the ability to add an invoice item to an invoice that has already been created. What would be the chances of adding the one line: (the invoice here - I think this would give the option to send the invoice ID back to Stripe)

namespace Stripe
{
public class StripeInvoiceItemCreateOptions
{
public StripeInvoiceItemCreateOptions();

    [JsonProperty("amount")]
    public int AmountInCents { get; set; }
    [JsonProperty("currency")]
    public string Currency { get; set; }
    [JsonProperty("customer")]
    public string CustomerId { get; set; }
    [JsonProperty("description")]
    public string Description { get; set; }
    [JsonProperty("invoice")]
    public string Invoice{ get; set; }
}

}

By the way, this is an awesome library. Thanks for putting it together.

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException

I had to compile from source to fix an issue already posted and ever since I'm getting the below error. I tried upgrading the json.net reference to 4.5.0 but it still throws the same error any time I try to retrieve a dynamic property. I'm not sure why it's throwing up because the property and value I want is clearly there. Any thoughts?

stripeEvent.Data.Object.customer

A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
{cus_0KAYfdDx7Argqd}
base {Newtonsoft.Json.Linq.JToken}: {cus_0KAYfdDx7Argqd}
_value: "cus_0KAYfdDx7Argqd"
_valueType: String
HasValues: false
Type: String
Value: "cus_0KAYfdDx7Argqd"

failure_message missing for StripeCharge

Can you add a Failure property to the StripeCharge class mapped to "failure_message" OR perhaps it makes more sense for your framework to process any non-empty values for failure_message and turn it into a StripeException that gets thrown?

Delete Plan fails with "Invalid API Key provided"

API Key is not being passed into Requestor.Delete() when deleting plans.

I believer the line
Requestor.Delete(url);
must be changed to
Requestor.Delete(url, ApiKey);

in method StripePlanService line39

StripeCharge failure exception does not include ChargeId

When a stripe.com charge fails, a chargeid is still generated and passed back in the response:

{
error:
{
code: "card_declined",
charge: ch_0VVLlaE3m3HsRY,
message: "Your card was declined.",
type: "card_error",
},
},

This is important to have in the Exception. Would it be possible to include this data in the StripeError object?

sample code is wrong

myCustomer.CardExpirationYear = "2012"; <<< missing semi-colon ( ; ) at the end of the line

myCustomer.PlanId = planId; << should be PlanId not Plan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.