mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
102 lines
2.6 KiB
Protocol Buffer
102 lines
2.6 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package usage.v1;
|
|
|
|
option go_package = "github.com/gitpod-io/gitpod/usage-api/v1";
|
|
|
|
service BillingService {
|
|
// ReconcileInvoices retrieves current credit balance and reflects it in billing system.
|
|
// Internal RPC, not intended for general consumption.
|
|
rpc ReconcileInvoices(ReconcileInvoicesRequest) returns (ReconcileInvoicesResponse) {};
|
|
|
|
// FinalizeInvoice marks all sessions occurring in the given Stripe invoice as
|
|
// having been invoiced.
|
|
rpc FinalizeInvoice(FinalizeInvoiceRequest) returns (FinalizeInvoiceResponse) {};
|
|
|
|
// CancelSubscription cancels a stripe subscription in our system
|
|
// Called by a stripe webhook
|
|
rpc CancelSubscription(CancelSubscriptionRequest) returns (CancelSubscriptionResponse) {};
|
|
|
|
// GetStripeCustomer retrieves a Stripe Customer
|
|
rpc GetStripeCustomer(GetStripeCustomerRequest) returns (GetStripeCustomerResponse) {};
|
|
|
|
rpc CreateStripeCustomer(CreateStripeCustomerRequest) returns (CreateStripeCustomerResponse) {};
|
|
|
|
rpc CreateStripeSubscription(CreateStripeSubscriptionRequest) returns (CreateStripeSubscriptionResponse) {};
|
|
|
|
// GetStripeSubscription without passing in the `status` will return uncancelled subscriptions
|
|
// Stripe returns a list which may include more than one, but we will throw an error in that case
|
|
rpc GetStripeSubscription(GetStripeSubscriptionRequest) returns (GetStripeSubscriptionResponse) {};
|
|
}
|
|
|
|
message ReconcileInvoicesRequest {}
|
|
|
|
message ReconcileInvoicesResponse {}
|
|
|
|
message FinalizeInvoiceRequest {
|
|
string invoice_id = 1;
|
|
}
|
|
|
|
message FinalizeInvoiceResponse {
|
|
}
|
|
|
|
message CancelSubscriptionRequest {
|
|
string subscription_id = 1;
|
|
}
|
|
|
|
message CancelSubscriptionResponse {
|
|
}
|
|
|
|
message GetStripeCustomerRequest {
|
|
oneof identifier {
|
|
string attribution_id = 1;
|
|
string stripe_customer_id = 2;
|
|
}
|
|
}
|
|
|
|
message GetStripeCustomerResponse {
|
|
StripeCustomer customer = 1;
|
|
string attribution_id = 2;
|
|
}
|
|
|
|
message StripeCustomer {
|
|
string id = 1;
|
|
string currency = 2;
|
|
}
|
|
|
|
message CreateStripeCustomerRequest {
|
|
string attribution_id = 1;
|
|
|
|
// name is the customer name
|
|
string name = 2;
|
|
string email = 3;
|
|
string currency = 4;
|
|
}
|
|
|
|
message CreateStripeCustomerResponse {
|
|
StripeCustomer customer = 1;
|
|
}
|
|
|
|
message CreateStripeSubscriptionRequest {
|
|
string attribution_id = 1;
|
|
string setup_intent_id = 2;
|
|
int64 usage_limit = 3;
|
|
}
|
|
|
|
message CreateStripeSubscriptionResponse {
|
|
StripeSubscription subscription = 1;
|
|
}
|
|
|
|
message StripeSubscription {
|
|
string id = 1;
|
|
}
|
|
|
|
message GetStripeSubscriptionRequest {
|
|
string attribution_id = 1;
|
|
string status = 2;
|
|
}
|
|
|
|
message GetStripeSubscriptionResponse {
|
|
string subscription_id = 1;
|
|
}
|