I've been working my way through the documentation on Laravels website regarding Cashier. From the sounds of it, it seems like it is exactly what I need. A basic subscription configuration that integrates with Stripe. I am able to follow along fairly easily through the configuration section. Then it switches gears and talks about BrainTree integration for a bit. And then it hops right into creating subscriptions, citing the following code:
$user = User::find(1);
$user->newSubscription('main', 'monthly')->create($stripeToken);
So my first question is - where is "$stripeToken" coming from? I feel like there's a fairly large gap in explanations here. Even when I run the code, it errors out saying $stripeToken could not be found.
Where am I setting/getting the $stripeToken from?
I have attempted to follow other video tutorials on setting up Cashier with Laravel, but these all seem to be outdated, as many of the steps to set it up are no longer relevant in Laravel 5.4. For example:
In the one tutorial, it says that you can check to see if a user is already subscribed to a plan in Stripe via the following:
$user->subscribed('main')
And in the video series, it shows him changing a database field (stripe_active) from 0 to 1, to show a different message in the view. With the new process however, there is no "stripe_active" field even created anymore.
So - at the risk of this being an open-ended vague question, I pose 3 questions to kick things off.
a.) Can anybody tell me how/where I set $stripeToken for the code in the documentation to work?
b.) Can anybody tell me how I can check to see if a subscription exists within Stripe using Cashier 7.0 & Laravel 5.4?
c.) Does anybody know of any good tutorials/videos that walk through this process using the latest versions of each?
You're right-- there's a huge gap in the docs.
A) you need to create a form on the front end view, and generate the token yourself, which you capture via javascript and then submit via POST. It's easiest to do this with Stripe Checkout, but it's more customizable with Stripe Elements.
B) you can see if a User has a subscription in Laravel using the built in methods described here: https://laravel.com/docs/5.4/billing#checking-subscription-status. If you're asking about how to grab Stripe subscriptions by calling Stripe from Laravel, it appears you can do this using $plans = Plan::getStripePlans(); from the stripe/stripe-php library which is a dependency of Laravel Cashier.
C) I found this tutorial to be very helpful, and at the moment it's up to date, though that may change: http://www.qcode.in/subscription-with-coupon-using-laravel-cashier-stripe/
Related
How can i use saved card in stripe for next payment in future using stripe in Laravel framework?
I have tried to find out in Stripe official documentation but i could not find the best solution.
You may want to ask the Laravel/Cashier community for more advice, but it looks like you can retrieve a customer's payment methods like this (docs):
$paymentMethods = $user->paymentMethods();
If you're referring to use with future invoices (eg for subscriptions) you may want to set a default (docs):
$user->updateDefaultPaymentMethod($paymentMethod);
I have found the solution with the help of stripe document.
Here is the reference link https://stripe.com/docs/payments/save-and-reuse?platform=web
With the use of demo i got success. And its working properly.
Thanks for another answers.
One way to do it is using Stripe's future payments. On that documentation one can find PHP examples that can be translated into Laravel.
Depending on the use case, Laravel Cashier might also be of relevance.
A Stripe account will be required (here's the Sign Up page).
Here one can find how to get up and running with a Stripe integration in PHP.
Even though related with Django, my answer here on a similar issue might be of relevance.
In Laravel Spark, (it's my understanding) you can tie your billing plan to a billing plan already setup in Stripe with code that looks something like this
Spark::plan('Basic', 'provider-id-1')
->price(10)
->features([
'First', 'Second', 'Third'
]);
where provider-id-1 is the Stripe ID of you billing plan. The 10 listed as price is used for local display -- the actual price is setup in Stripe. (if this is incorrect, please let me know)
Does Laravel Spark support Stripe's concept of quantities? I don't see anything about this in the docs, but I'm sometimes bad at reading docs.
If not -- has anyone extended Laravel Spark to use quantities. If so, what was involved? I assume you'd need to
Change the Strip API behavior to send along quantities when subscribing a user
Change Laravel display code to display a quantity based pricing
More things that didn't occur to me?
If Laravel spark doesn't support quantities, does anyone know which classes/files are responsible for the two items above? (particularly the Stripe API classes)
Out of the box, Spark does not let you set a quantity while subscribing.
However, because Spark uses Cashier under the hood, and because Cashier has the concept of quantity, you should be able to either swap in your own Subscribe class, or you can possibly do something like this (untested):
$subscription = $user->billable->subscription();
$subscription->quantity(5);
$subscription->save();
As for the UI, that will have to be custom built.
I'm currently developing a little shop system. Now I want to integrate a simple PayPal checkout. Just want to press checkout, log in to PayPal (as a customer), click pay and that's it, I get the money and he gets a confirmation.
Now, for Laravel I found 2 plugins, both relying on this. But somehow I don't come clear with those. Also, I found this, but its too old and different now, using Laravel 5.3. I also found this tutorial, but it also doesn't seem to be what I need (at least I guess so). I already created two sandbox accounts, a personal and a business acount, and I also have a user key and secret key.... But now, how can I use them?
What's the easiest way to just implement a quick way to checkout, entering some product data, the complete price and just be able (as a customer) to log in and click okay? I don't want more basically.
I'm using netshell/paypal for my current POS App. It's pretty good and not complex. Check their documentation from here.
If you are using 5.3 why not go with the new cool Cashier? https://laravel.com/docs/5.3/billing
I am trying to add this script to my Wordpress website that I found on Stripes documentation but I am a little confused as to how to enhance it more to know when the user already has a card on file it needs to update it rather than creating that customer again.
The code I was originally using can be seen here:
https://gist.github.com/bateller/154c6e5d1f6e0e53e527
This is that code with my edits to try and make it update:
http://pastebin.com/B3LXZpWq
I can't find any information anywhere that seems to make sense to me. Hopefully someone can break it down and help me understand before I loose my mind.
Take a look at Managed Accounts
Stripe - Managed Accounts - https://stripe.com/docs/connect/managed-accounts
You get a greater freedom when it comes to things like updating details and it is also a little stricter but worth it for the added API features.
I'm attempting to use the QuickBooks API to sync up my company's product list with the workbook's item list. I have gotten through the OAuth system to be able to make read/write requests to the API, but always get an error while attempting to update an object.
The reference that I have been using is here, and within the same documentation is a reference to retrieving an object that I have been able to use just fine. This is the XML that I'm sending. I have been tweaking the XML for a few hours now to no avail.
The error message that I get is "QB item name already exists ERI=420962215". That ERI is my realm ID. It seems like QuickBooks thinks I am trying to add a new item, when I'm trying to modify an existing one. If I omit the name field or leave it null, it gives me an error as well.
The item that I am attempting to modify was created in QuickBooks, then synced through QuickBook's Sync Manager. I then authenticated my app to that workbook and have been able to read data easily. I only have an issue when I attempt to write. I have yet to try creating or deleting an object since I've been stalling out on updating.
I am trying to just set up a simple form on my company's site that will hit the API and update data when saving, but I can't find a way around this error.
Any help would be greatly appreciated. I began to have trouble on Friday and feel like I'm just spinning in circles now. I found a QuickBooks / PHP library and tried looking through it to see if I could find useful information, but it was a bit too large for me to locate what I was looking for, since I think the error is just some incorrect XML.
I have followed all the directions within the update reference and just can't make progress. I've double and triple checked that my authentication works, that the URL is correct, that I'm sending POST and not GET and that my XML matches the XML shown in that example.
UPDATE 2012-03-15
It seems the problem is that the API is not able to update an item that was created through QuickBooks. Ever item has an id and an idDomain, which indicates if it was made through the API (NG) or Quickbooks (QB). An example id/idDomain would be 1/QB or 2556587/NG.
Whenever I was doing this, I was able to perfectly update an item that was made through the API, but not one made through Quickbooks. After looking into the Supported Object Reference, I noticed that item assembly update/create is listed as beta.
It seems that what I wrote in the update is correct. I am not able to update items that were made in quickbooks through the API. I can read items made in quickbooks, I can create items and I can edit items made through the API, but editing an item made in quickbooks through the API returns this error.
A few things:
What URL are you POSTing to?
Can you show the full HTTP response you're getting? IDS has a bad
habit of returning error messages/codes that are sometimes ambiguous
if you don't look at the full XML response.
Some of these fields are not updateable: QtyOnPurchaseOrder,
QtyOnSalesOrder
You do know you can only use IDS/Sync Manager for applications you're
going to resell to other companies, right? i.e. you can't use it for
internal/one-off apps.
You're going to get much better support if you post these questions
to Intuit's developer forums: https://idnforums.intuit.com/
You may consider migrating to QBO V3 it is way better and easy to work with.
there is a very good api made to for this purpose. which you can get here.
https://github.com/consolibyte/quickbooks-php (Made By : Keith Palmer)
i am using this and am very satisfied with it.