#samip_api

1 messages ยท Page 1 of 1 (latest)

long pulsarBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1290475717636915221

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

brittle wing
#

Hi there, you can upgrade a subscriptoin to a different price without cancelling it.

hollow dirge
#

I read the API doc and tried to follow it. But, I am not being able to upragde them. My problem is with the billing

brittle wing
#

What make you think that you can't upgrade it?

hollow dirge
#

This request req_7m8bKVq6imxBeB has an invoice for $169 scheduled for Nov 1 (one month from now), where as what I wanted to do was :

  1. I charge them on 1st october for $99 (the upgrading product price) - $19 (the price they are currently paying)
  2. I charge them $99 on 1st november
brittle wing
#

This tell Stripe to invoice the customer immediately after the upgrade.

hollow dirge
#

Do I set this on both the phases ?

#

If you could please look up this subscription : sub_1Q4uQOGei7MrDZaxQcE5ve5b

brittle wing
#

Set it on the 2nd phase,

hollow dirge
#

ah , okay. Let me try that please

#

sub_1Q4uaeGei7MrDZaxsJe51an7

#

I am sending the following payload while trying to create a subscription schedule :

        customer: '<stripeCustomerId>,
        end_behavior: 'release',
        start_date: 'now',
        phases: [
          {
            items: [{ price: <priceIdForTheExistingProduct> }],
            iterations: 1,
          },
          {
            items: [{ price:<priceIdForTheProductIwantoUpgradeTo> }],
            iterations: 11,
            proration_behavior: 'always_invoice',
          },
        ],
      },

#

The request ID for it : req_1TTQQWPRy8rHPO

brittle wing
#

OK, it looks good to me.

hollow dirge
#

Can you please look at this ? : sub_1Q4uaeGei7MrDZaxsJe51an7

#

I want the customer to be charged for $80 the moment they succesfully upgrade though ?

#

and then $99 going forward

#

They are not being charged $80 (which is the difference between the plan they are paying right now and trying to upgrade to)

#

The customer in question is : cus_QwoBvnIPnnPHqE

#

Am I missing something here ?

brittle wing
#

Let me take a look

#

Looks like you haven't advanced the test clock to 1 Nov

#

Can you advance to 1 Nov and check the invoice?

hollow dirge
#

Do I advance sub_1Q4uaeGei7MrDZaxsJe51an7 or sub_1Q4uZRGei7MrDZaxuDsADjAv ??

#

The customer's currently got 2 subscriptions on the acc albeit one is scheduled

brittle wing
#

The advancement will apply to all subscriptions associated with the same customer

hollow dirge
#

sub_1Q4uZRGei7MrDZaxuDsADjAv It reverts back to $19 ?

#

Customer : cus_QwoBvnIPnnPHqE

brittle wing
#

Looks like the first invoice wasn't paid successfully, and the subscriptoin is therefore automatically cancelled

hollow dirge
#

But, how ?

#

I am using a test card that should pass

#

I am using the 4242 one

brittle wing
#

How did you set the default payment method for this subscription ?

hollow dirge
#

In our app, we have a checkout session that creates the subscription for the first time, I used the checkout session with a stripe hosted page and entered the card details there. I did not modify the customer except for creating the subscription schedule and test clock advancements

#

The checkout session has given us no problems ever ๐Ÿคž

brittle wing
#

Ok, so you didn't specify a payment_method when creating a subscription schedule, am I right?

#

Therfore, Stripe doesn't have a payement_method to pay invoices generated by the subscription.

hollow dirge
#

Yes, I did not supply payment_method when creating the schedule

#

Can I not upgrade using the payment details I have for the customer ?

#

Do I need to resave it ?

brittle wing
#

I'm not sure if I understand you

hollow dirge
#

The customer journey is :

  1. The customer comes to the app, selects a plan and subscribes to it
  2. A checkout session is created and they are shown the stripe hosted page to pay for the subscription.
  3. The customer comes back and clicks on a button that says Upgrade this is when I create the subscription schedule.

But, if I understand you correctly. Before, I create the subscription schedule I need to create a checkout session in setup mode and use the payment details from there to pass it when creating the subscription schedule, am I right ?

#

If my assumption above is right, then I am asking if I can use the payment method of a customer that is already stored when they complete their checkout in Step 2 and avoid recollecting it ?

brittle wing
#

Thanks for the clarification. Yes you can use the already saved payment method to schedule a subscription

hollow dirge
#

How do I do that ?

#

Please leave this thread alive for another hour as I want to try this

brittle wing
hollow dirge
#

Thanks, let me try this

hollow dirge
#

Hi there, I tried what you said . I tried passing in the default payment method to the second phase item.

I have run a simulation using test clocks but still could not get this to work :

cus_QwqOz9UdkcU00X

#

This is the request ID for the subscription schedule creation : req_dSSqqNx83KGwUA

brittle wing
#

Let me take a look

#

You only set the default_payment_method on the 2nd phase, and there's no payment_method to pay in the 1st phase.

hollow dirge
#

It does seem like it's better than before, but can you please have a look at ?

cus_QwqcGJxaHX47dy . I find the invoice section very interesting and they have two subscriptions on the account.

req_PG8QhPeiFeVNYd

#

The invoicing tells me that the customer got 67$ for the old plan and $99 for the new plan so they paid a total of $166 by Nov 1

What I expect is
On OCT 1 they get charged $80
On NOV 1 they get charged $99

#

Do I need to delete the existing subscription when creating a subscription schedule or update the existing subscription before I create a subscription schedule ?

brittle wing
#

Let me take a look

#

What's the subscription ID? Have you advnced the clock to 1 Nov?

hollow dirge
#

The subscription ID is : sub_1Q4wx6Gei7MrDZaxRGsjr1nR

Yes I have already advanced the clock to 1 NOV

#

This is from the customer (cus_QwqcGJxaHX47dy) 's portal session. So they clearly got charged wrongly

brittle wing
#

Ok, there's no proration invovled here because the phase 2 starts at the end of the 1st billing cycle

#

Why do you expect the customer to be charged $80 on 1 Oct? the starting plan for this subscrpition on 1 Oct is $29

hollow dirge
#

No, it should be $19

#

There is a promoCode applied on checkout

#

The price of the product is $29 but the amount they pay is $19

#

Ok, there's no proration invovled here because the phase 2 starts at the end of the 1st billing cycle

Regarding this, I don't want to end until the end of the 1st billing cycle. I want it to be instant.

brittle wing
#

What do you mean by "instant"? Accoding to your schedule setting, the subscription change only happens at the end of the 1st billing cycle

hollow dirge
#

How do I make it so that "the moment the user clicks on upgrade I am charging them the difference between $19 (which is what they've paid) and $99" ?

#

I don't want to make a change at the end of the 1st billing cycle instead do it when the user clicks on Upgrade

brittle wing