#jwerre

1 messages · Page 1 of 1 (latest)

silk ledgeBOT
slow wind
#

What do you mean by simulate, here?

#

Do the ~same thing without a client involved?

foggy parrot
#

ya... I just working on the server so

slow wind
#

so you could use that endpoint with one of our test PMs to confirm on the server, eg provide payment_method=pm_card_visa

foggy parrot
#

Right, so I could just create a Payment intent Method after I create the subscription with the Payment Intent secret returned from the subscription and a test payment method. Is that correct?

#

sorry... Payment method

slow wind
#

The subscriptions first invoice already has a payment intent with a client secret, yes, so you don't need to create another

#

you can call /confirm for that payment intent yes

#

For a subscription though the PM must be attached to the subscription customer first

#

(because the sub > invoice > PI are all associated with a customer)

foggy parrot
#

hmmm.

#

Would stripe.confirmCardPayment work on a Node server?

slow wind
#

No that's only meant to be used via Stripe.js in a browser context

#

What are you trying to do that makes the server confirm call not a good fit?

foggy parrot
#

I'm writing tests on the server and haven't started on the client side yet. My tests do the following:

  1. create customer
  2. create subscription w/ payment intent

At this point there is no card attached to the customer. So I can't really do anything else, updates etc. It's my understanding that a card is attached to the subscription with stripe.confirmCardPayment. I'm trying to simulate this on the server so I can flush out the rest of my tests. I thought I would just create a Payment Method and attach it and that would automatically pay the invoice. Then I could update the subscription's default_payment_method from the Payment Intent's payment_method. Once that's done I could flush out the rest of my test: upgrade subscription, cancel, etc..

slow wind
#

Ah, just tested, you can do the confirm with pm_card_visa and it'll end up attaching a new card PM to the customer

foggy parrot
#

What do you mean by "do the confirm"?

#

Something like this: curl https://api.stripe.com/v1/payment_intents/pi_.../confirm \ -u sk_test_...: \ -d payment_method=pm_card_visa

slow wind
#

Yes, the /confirm call for the PI

foggy parrot
#

gotcha... thank you!

slow wind
#

NP!

silk ledgeBOT
silk ledgeBOT