-
Notifications
You must be signed in to change notification settings - Fork 571
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ee3f88
commit 6f5d071
Showing
15 changed files
with
703 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
namespace Stripe.Checkout | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using Stripe.Infrastructure; | ||
|
||
public class Session : StripeEntity, IHasId, IHasObject | ||
{ | ||
/// <summary> | ||
/// Unique identifier for the object. | ||
/// </summary> | ||
[JsonProperty("id")] | ||
public string Id { get; set; } | ||
|
||
/// <summary> | ||
/// String representing the object’s type. Objects of the same type share the same value. | ||
/// </summary> | ||
[JsonProperty("object")] | ||
public string Object { get; set; } | ||
|
||
/// <summary> | ||
/// Specify whether Checkout should collect the customer’s billing address. If set to | ||
/// <c>required</c>, Checkout will always collect the customer’s billing address. If left | ||
/// blank or set to <c>auto</c> Checkout will only collect the billing address when | ||
/// necessary. | ||
/// </summary> | ||
[JsonProperty("billing_address_collection")] | ||
public string BillingAddressCollection { get; set; } | ||
|
||
/// <summary> | ||
/// The URL the customer will be directed to if they decide to go back to your website. | ||
/// </summary> | ||
[JsonProperty("cancel_url")] | ||
public string CancelUrl { get; set; } | ||
|
||
/// <summary> | ||
/// A unique string to reference the Checkout Session. This can be a customer ID, a cart | ||
/// ID, or similar. It is included in the <c>checkout.session.completed</c> webhook and can | ||
/// be used to fulfill the purchase. | ||
/// </summary> | ||
[JsonProperty("client_reference_id")] | ||
public string ClientReferenceId { get; set; } | ||
|
||
#region Expandable Customer | ||
|
||
/// <summary> | ||
/// ID of the customer this Session is for if one exists. | ||
/// </summary> | ||
[JsonIgnore] | ||
public string CustomerId { get; set; } | ||
|
||
[JsonIgnore] | ||
public Customer Customer { get; set; } | ||
|
||
[JsonProperty("customer")] | ||
internal object InternalCustomer | ||
{ | ||
get | ||
{ | ||
return this.Customer ?? (object)this.CustomerId; | ||
} | ||
|
||
set | ||
{ | ||
StringOrObject<Customer>.Map(value, s => this.CustomerId = s, o => this.Customer = o); | ||
} | ||
} | ||
#endregion | ||
|
||
/// <summary> | ||
/// The email address used to create the customer object. | ||
/// </summary> | ||
[JsonProperty("customer_email")] | ||
public string CustomerEmail { get; set; } | ||
|
||
/// <summary> | ||
/// The line items, plans, or SKUs that were purchased by the customer. | ||
/// </summary> | ||
[JsonProperty("display_items")] | ||
public List<SessionDisplayItem> DisplayItems { get; set; } | ||
|
||
/// <summary> | ||
/// Has the value <c>true</c> if the object exists in live mode or the value | ||
/// <c>false</c> if the object exists in test mode. | ||
/// </summary> | ||
[JsonProperty("livemode")] | ||
public bool Livemode { get; set; } | ||
|
||
/// <summary> | ||
/// The IETF language tag of the locale Checkout is displayed in. If blank or <c>auto</c>, | ||
/// the browser’s locale is used. | ||
/// </summary> | ||
[JsonProperty("locale")] | ||
public string Locale { get; set; } | ||
|
||
#region Expandable PaymentIntent | ||
|
||
/// <summary> | ||
/// The ID of the PaymentIntent created if SKUs or line items were provided. | ||
/// </summary> | ||
[JsonIgnore] | ||
public string PaymentIntentId { get; set; } | ||
|
||
[JsonIgnore] | ||
public PaymentIntent PaymentIntent { get; set; } | ||
|
||
[JsonProperty("payment_intent")] | ||
internal object InternalPaymentIntent | ||
{ | ||
get | ||
{ | ||
return this.PaymentIntent ?? (object)this.PaymentIntentId; | ||
} | ||
|
||
set | ||
{ | ||
StringOrObject<PaymentIntent>.Map(value, s => this.PaymentIntentId = s, o => this.PaymentIntent = o); | ||
} | ||
} | ||
#endregion | ||
|
||
/// <summary> | ||
/// The list of payment method types (e.g. card) that this Checkout Session is allowed to | ||
/// use. | ||
/// </summary> | ||
[JsonProperty("payment_method_types")] | ||
public List<string> PaymentMethodTypes { get; set; } | ||
|
||
#region Expandable Subscription | ||
|
||
/// <summary> | ||
/// The ID of the subscription created if one or more plans were provided. | ||
/// </summary> | ||
[JsonProperty("subscription")] | ||
public string SubscriptionId { get; set; } | ||
|
||
[JsonIgnore] | ||
public Subscription Subscription { get; set; } | ||
|
||
[JsonProperty("subscription")] | ||
internal object InternalSubscription | ||
{ | ||
get | ||
{ | ||
return this.Subscription ?? (object)this.SubscriptionId; | ||
} | ||
|
||
set | ||
{ | ||
StringOrObject<Subscription>.Map(value, s => this.SubscriptionId = s, o => this.Subscription = o); | ||
} | ||
} | ||
#endregion | ||
|
||
/// <summary> | ||
/// The URL the customer will be directed to after a successful payment. | ||
/// </summary> | ||
[JsonProperty("success_url")] | ||
public string SuccessUrl { get; set; } | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/Stripe.net/Entities/Checkout/Sessions/SessionDisplayItem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
namespace Stripe | ||
{ | ||
using Newtonsoft.Json; | ||
|
||
public class SessionDisplayItem : StripeEntity | ||
{ | ||
/// <summary> | ||
/// Amount for the display item. | ||
/// </summary> | ||
[JsonProperty("amount")] | ||
public long? Amount { get; set; } | ||
|
||
/// <summary> | ||
/// Three-letter ISO currency code, in lowercase. Must be a supported currency. | ||
/// </summary> | ||
[JsonProperty("currency")] | ||
public string Currency { get; set; } | ||
|
||
/// <summary> | ||
/// Details about the display item if it's of type custom. | ||
/// </summary> | ||
[JsonProperty("custom")] | ||
public SessionDisplayItemCustom Custom { get; set; } | ||
|
||
/// <summary> | ||
/// The Plan if the display item is of type plan. | ||
/// </summary> | ||
[JsonProperty("plan")] | ||
public Plan Plan { get; set; } | ||
|
||
/// <summary> | ||
/// Quantity of the display item being purchased. | ||
/// </summary> | ||
[JsonProperty("quantity")] | ||
public long? Quantity { get; set; } | ||
|
||
/// <summary> | ||
/// The Sku if the display item is of type sku. | ||
/// </summary> | ||
[JsonProperty("sku")] | ||
public Sku Sku { get; set; } | ||
|
||
/// <summary> | ||
/// The type of display item. | ||
/// </summary> | ||
[JsonProperty("type")] | ||
public string Type { get; set; } | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/Stripe.net/Entities/Checkout/Sessions/SessionDisplayItemCustom.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
namespace Stripe | ||
{ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
public class SessionDisplayItemCustom : StripeEntity | ||
{ | ||
/// <summary> | ||
/// The description of the line item. | ||
/// </summary> | ||
[JsonProperty("description")] | ||
public string Description { get; set; } | ||
|
||
/// <summary> | ||
/// The images of the line item. | ||
/// </summary> | ||
[JsonProperty("images")] | ||
public List<string> Images { get; set; } | ||
|
||
/// <summary> | ||
/// The name of the line item. | ||
/// </summary> | ||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
namespace Stripe.Checkout | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using Stripe.Infrastructure; | ||
|
||
public class SessionCreateOptions : BaseOptions | ||
{ | ||
/// <summary> | ||
/// Specify whether Checkout should collect the customer’s billing address. If set to | ||
/// <c>required</c>, Checkout will always collect the customer’s billing address. If left | ||
/// blank or set to <c>auto</c> Checkout will only collect the billing address when | ||
/// necessary. | ||
/// </summary> | ||
[JsonProperty("billing_address_collection")] | ||
public string BillingAddressCollection { get; set; } | ||
|
||
/// <summary> | ||
/// The URL the customer will be directed to if they decide to go back to your website. | ||
/// </summary> | ||
[JsonProperty("cancel_url")] | ||
public string CancelUrl { get; set; } | ||
|
||
/// <summary> | ||
/// A unique string to reference the Checkout Session. This can be a customer ID, a cart | ||
/// ID, or similar. It is included in the <c>checkout.session.completed</c> webhook and can | ||
/// be used to fulfill the purchase. | ||
/// </summary> | ||
[JsonProperty("client_reference_id")] | ||
public string ClientReferenceId { get; set; } | ||
|
||
/// <summary> | ||
/// The email address used to create the customer object. If you already know your | ||
/// customer’s email address, use this attribute to prefill it on Checkout. | ||
/// </summary> | ||
[JsonProperty("customer_email")] | ||
public string CustomerEmail { get; set; } | ||
|
||
/// <summary> | ||
/// ID of the customer this Checkout Session is for if one exists. May only be used with | ||
/// <c>LineItems</c>. Usage with <c>SubscriptionData</c> is not yet available. | ||
/// </summary> | ||
[JsonProperty("customer")] | ||
public string CustomerId { get; set; } | ||
|
||
/// <summary> | ||
/// A list of items your customer is purchasing. | ||
/// </summary> | ||
[JsonProperty("line_items")] | ||
public List<SessionLineItemOptions> LineItems { get; set; } | ||
|
||
/// <summary> | ||
/// The IETF language tag of the locale Checkout is displayed in. If blank or <c>auto</c>, | ||
/// the browser’s locale is used. | ||
/// </summary> | ||
[JsonProperty("locale")] | ||
public string Locale { get; set; } | ||
|
||
/// <summary> | ||
/// The list of payment method types (e.g. card) that this Checkout Session is allowed to | ||
/// use. | ||
/// </summary> | ||
[JsonProperty("payment_intent_data")] | ||
public SessionPaymentIntentDataOptions PaymentIntentData { get; set; } | ||
|
||
/// <summary> | ||
/// The list of payment method types (e.g. card) that this Checkout Session is allowed to | ||
/// use. | ||
/// </summary> | ||
[JsonProperty("payment_method_types")] | ||
public List<string> PaymentMethodTypes { get; set; } | ||
|
||
/// <summary> | ||
/// A subset of parameters to be passed to subscription creation. | ||
/// </summary> | ||
[JsonProperty("subscription_data")] | ||
public SessionSubscriptionDataOptions SubscriptionData { get; set; } | ||
|
||
/// <summary> | ||
/// The URL the customer will be directed to after a successful payment. | ||
/// </summary> | ||
[JsonProperty("success_url")] | ||
public string SuccessUrl { get; set; } | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/Stripe.net/Services/Checkout/SessionLineItemOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
namespace Stripe.Checkout | ||
{ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
public class SessionLineItemOptions : INestedOptions | ||
{ | ||
/// <summary> | ||
/// Per item amount to be collected | ||
/// </summary> | ||
[JsonProperty("amount")] | ||
public long? Amount { get; set; } | ||
|
||
/// <summary> | ||
/// Three-letter ISO currency code, in lowercase. Must be a supported currency. | ||
/// </summary> | ||
[JsonProperty("currency")] | ||
public string Currency { get; set; } | ||
|
||
/// <summary> | ||
/// The description for the line item. | ||
/// </summary> | ||
[JsonProperty("description")] | ||
public string Description { get; set; } | ||
|
||
/// <summary> | ||
/// A list of images representing this line item. | ||
/// </summary> | ||
[JsonProperty("images")] | ||
public List<string> Images { get; set; } | ||
|
||
/// <summary> | ||
/// The name for the line item. | ||
/// </summary> | ||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Quantity of the line item being purchased. | ||
/// </summary> | ||
[JsonProperty("quantity")] | ||
public long? Quantity { get; set; } | ||
} | ||
} |
Oops, something went wrong.