#Andrew Samir

1 messages ยท Page 1 of 1 (latest)

kindred moonBOT
mortal salmon
#

๐Ÿ‘‹ happy to help

cloud spade
#

Hello there , I previously asked about if i could integrate stripe api without using stripe elements ... and a Stripe staff told me that i must be PCI compliant ... unfortunately i am not PCI complient so i am forced now to use Stripe ELements ... soo there are some scenarios i needs references how to implement them

mortal salmon
#

happy to oblige

#

how may I help?

cloud spade
#

1- I have user story where user must subscribe to a plan and i am using payment intents approach to make this .... user will choose plan then will enter card details and when he click subscribe he will pay ..

#

2- User will click on a button "Add Card" this will popup a form to enter card credentials and then when click save it will be saved to this customer

#

3- Will click on a button "Make default" , this will choose a card from a list of cards and make it default

#

4- User needs to pay for extra balance but with an existing card

#

5- When user click button "Delete Card" the card will be removed from this user's card list

#

Those are the scenarios i need help with using Stripe elements

#

and django as backend

#

Thanks in advance

mortal salmon
#

just to start things of we don't have an official library for Angular

cloud spade
#

Thats sad ๐Ÿ˜‚

#

is there any alternative ?

mortal salmon
cloud spade
#

Okay i tried to use ngx-stripe and i have an issue concerning it but let it for now .... may you help for each scenario which functions i need in stripe elements ?

mortal salmon
#

your scenarios goes beyond Stripe Elements

#

so let's discuss them for a sec and then figure out where Stripe Elements play a role

cloud spade
#

Okay sure

mortal salmon
#

sorry I'll be with you in a sec

cloud spade
#

Sure tyt

mortal salmon
#

ok would you mind if I suggested some changes in your workflow so it would be easier for your implementation?

cloud spade
#

Mmmmmmm okay i am not totally sure i can change it

#

but lets see if its a major change or not

mortal salmon
#

it's basically in your first 3 steps

#

let's discuss those first since they are one feature and they are totally connected

cloud spade
#

Okay

mortal salmon
cloud spade
#

Yes but i need something more customized as the price will change for each subscription upgrade and the date renewal will be immediately set and when downgrade it will wait for next month .... so i implement it with payment intents and cron jobs for checking renewal date

mortal salmon
#

you can use Subscription Schedules

cloud spade
#

but how can i change price when upgrading ... say the subscriptiion price is 5$ i need when upgrading in this moment only to charge user 3$ only for this month

wintry veldt
#

Hello ๐Ÿ‘‹
Stepping in
What's the new price that you're trying to upgrade to?

cloud spade
#

its a calculation depending on when the user will upgrade

wintry veldt
#

So you're calculating your own prorations?

cloud spade
#

yes thats happen only when upgradning the subscription

#

But its not my question point ๐Ÿ˜‚ ... can you please check the above messages to know my issue ?

wintry veldt
#

I need to know what you're doing exactly in order to figure out what's going wrong

cloud spade
#

concerning what ?

wintry veldt
#

but how can i change price when upgrading ... say the subscriptiion price is 5$ i need when upgrading in this moment only to charge user 3$ only for this month
this is your question right?

cloud spade
#

this is not my main question but this is a question concerning using subscriptions
i didnt implement it yet but i didnt find a way to charge the user a price less than the subscription price for the month he upgrade

wintry veldt
cloud spade
#

I dont need to change subscription price ... i just need when user upgrade subscription he charged with a custom price i add not with the subscription price

wintry veldt
#

Is this custom price going to be the recurring price for the subscription as well or is it just one-time?

cloud spade
#

one-time

wintry veldt
#

Hmm there isn't a simple way to do this but as an alternative, you can use customer credit balance to offset the invoice amount

i.e. when the user is attempting to upgrade, you issue a credit note for the amount you want to reduce and that would offset the next invoice
https://stripe.com/docs/invoicing/customer/balance

wintry veldt
#

does that help clarify? @cloud spade

cloud spade
#

Yes that help but if i dont need to use subscriptions like i stated before

cloud spade
wintry veldt
#

1- I have user story where user must subscribe to a plan and i am using payment intents approach to make this .... user will choose plan then will enter card details and when he click subscribe he will pay ..

what do you mean by not needing to use subscriptions? Sorry your follow up asks are vague at the moment. You're clearly saying that the user must subscribe.

cloud spade
#

yes i am implementing subscription by using paymentIntents and cron job to check renewal data and this job recreate a payment intent

white pelican
#

Hello, hanzo had to step out as well but I am catching up. I am actually still a bit confused even after reading from that message. So you are using payment intents directly here and creating your own subscription logic, and you are wondering how to change that up when a user upgrades their subscription?

#

Can you maybe give an example of what you want an upgrade to look like here charge-wise?

cloud spade
#

Ignore the upgrading okay ? i will handle them with my own logic
thats not my main question .

#

My main question is when using Stripe Elements what stripe functions shall i use for each scenario ?
example: for scenario 1 ---- i will use create_payment_intents and confirm_payment_intents to make the subscription with my own logic

#

what about the rest of scenarios ... what shall i use ?

white pelican
#

1- I have user story where user must subscribe to a plan and i am using payment intents approach to make this .... user will choose plan then will enter card details and when he click subscribe he will pay ..
This would be confirmPayment like in this doc https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-submit-payment
2- User will click on a button "Add Card" this will popup a form to enter card credentials and then when click save it will be saved to this customer
If this is not connected to a payment, you will use confirmSetup https://stripe.com/docs/payments/save-and-reuse?platform=web#web-submit-payment-details
3- Will click on a button "Make default" , this will choose a card from a list of cards and make it default
Elements does not have a function for this. You would tell your server to make an update customer call and update the customer's invoice_settings.default_payment_method (or wherever in your database you specify their default) https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method
4- User needs to pay for extra balance but with an existing card
Are you charging the user while they are on your page or when they are off session?
5- When user click button "Delete Card" the card will be removed from this user's card list
You would send a message to your server to make the payment method detach call. https://stripe.com/docs/api/payment_methods/detach

cloud spade
#

4- while they are on my page

white pelican
#

So again Elements doesn't directly support that scenario but our APIs do support it. Basically you would want to create a payment intent serverside, list the user's payment methods. You'd send that info client side however you want but so when they select their payment method in your UI, you know what pm_123... ID that maps to. Then when you want to submit the payment you call confirmCardPayment and supply the proper payment method's ID https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-data-payment_method

cloud spade
#

Okay great but does these scenarios needs me to be PCI compliant or no need ?

white pelican
cloud spade
#

Okay then .... i am very thankful for you ... you really helped me so much
I appreciate your time

white pelican
#

Of course, happy I could help!