Stripe When to use \Stripe\InvoiceItem::create and Charge::create? - stripe-payments

Good day! I'm new to stripe and I want to ask when to use
\Stripe\InvoiceItem::create and Charge::create?
I read stripe documentation but I'm still confused when or in what situation should I use
\Stripe\InvoiceItem::create
Charge::create
Hope someone can explain it me.

If you have to do only one time payment then you surely use Stripe charge, but the case is where you have to do recurring payment,So go with subscriptions.
In recurring you have to create products, plans, customers and finally subscribe them to your plan.After that you can send Invoice, createInvoice.
If any problem lmk
ref : https://stripe.com/docs/billing/quickstart

Related

Is it okay to have a bunch of incomplete Stripe payment intents?

I am implementing the Stripe payment platform using JavaScript and the PHP SDK.
I don't have any issues with the implementation itself, but I am not sure whether I have to reuse an existing PaymentIntent or it's perfectly fine to have a bunch of them created and incomplete.
I searched for this in Stripe's documentation, but I can't seem to find anything related to this.
For example, in my test account I have this:
It's all for the same transaction, because I was changing some visuals and refreshing the browser.
I am aware that each PaymentIntent has an ID, but is it recommended to add it as a query parameter and retrieve it on refreshing, or is it better to always generate a new Payment Intent.
My main reasoning is to avoid having a huge collection of incomplete payment intents.
The default integration path for Stripe today is to create a PaymentIntent first so that you get a client_secret you can use client-side to render their UI via PaymentElement. This means that if your customers decide not to pay after all, you end up with an incomplete PaymentIntent which is expected.
This is not really a problem, other than appearing in the Payments list which can be confusing. You could also write a background job daily that would cancel any PaymentIntent via you know won't be completed because the customer left and you didn't have any data to contact them to upsell them for example but this isn't really needed.
Stripe also has a beta (docs) right now (Feb 2023) that changes the default integration path. This simplifies the experience because you can render the PaymentElement client-side with specific options such as amount and currency. You'd then only create the PaymentIntent at the end of the flow
when the customer is attempting to pay. That flow limits the number of incomplete PaymentIntents since you only create them when the customer really pays. You'd still get some, for example after a decline by the customer's bank though.

Online payment - trigger on event

Im looking for some advice in relation to a solution that allows a payment to be triggered on a specific event, automatically.
Step 1: User signs up to make a charity donation (provides banking information)
Step 2: On triggering a certain event, a $1 donation is automatically made to the charity from the user
Step 3: A receipt generated back to the user, and also to the charity.
Step 2 would need to trigger each time the event happens, so although it could be $1, the event might happen 3 times, and therefore 3 payments would be made.
I'm looking at something like Stripe as the payment gateway provider, just not sure if I'm looking for the right kind of solution, and whether there is something else Ive not come across already.
Alternatively I would look at collating all occurrences of the event, and send a monthly payment link (which appears to be much simpler approach).
Any help would be appreciated, as Im looking to automate donations for a particular charity in the UK.
Very grateful for any advice anyone is willing to share. Thanks everyone.
Focusing on your overall goal, I believe you could use this [1] flow from Stripe which allows you to collect payment method information from your users and charge them later (whenever you want) by calling the API.
The idea here would be that whenever your "event" is triggered, you code calls the API and charges the saved payment method.
I can't provide a more thorough/specific suggestion since "event" term here is quite vague. Is this "event" time driven (like a subscription) OR something else?
[1] https://stripe.com/docs/payments/save-and-reuse

Stripe Testing - Charge user right away even if subscription due date is next month

I have created a project that allows users to subscribe to our service monthly or yearly.
Now, I want to test our Stripe integration by attaching a working credit card, then changing that credit card into a "decline card" which I found here (4000000000000341).
Now, I wanted to test that flow. I can see that the user's upcoming invoice is still next month, but obviously, I cannot wait for next month since I want to test it right away.
I was Googling and I see that they mentioned that I should put a trial date, I tried that by modifying the user's subscription in the Stripe dashboard, but seems not to work. Maybe I'm missing something or did something wrong? The current flow of our subscription basis is we don't have a trial period, so I am not sure if putting a trial date is applicable to us.
Any help/tips is greatly appreciated! Thank you!
You should use test clocks.
You can simply advance the clock's time to one month later so that the upcoming invoice will be ready for you.
I believe the upcoming invoice won't be paid successfully as you are using a decline test card. You can read this doc to learn more about invoice payment handling.

Magento Payment methods are not showing in checkout

I have a website in magento. iam using payment methods paypal, bank transfer and stripe. using multi store view(3)
Except paypal remaning payment methods are not showing in checkout process. i dont know what to do.
please help me any one,
Thanks,
For me was the usage of an external module with combination of onepage checkout.
In my case was Phoenix_CashOnDelivery and Phoenix_BankPayment

Stripe for one time payment. - Ruby on Rails

Can I use Stripe for receiving a one-time payment instead of recurring payments?
If so what settings do I have to make?
Yes, just use the Stripe::Charge.create method. As the payment method, you can either pass in a card directly or reference a Customer whose card should be charged.
You can receive one-time payments via the Stripe dashboard. Go to:
https://dashboard.stripe.com/payments
and click the button for a "+New" payment. That will let you manually enter the cc info. I do this with my Pairing as a Service clients all the time... they just read me their card info, and I enter it with the amount I'm charging them and a description. Your account password is then required to complete the charge.
It's fast and easy... I just wish there was a way to let them enter the info directly. Maybe I'll make something like that...
Yes, You can just create a Stripe account and use a simple example of Stripe payment for Ruby on Rails I've made recently. Check the code: https://github.com/ab00zar/StripePayment-example
Run the server using your test keys like:
PUBLISHABLE_KEY=pk_test_g0XSu8r2ugAETksVJQXJjU30
SECRET_KEY=sk_test_A3rwGLOMNxEKDkaJOTgi4frd rails s

Resources