cartalyst / stripe Goto Github PK
View Code? Open in Web Editor NEWA comprehensive PHP Library for the Stripe.
License: BSD 3-Clause "New" or "Revised" License
A comprehensive PHP Library for the Stripe.
License: BSD 3-Clause "New" or "Revised" License
Hi cartalyst,
Does this support Stripe Connect?
https://stripe.com/docs/connect/migrating
Which API version is supported?
I am using 2015-04-07 and wonder if anything will break if I upgrade?
You're upgrading to the latest API version from 2015-04-07.
As stripe documentation suggests:
To start using managed accounts you must first activate your account as a platform. You must also be on at least version “2014-12-17” of the API. If you’re on an older version, please upgrade before migrating to managed accounts.
Why would you want to migrate? Recipients will be deprecated by the end of 2015—we will not break any existing integrations, but we won’t be documenting or maintaining it anymore. Secondly, the new APIs come with a lot of new functionality. If you’ve ever found yourself wishing that recipients worked better (e.g. tax reporting, improved identity verification), you might want to check out the new APIs.
Would love to hear your thoughts on this guys. Let me know if I can assist in any way.
Sam
The stripe API supports using refunds without knowing their charge ID, but cartalyst does not. This makes it impossible to lookup the charge ID if we only know the refund ID, for example.
There's a few currencies with no decimals. For these Stripe doesn't require to specify the cents, so multiplying the number by 100 actually increases the charge by 100. Docs here.
Plans parameters statement_descriptor should be used instead of statement_description
https://stripe.com/docs/api/php#plans
https://cartalyst.com/manual/stripe/2.0#plans
This used to work for me
Stripe::charge($charge_id);
currently throws error Undefined variable: pluralMethod
Where as using it this way still works.
return Stripe::charges()->find([
'id' => $charge_id,
]);
The current version (v1.0.3) has a critical bug in it in regards to transforming the amount float into the stripe integer. If you try using a number like 79.99
it transforms it into 7998
and sends that number to stripe.
You have already fixed this with the AmountConverter
class but a new version hasn't been tagged yet so cartalyst/stripe-billing-laravel hasn't picked up the change yet.
On my live server, when I'm trying to create a customer I receive the following error:
Idempotent key length is 0, which is outside accepted lengths. Idempotent Keys must be 1-255 characters long. If you're looking for a decent generator, try using a UUID defined by IETF RFC 4122.
I'm not trying to set an idempotency key. However if I try to set an idempotency key I receive the same error message.
I'm using
cartalyst/stripe v2.0.5
cartalyst/stripe-laravel v4.0.1
This is my code
\Stripe::customers()->create([ 'source' => $request->get('stripeToken'), 'email' => $user->email);
Same code works on my development machine with the same version of composer packages.
How do you create an account?
I need to use Stripe Connect, and create an account on behalf of the user.
manage accounts are not working
While I agree with the intention that @brunogaspar is recommending with this commit, fd3aee2 I do find it a touch scary that this was done before the other package was available.
Wouldn't bumping the major version be a good idea with this breaking change as well to not break anything targeting 0.2.0?
Looking forward to the new package, when its ready.
Why is float being used to store currency values over a decimal field? Float storage is known to not accurately represent currency since it doesn't work in base 10.
If things are going to be stored in cents, then an integer field type should be used. Otherwise a decimal type should be used since it can accurately store currencies.
As per Stripe document https://stripe.com/docs/subscriptions#subscribing-a-customer-to-a-plan , if I provide the credit card details and plan while creating a new customer, the card will be charged immediately and will return the response once done. My project requirement is the same. I want to subscribe the customer to a recurring plan while creating him and also want the first payment must be done immediately that I may mark him as verified and he should be able to login to my system.
Is it possible using your package?
Type error: Argument 1 passed to Cartalyst\Stripe\Exception\Handler::__construct() must be an instance of GuzzleHttp\Exception\ClientException, instance of GuzzleHttp\Exception\ConnectException given
Target [Cartalyst\Stripe\ConfigInterface] is not instantiable
Get this exception when using your laravel package. The interface is never bound to a concretion?
Now you need to migrate your database, but before doing that, you'll need to generate a migration that suits your billable table and to do this you just need to run the following command:
php artisan stripe:table users
however the actual artisan command is
php artisan stripe:migrator users
Launched publicly today, looks to be the same interface for charging a card, would just need to add the interface to capture the bank details & verify.
I can't see a way of setting a card as default
In the Stripe API tis can be done as such
$cu = \Stripe\Customer::retrieve("cus_69L2BtmqFsaWE4");
$cu->default_source = "card_15x2N4GSR4ETmQMl3mZLjNyg";
$cu->save();
Is this the source
field in https://cartalyst.com/manual/stripe/1.0#update-a-customer ?
Hi I kept getting a error when trying to connect a stripe customer to a user in my system for example I tried this method
$customer = Stripe::customer('cus_4pO9BTWtRuwr4l');
$ent = User::where('email', $customer['email'])->first();
$ent->attachStripeCustomer($customer);
But I keep getting a error saying that a Cartalyst/Stripe/Api/Response was expected but a Cartalyst/Stripe/Api/Customer was given . so I was able to fix this by changing the AttachStripeCustomer method in the BillableTrait and BillableInterface to
public function attachStripeCustomer(ResponseClassInterface $customer, $sync = true)
{
// Store the Stripe Customer Id
$this->stripe_id = $customer['id'];
$this->save();
// Should we syncronize the data with Stripe?
if ($sync)
{
// Syncronize the data
$this->syncWithStripe();
}
}
with use statement
use Guzzle\Service\Command\ResponseClassInterface ;
I Also change the BillableInterface function definition .
Hi ya guys,
I am adding a card. Stripe is accepting it fine. However, I am trying to store the returned data to the migrated Cards
Model.
I am getting an SQL
error:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'users_id' cannot be null (SQL: insert into `cards` (`users_id`, `stripe_id`, `brand`, `funding`, `last_four`, `exp_month`, `exp_year`, `updated_at`, `created_at`) values (, card_14Vpoe20GnW0HilOq2P6D9hw, Visa, credit, 4242, 1, 2017, 2014-08-26 19:41:16, 2014-08-26 19:41:16))
I am passing the users_id
through and have checked it is in the array being passed. I can't seem to figure out why it isn't accepting it.
Any ideas to why this isn't working? Many thanks guys.
use Platform\Attributes\Models\Entity;
class Cards extends Entity {
/**
* Relate Users
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function users()
{
return $this->belongsTo('\Movo\Users\Admin\Users', 'users_id', 'user_id');
}
}
use Cartalyst\Stripe\Billing\BillableTrait;
use Cartalyst\Stripe\Billing\BillableInterface;
class User extends Entity implements GroupableInterface, PermissibleInterface, PersistableInterface, UserInterface, PresentableInterface, BillableInterface {
use BillableTrait;
/**
* Relate Cards
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function cards()
{
return $this->hasMany('\Movo\Cart\Models\Cards', 'users_id', 'user_id');
}
}
public function storeCard() {
// dd(Input::all());
$customerID = Input::get('stripeID');
$cardToken = Input::get('stripeToken');
$card = Input::get('card');
$id = Input::get('users_id');
$update_card = new $this->cards([
'users_id' => $id,
'stripe_id' => $card['stripe_id'],
'brand' => $card['brand'],
'funding' => $card['funding'],
'last_four' => $card['last_four'],
'exp_month' => $card['exp_month'],
'exp_year' => $card['exp_year'],
]);
$update_card['users_id'] = $id;
$user = $this->users->find($id);
// Save the card
$user->cards()->save($update_card);
// Send the card data to Stripe
Stripe::cards()->create([
'customer' => $customerID,
'card' => $update_card,
]);
return $this->showForm('update', $id);
}
I would like to send you PR for integrating Stripe with Cygnite. I have created a branch and wish to provide a section for Stripe in Cygnite documentation . Also it will be nice if we can see here.
Thanks!
I am trying to set recipient as default_for_currency
as per https://stripe.com/docs/api#create_transfer-destination
\Stripe::transfers()->create([
'amount' => 26.39,
'currency' => 'CAD',
'recipient' => 'default_for_currency',
]);
and it is not working
I am using WAMP 2.5 with PHP 5.5.12 and Apache 2.4.9 with Windows 8.1.
I am working on Laravel 4.2 project and recently I've installed this package using composer. I am trying to create token using your package's sample code https://cartalyst.com/manual/stripe/1.0#tokens , with localhost. The sample code is as below :
$stripe = new Stripe;
$stripe = Stripe::make('my-stripe-test-public-key');
$token = $stripe->tokens()->create([
'card' => [
'number' => '4012888888881881',
'exp_month' => '05',
'cvc' => '123',
'exp_year' => '2016'
],
]);
But I'm getting this error :
GuzzleHttp \ Exception \ RequestException
cURL error 60: SSL certificate problem: unable to get local issuer certificate
I've tried different solutions like setting
curl.cainfo="cacert.pem" in php.ini also used ca-bundle.crt with the same, restarted WAMP many times but any solution is not working.
I've open_ssl module and cURL enabled in php as well as in apache. Can you please provide me any solution??
I've started to use the Library with Laravel 5.1, its very good and it's helped me a lot.
Once thing I can't see in the code or documentation is how to charge a specific users card. Is this possible to do?
This is mostly because PHP doesn't juggle floats to int well. But there should be a way to input the cents directly as I'm sure there are other edge cases such as
(int) (17.99 * 100) == 1798
Hi I was getting a error during composer update , The theme compiling post command would fail it said that GuzzleClient with missing in src/Api/Stripe.php .
So I don't know weather to change line 316
$client = new GuzzleClient; to $client = new Client;
or change the import to
use Guzzle\Service\Client as GuzzleClient;
or
use Guzzle\Service\GuzzleClient;
All of your code is documented as returning \GuzzleHttp\Message\ResponseInterface
but it doesn't. It returns an array...
It might beg the question why the hell would I want to use something other than Stripe, but unfortunately we don't have Stripe. We do, however, have other processing systems, but charging money is somewhat cumbersome anyway. Because of the laws and regulations regarding private data, you'd have to get a license for storing credit card information, which is obviously not that easy. Not to mention the lack of decent and usable gateways whatsoever.
Most of suitable gateways have the following procedure:
This must be done every time you want to charge user, meaning no planned charges or saved cards.
What I want to do is too keep all the infrastructure of stripe package (invoices, charges, subscriptions, plans, etc), but to rewrite actual charging steps. I.e. it won't involve cards, and payment process/validation will be slightly different. Instead of just charging saved customer card I'll need to be sending an invoice with payment link.
Could you please point me to the right direction, if it's possible.
Since there is no open issue regarding this, I think it probably makes sense to open one to allow discussion around this topic.
NB https://github.com/cartalyst/stripe/tree/feature/guzzle-6
Hey guys,
notice a problem in using storeSubscription. problem happens in this line:
protected function storeSubscription($response, array $attributes = [], Closure $callback = null)
{
// Get the subscription id
$stripeId = $response['id']; <--------------------------
In some cases the passed in object is a response and in some cases the object is a subscription.
response's id is a stripe_id however
$subscription = $this->storeSubscription($response, [
'ended_at' => null,
'canceled_at' => null,
]);
a subscription's id is a db id.
$this->storeSubscription($subscription, [
'trial_ends_at' => $period,
]);
In the Stripe API, there are multiple calls related to Managed Accounts (ie https://stripe.com/docs/api#create_account).
Any ETA on when this will be implemented by Cartalyst?
It makes sense to upgrade to Guzzle 5 as it's way more faster, the only issue is that the required Guzzle package (guzzlehttp/guzzle-services) doesn't have a stable release as of yet, it's on 0.5
at this moment, which isn't that bad, but the lack of documentation makes it a bit of a challenge :)
Hi, forgive me if this is a Symfony2 issue or other, but I've been using cartalyst/stripe in a production application in Symfony2 quite successfully for several months and I'm suddenly having problems, even though I haven't made any changes in my source code. My composer.json specifies "cartalyst/stripe": "1.0.*@dev". After my last composer update, which included an update to this package (but not an update to the symfony framework), my application can no longer find the class Cartalyst\Stripe\Stripe. The exception language is 'Uncaught PHP Exception Symfony\Component\Debug\Exception\ClassNotFoundException: "Attempted to load class "Stripe" from namespace "Cartalyst\Stripe". Did you forget a "use" statement for another namespace?" at [redacted]/app/cache/prod/appProdProjectContainer.php line 449'. All other vendor files seem to be loading fine, and I see a class called Stripe in namespace Cartalyst\Stripe in my cartalyst vendor directory. Any ideas of what might be going on here? I couldn't find any obvious changes in either the Stripe file or the composer.json for this repository that would trigger this issue, but maybe I'm missing something.
I am attempting to create a customer and am getting the following message:
Catchable fatal error: Argument 1 passed to Cartalyst\Stripe\Exception\Handler::__construct() must be an instance of GuzzleHttp\Exception\ClientException, instance of GuzzleHttp\Exception\RequestException given, called in C:\xampp\htdocs\vendor\cartalyst\stripe\src\Api\Api.php on line 156 and defined in C:\xampp\htdocs\vendor\cartalyst\stripe\src\Exception\Handler.php on line 73
My code is:
$apiKey = 'my_test_api_key';
$apiVersion = '2015-10-16';
$stripe = new Stripe($apiKey, $apiVersion);
$customer = $stripe->customers()->create([
'email' => $email, //[email protected]
'description' => $name, //Selma Tucker
]);
Hey guys,
i've been struggling with this for a couple hours now. Looks like the Stripe package is not included in your statis build.
http://packages.cartalyst.com/#!/stripe
returns nothing
When I run
composer update/installI get the following error.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package cartalyst/stripe could not be found in any version, there may be a typo in the package name.
Hi guys, is there a pagination example anywhere? The docs are inconclusive about it.
Just below this section it states you can use this to create pagination.
Stripe::customersIterator()
Doesn't state: a) how many is in the page b) which page your on c) how to query a specific pages?
I am about to integrate Stripe Connect in my Laravel 5.1 project.
I can't seem to find any documentation about making calls for managed accounts.
I can make calls for other accounts using my API. The documentation shows how this can be done like below...
(As CURL - With Headers)
curl https://api.stripe.com/v1/charges/{CHARGE_ID}/refunds \
-u {PLATFORM_SECRET_KEY}: \
-H "Stripe-Account: {CONNECTED_STRIPE_ACCOUNT_ID}" \
-d amount=1000
(Using Stripe PHP Lib)
\Stripe\Customer::create(
array("description" => "[email protected]"),
array("stripe_account" => CONNECTED_STRIPE_ACCOUNT_ID)
);
I'm trying to get this working using Laravel 5.2
I have tried the following, but seems to ignore the param.
Stripe::transfers()->all([],[
'stripe_account' => $stripe_id
]);
Many thanks!
Hi, do you have any guide on how to use the library? Thanks!!
I just wanted to let you know that the option parameter, "customer", is not available when doing a search for "events". However, in the docs located here https://cartalyst.com/manual/stripe/1.0#retrieve-all-events, it lists "customer" as an optional parameter.
Is guzzle 6 support planned?
It would be nice if you could exclude your tests and unused files from distributions. See: http://blog.madewithlove.be/post/gitattributes/
Working on a Stripe payment integration in several projects and it looks like the amount passed to Charges class POST processing is being converted from cents to dollars in case of currency being USD.
Upon further search, I noticed that Utility has an array of currencies to be excluded from conversion within the needsAmountConversion() method. However, USD is not in that array.
`
{
$hasCurrency = isset($parameters['currency']);
$currencies = [
'BIF', 'DJF', 'JPY', 'KRW', 'PYG',
'VND', 'XAF', 'XPF', 'CLP', 'GNF',
'KMF', 'MGA', 'RWF', 'VUV', 'XOF',
];
return ! $hasCurrency || ($hasCurrency && ! in_array($parameters['currency'], $currencies));
}
`
Is this something intentional? How would cents be sent for processing then?
If I want to send $0.50, shouldn't it be 50 for amount value? Amount field expects an integer ("A positive integer in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a 0-decimal currency) representing how much to charge the card. The minimum amount is $0.50 US or equivalent in charge currency.").
As of now, I added USD to the array of $currencies, but I'd appreciate any feedback on this.
HI Ive just created the new migration file which created a migration file named MigrationCartalystVersion1_0_0 but when I try to run the migration I get a error saying the file dose not exists and the error is in line 301 in vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php
The reason for the error its looking for a file named MigrationCartalystVersion100 So I tried to change the file name and class to remove the underscores but that did not help. The only way I could run it was to rename the file and class. When Looking at line 301 in the migrator class it only take the first 4 underscores so I dont know why this is happening.
:)
Stack Trace http://laravel.io/bin/jWNyk
When doing a call like this
$response = $stripe->fileUploads()->create($file,'identity_document');
$response
is a guzzle object instead of the fileUpload object.
Currently, in order to get the contents I must do
json_decode($response->getBody()->getContents());
Could you please release a version of this package with support for Guzzle 6?
Would it not be better to return an iterator for the pagination instead of trying to load everything into memory, which will end in a mess for very large data sets.
Hi!
Is there a possibility of passing a charge identifier to a CardErrorException object?
As it is now, a failed response returns a charge identifier as part of error array but is not being passed to an exception by the package.
Here's a logged body of the response:
[ "error" => [ "message" => "Your card was declined." "type" => "card_error" "code" => "card_declined" "charge" => "ch_18wLSEFL3W3Xf0ocVrORvj1iu" ] ]
I suppose it could be a fairly common scenario when an application would like to internally record a failed charge as well (since it gets created within Stripe) for the logging purposes.
I was looking into Stripe documentation regarding the Error response and it doesn't mention any additional parameters besides type, message, code, and param. But it does, in fact, return "charge" as part of failed charge response.
I'm planning on adding this to my cloned package, but wondering if this is something that can be added in the future release of this master package as well?
Best regards,
Alex
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.