#Andrew Samir
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
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
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
just to start things of we don't have an official library for Angular
but we do have community libraries https://stripe.com/docs/libraries/community
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 ?
your scenarios goes beyond Stripe Elements
so let's discuss them for a sec and then figure out where Stripe Elements play a role
Okay sure
sorry I'll be with you in a sec
Sure tyt
ok would you mind if I suggested some changes in your workflow so it would be easier for your implementation?
Mmmmmmm okay i am not totally sure i can change it
but lets see if its a major change or not
it's basically in your first 3 steps
let's discuss those first since they are one feature and they are totally connected
Okay
First have you got the chance to take a look at this doc? https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
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
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
Hello ๐
Stepping in
What's the new price that you're trying to upgrade to?
its a calculation depending on when the user will upgrade
So you're calculating your own prorations?
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 ?
I need to know what you're doing exactly in order to figure out what's going wrong
concerning what ?
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?
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
Sorry, I'm still having trouble grasping your actual issue
Are you having trouble changing the price of the subscription?
https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#changing
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
Is this custom price going to be the recurring price for the subscription as well or is it just one-time?
one-time
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
does that help clarify? @cloud spade
Yes that help but if i dont need to use subscriptions like i stated before
could you check from this message ?
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.
yes i am implementing subscription by using paymentIntents and cron job to check renewal data and this job recreate a payment intent
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?
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 ?
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 beconfirmPaymentlike 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 useconfirmSetuphttps://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'sinvoice_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
4- while they are on my page
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
Okay great but does these scenarios needs me to be PCI compliant or no need ?
You technically always have to be PCI compliant in some way. But yes, if you are using Elements and the raw PANs never touch your server, you will have much less of a PCI compliance burden. https://stripe.com/en-gb/guides/pci-compliance#how-stripe-helps-organizations-achieve-and-maintain-pci-compliance
Okay then .... i am very thankful for you ... you really helped me so much
I appreciate your time
Of course, happy I could help!