#akii-PI vs orders

1 messages Β· Page 1 of 1 (latest)

zinc shadow
#

πŸ‘‹ happy to help

#

Payment Intents (PI) are not meant to hold information about the prices/products etc... it's just a way of asking an amount of money of your user

strong furnace
#

So what can i use ?

zinc shadow
#

if you want to keep track of the prices/products I would recommend you taking look at our orders API

strong furnace
#

I basically want this flow ==> Save CC of user ==> Assign him the subscription and take payment from them

#

How should i go about doing this?

#

BTW im using Java, so i can't use Orders api right?

zinc shadow
#

if you're talking about subscriptions then you should look at the subscriptions API

#

and in there you have items and you can pass the prices

strong furnace
#

will that give me a client secret that i can pass to Client in the same way?

zinc shadow
#

yes you'll have to expand on latest_invoice.payment_intent when creating the subscription

#

and use the client_secret of that object to pass to the front-end for payment

strong furnace
#

Okay, but should i first save the Credit Card for user???

zinc shadow
#

and set it to on_subscription

#

which will save the payment method to the subscription object and will use it as the default_payment_method for that subscription

strong furnace
#

hmm, okay this means i must have a Payment Method already saved for the user..

zinc shadow
#

no not at all

#

the parameter I've just sent you allows you to save the payment method that you are collecting using the client_secret and the Stripe Elements on the front-end directly on the subscription for future usage

strong furnace
#

Okayy

#

Will i get the client-secret when i create this subscription object?

zinc shadow
#

yes you'll have to expand on latest_invoice.payment_intent when creating the subscription

strong furnace
#

okay

#

Also, when im using this clientsecret on front -end, which stripe method should i call? Should i call stripe.confirmPayment ??

zinc shadow
#

yes

strong furnace
#

okay thanks for all the help ☺️ Would u mind not closing this thread for a while as im coding this ??

zinc shadow
#

yes sure

strong furnace
#

Hi, I was adding this payment_settings.save_default_payment_method to my api request. How do i do this with Java??

#

Im doing this now..

#

.setPaymentSettings(
SubscriptionCreateParams.PaymentSettings.builder().build()
)

#

Are u familiar with this?

zinc shadow
#

honestly I'd have to look at it

#

don't have it on top of my head

strong furnace
#

Could u please look for it !!?? That would be immense help !!

#

πŸ₯΄ πŸ™

zinc shadow
#
    SubscriptionCreateParams.PaymentSettings.builder(),setSaveDefaultPaymetnMethod(
      SaveDefaultPaymentMethod.ON_SUBSCRIPTION
).build()
)```
#

I think this might work, could you please try it and get back to me?

strong furnace
#

okay trying this..

#

There is no such method as setSaveDefaultPaymentMethod

zinc shadow
#

what version of the SDK are you using?

strong furnace
#

com.stripe:stripe-java:20.113.0

zinc shadow
#

would you mind updating to version 20.129.0 the latest version

strong furnace
#

Okay doing that

#

Okay yes i found the method after updating

#

Now trying to run everything.

zinc shadow
#

πŸ‘

cold ether
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!

strong furnace
#

@cold ether Could u please look into this issue?

cold ether
#

Can you share the req_xxx?

strong furnace
#

req_I6T3CwA7jtalVv

cold ether
#

Ok, the error seems accurate to me:

  • cus_M0qrXNseB4cuKY has no default PM.
  • You haven't passed the payment_method parameter.
strong furnace
#

Hey if you will look up in this thread , i was told by @zinc shadow that i don't need to have a Payment Method already saved for the user.

cold ether
#

Yes, but because you're using the default behaviour (allow_incomplete) it's expected a PM to be immediately available to charge. You should pass payment_behaviour: 'default_incomplete' on creation if you're capturing payment details after creating: https://stripe.com/docs/api/subscriptions/create#create_subscription-payment_behavior

strong furnace
#

okay trying this..

#

Plesae dont close the thread meanwhile

cold ether
#

sure

strong furnace
#

It still gives the same error.

#

req_MqEBPYQt92csUL

#

Oh no wait

#

i think i made a mistake

cold ether
#

Everything working?

strong furnace
#

Omg yes it Worked!!!! Thanks for the immense help here !! πŸ™Œ πŸ™

cold ether
#

sure, np!