#Michael-subscriptions

1 messages · Page 1 of 1 (latest)

hybrid sigil
#

@lethal mirage you don't need the third call to /v1/charges no

#

creating the subscription immediately creates an invoice and charges the customer for the first billing period, so if you did that you would be charging them twice

lethal mirage
#

Thanks Karllekko,
the documentation states that CUSTOMER_ID and ITEMS are
REQUIRED in the call for subscriptions. What are ITEMS? a valid product_id, or price_id from the stripe account?

hybrid sigil
#

I'd suggest following a guide and not just the API ref

#

items is an array of hashes with the price ID and an optional quantity

lethal mirage
#

Thanks again karllekko,
I have inherited a project, coded in C #, maybe based on references that are no longer current, but even though I am new to C #, I believe I will succeed, because I will continue ...
Can we make it even more impractical?

I created the customer via the call to https://api.stripe.com/v1/customers

Now I have to "just" change the code so that it calls / subscriptions / but it has to "just" be called with the parameters:
Customer =

and

Price = a present product or price id, created within the dashboard?

hybrid sigil
#

the Price defines the amount the subscription is for and how it recurs, and is something you can create on the Dashboard or through the API

lethal mirage
#

Thanks again karllekko,
I would like to move on and based on your answers, I think it is possible 🙂

If my call to / subscriptions / contains these parameters then is that enough?

customer_id from the call to / customers / and the price the customer subscribes to?

example:
// create cutomer
i call "https://api.stripe.com/v1/customers"
get customer_id returned

// create subscription AND charge for first month
i call "https://api.stripe.com/v1/subscriptions"
with customer_id = returned from previous call AND Price = "price_1JZF8B2eZvKYlo2CmPWKn7RI" (the apikey from dashboard) ??

hybrid sigil
#

I'd suggest just testing the code in test mode!

#

but yep price_xxx is the right value

#

but you don't pass it as price=price_xxx , it has to be inside items

#

if you use our .NET library the link to the guide I shared earlier shows how to do it e.g.

{
        Customer = customerId,
        Items = new List<SubscriptionItemOptions>
        {
            new SubscriptionItemOptions
            {
                Price = req.PriceId,
            },
        },
        PaymentBehavior = "default_incomplete",
    };