thephpleague / omnipay-stripe Goto Github PK
View Code? Open in Web Editor NEWStripe driver for the Omnipay PHP payment processing library
License: MIT License
Stripe driver for the Omnipay PHP payment processing library
License: MIT License
I'm getting this error anytime I try installing via composer. This is the error I get:
[Composer\Downloader\TransportException]
The "https://api.github.com/repos/omnipay/stripe/zipball/e56ad2d1a7a50bacca
727e1363aca44e35cf2573" file could not be downloaded (HTTP/1.1 404 Not Found)
This also happens for TargetPay, but that's a lesser priority.
Hi, I use this library. I think that you have some mistakes. For example, file CreatePlanRequest.php
, function getData()
. Code:
$data = array(
'id' => $this->getId(),
'amount' => $this->getAmount(),
'currency' => $this->getCurrency(),
'interval' => $this->getInterval(),
'name' => $this->getName() );
need change at:
$data = array(
'id' => $this->getId(),
'amount' => $this->getAmount(),
'currency' => $this->getCurrency(),
'interval' => $this->getInterval(),
'product' => [
'name' => $this->getName()
]);
The current examples for Omnipay-Stripe uses either a Credit Card object or a token to handle the processing, but Stripe advises the use of sources instead of tokens. Is there an official method of using a source object from Stripe's JS library to do processing in Omnipay?
I'm setting the currency parameter, however I'm still receiving this error
The currency parameter is required
$pw = new PaymentWrapper( 'Stripe' );
...
$pw->initialize($processorParams);
$pw->setCreditCard([
...
]);
// Determine total order cost
$amount = 4000.00;
$currency = 'CAD';
$pw->purchase( $amount, $currency );
$pw->processResponse();
is this a functionality that people want, i have a use case for it and can submit a PR
It appears that the Stripe Plugin doesn't support 3D secure cards.
https://stripe.com/docs/testing#3ds-cards
https://stripe.com/docs/sources/three-d-secure
Looking at other plugins such as thephpleague/omnipay-sagepay appear to have this support.
Is there support for adding in such functionality?
Should be returning data->source->id, currently returns NULL
It's really important for our accounts dept to be able to easily identify transactions in Stripe by customer email but the Omnipay Stripe implementation doesn't appear to support passing on receipt_email or even customer email (if we're using a token and not passing card details directly).
I notice there some discussion pertaining to this previously but it didn't appear to go anyway... any thoughts?
I only use Omnipay for Stripe at the moment but I've noticed that when a transaction has failed $response->getTransactionReference() returns null, obviously you'd expect it to always return the transaction id regardless.
The transaction id is available in the response from Stripe. I'm currently getting it by doing the following:
$transData = $response->getData();
if (isset($transData['error']['charge'])) {
return $transData['error']['charge'];
}
Is this is expected behaviour? If it is then should it be changed? What are your thoughts?
As described at https://stripe.com/docs/sources/customers
$customer = \Stripe\Customer::retrieve("cus_***");
$customer->sources->create(array("source" => "src_***"));
Could I make the same via Omnipay?
Can't be installed with omnipay dev branch.
Can you please provide a dev-branch with omnipay/common ~ 3
Thanks
I know how to create customer, but i am not find way to after creating customer create new card and associate with the customer.
Someone can help me? thank you
Create customer:
$tra = $gateway->createCustomer(array('description' => '14', 'metadata' => ['foo' => 'bar']));
$response = $tra->send();
if ($response->isSuccessful()) {
// payment was successful: update database
echo $response->getCustomerReference();
} elseif ($response->isRedirect()) {
// redirect to offsite payment gateway
$response->redirect();
} else {
// payment failed: display message to customer
echo $response->getMessage();
}
create card
$formData = array('number' => '4242424242424242', 'expiryMonth' => '6', 'expiryYear' => '2016', 'cvv' => '123');
$tra = $gateway->createCard(array('card' => $formData));
Hi,
I'm looking for a way to update a charge with metadata for a destination charge (https://stripe.com/docs/api#update_charge) and it's not possible at the moment.
Would anyone be kind enough to support this as well please?
-E
Hi there.
Just got few "warnings" while installing your package, basically saying:
Package guzzle/common is abandoned, you should avoid using it. Use guzzle/guzzle instead.
Package guzzle/stream is abandoned, you should avoid using it. Use guzzle/guzzle instead.
Package guzzle/parser is abandoned, you should avoid using it. Use guzzle/guzzle instead.
Package guzzle/http is abandoned, you should avoid using it. Use guzzle/guzzle instead.
As you're requiring: guzzle/http https://packagist.org/packages/guzzle/http
Probably not a big issue just yet, but it may be worth considering a switch ;)
Thanks.
Currently Stripe accept a TVA amount (ex: 20%) but the library doesn't provide a way to send the value.
The Stripe provider throws an exception if the the server returns that one of the card details was invalid.
According to the docs, isSuccessful() should return false and $response->getMessage() should return the string that should be displayed to the user.
Is there going to be, or could there be support for "payouts" added in sometime soon?
https://stripe.com/docs/api#create_payout
Im going to doing a job where I need to act as a "market place" and vendors get money paid to them where we middle man the transaction. The vendors will register their bank account information with us and then when purchases are made from their products the money will be transferred to their bank account.
This used to be part of the transfers object:
https://stripe.com/docs/transfer-payout-split
On April 6, 2017, Stripe is splitting the /v1/transfers resource into /v1/transfers and /v1/payouts. This is a versioned change -- your existing integrations don't need to change.
Since Stripe was launched, we've used the word transfer to mean moving money out of Stripe and into your bank account or debit card. But when Connect was launched years later, we co-opted that term to also mean moving money between a platform and its connected accounts.
This ultimately turned out to be confusing. These are conceptually different flows of funds as they apply to a business. This made it difficult to document transfers, and also bloated the /v1/transfers API because the fields needed to support each flow of funds were different.
With the new version of 2017-04-06:
Payouts will mean moving money from Stripe to your bank account or debit card and will be represented by /v1/payouts.
Transfers will mean moving money between Stripe accounts as part of Connect and will be represented by /v1/transfers.
Relative to the legacy /v1/transfers resource, the new /v1/transfers resource won't have these fields:
method - this only applies to payouts.
status - this only applies to payouts.
type - this only applies to payouts.
bank_account - this only applies to payouts.
card - this only applies to payouts.
failure_message - this only applies to payouts.
failure_code - this only applies to payouts.
description - description was confusing because it applied to the transfer but not the resultant payment on the connected account. Use metadata to attach additional information to a transfer.
application_fee - application_fee is no longer necessary. See Connect destination charges.
Relative to the legacy /v1/transfers, the new /v1/payouts resource won't have these fields:
reversals - payouts can now be simply canceled.
reversed - refer to the payout status.
application_fee - this only applies to legacy transfers.
destination_payment - this only applies to transfers.
source_transaction - this only applies to legacy transfers.
description - description was removed because it didn't provide enough value. Use metadata to attach additional information to a payout.
On the /v1/payouts resource, the date field was renamed to arrival_date.
To send a payout to your default bank account or debit card, instead of including the parameter destination=default_for_currency, simply omit the destination entirely.
Canceling a payout is now done via POST /v1/payouts/:id/cancel. The balance transaction resulting from a cancellation is available via the cancellation_balance_transaction field on the payout. The status of a canceled payout is canceled.
When creating a transfer, you can now only use a charge as the source_transaction. Previously, it was possible to use any transaction (such as an application fee, or an adjustment) as a source_transaction. This did not mesh well with the intended use case of tagging outgoing transfers with the incoming source of funds, so this is no longer supported on the new API version.
Payouts now generate these events: payout.created, payout.failed, payout.reversed, payout.paid, payout.updated, which are the equivalent of the legacy transfer.* events.
Transfers no longer generate these events: transfer.paid and transfer.failed.
Balance transactions can have these types as they relate to payouts: type โ {payout, payout_failure, payout_cancel}
Balance transactions can have these types as they relate to transfers: type โ {transfer, transfer_refund}
Fields on the Account API were renamed:
transfers_enabled -> payouts_enabled
transfer_schedule -> payout_schedule
transfer_statement_descriptor -> payout_statement_descriptor
Transfers to deprecated Recipients API (link) are no longer represented on this version of the API. Use a legacy API version to access any transfers to recipients that you may have.
This is a followup to my comments on #88
In your README.md you have used token
as a parameter name, is there any reason this cannot be source
to prevent confusion. I had to search through the code to ensure the token
was being changed to source
as per Stripes Documentation
Maybe the best choice is official SDK. Omnipay's document is so bad,many function can not find.
Hello,
We can't create a subscription with a coupon in the parameters. Settings the coupon as a parameter in the request allow you to set a discount on a newly created subscription as it is stated in the documentation.
We should update the CreateSubscriptionRequest and add getter and setter for the coupon as follow :
`/**
* Set the coupon
*
* @param $value
* @return \Omnipay\Common\Message\AbstractRequest|CreateSubscriptionRequest
*/
public function setCoupon($value)
{
return $this->setParameter('coupon', $value);
}
/**
* Set the plan
*
* @param $value
* @return \Omnipay\Common\Message\AbstractRequest|CreateSubscriptionRequest
*/
public function setPlan($value)
{
return $this->setParameter('plan', $value);
}
`
And also add a condition the getData() method to add the coupon in the request data like this :
if($this->parameters->has('coupon')) { $data['coupon'] = $this->getCoupon(); }
I will try to make a proper pull request
Thank you
This is taken care of in purchase()
but neglected in CreatePlanRequest
array(1) { ["error"]=> array(3) { ["type"]=> string(21) "invalid_request_error" ["message"]=> string(23) "Invalid integer: 552.82" ["param"]=> string(6) "amount" } }
Hey guys,
I'm issuing a payment with the following options array:
$options = [
'amount' => '10.00',
'cardReference' => 'cus_REAL_REFERENCE',
'currency' => 'GBP'
];
$gateway->purchase($options)->send();
and here's the request as shown in the Stripe back-end.
{
"amount": 1000,
"currency": "gbp",
"description": "",
"capture:" true,
"customer": "cus_REAL_REFERENCE"
}
As you can see, the 10.00 is being interpreted as 1000 GBP. Am I doing something wrong? I've tried strings and floats as the amount parameter.
Hi there,
I've tried both createCustomer and createCard with no customer attached to try and retrieve a customer ID and card ID. The code seems to only return the customer ID for both fields.
$sendData = [
'card' => new OmniPayCreditCard( $cardData->all() ), // OmniPayCreditCard is just a renamed instance of the Omnipay CreditCard object.
];
\Log::debug([ __METHOD__ => $sendData]);
$response = $this->gateway->createCustomer($sendData)->send();
if ($response->isSuccessful()) {
$customer_id = $response->getCustomerReference();
\Log::debug([ __METHOD__ => $customer_id]);
$card_id = $response->getCardReference();
\Log::debug([ __METHOD__ => $card_id]);
return [
'card_id' => $card_id,
'customer_id' => $customer_id,
];
}
When the code returns, the $customer_id and $card_id variables are identical, and appear to contain the customer ID.
Hello, I'm using this library and so far it has been great. But I could not find a way to make a direct charge. The format of a direct charge asks for the Stripe-Account
header like:
curl https://api.stripe.com/v1/charges \
-u sk_test_hhCDjLJSkdUWHAMeYWT29HZg: \
-d amount=1000 \
-d currency=gbp \
-d source=tok_visa \
-d application_fee=123 \
-H "Stripe-Account: {CONNECTED_STRIPE_ACCOUNT_ID}"
Am I missing something here or this is something that have to be done yet?
Hello,
It's possible to include the functionnality : "Retrieve a transfer"
https://stripe.com/docs/api/curl#retrieve_transfer
If you want i can contribute to do it.
Thanks
It would be nice to be able to update just the card expiry date rather than only supporting full credit card details. Stripe supports this:
https://stripe.com/docs/api#update_card
I'd be happy to send a pull request but would like to clarify the best way to implement it. Should it be a new message request type (eg. UpdateCardExpiryRequest) and switch the request used in updateCard() based on the presence of the card id parameter (eg. card_id)?
Hello, i cant set the trial_end
or trial_period_days
.
Any idea when you are going to implement it?
https://stripe.com/docs/api#create_subscription
thanks :)
As the title say. There is a way to fetch a single plan for now but none to retrieve a list of them.
Would that be possible ?
Also true for setPlanId().
Right now the 'plan' parameter is not set when passing the 'plan' key to
->updateSubscription(['plan' => '...'])
but it does work when passing the key as 'planId'.
Also CreateSubscriptionRequest has getPlan(0 and setPlan().
Is this expected behaviour?
Stripe doesn't requre CVV (for instance, for recurring transactions).
But if it's set, it's required to be non-empty.
I've tried passing the extra parameter 'source' to the function createCustomer and setting it to the token returned by Stripe 'Checkout', as shown here, but it's not sent. Then I've read here that omnipay-stripe doesn't support extra parameters.
Can this work around method be used instead:
$response = $gateway->createCustomer(array( 'description' => 'Test Customer', 'email' => '[email protected]', )); $data = $request->getData(); $data['source'] = 'tok_1234oVJjPoOHXFyktY79rGyk'; $response = $request->sendData($data);
It seems to work.
Would be great if this function could be extended to support the 'source' parameter.
Once the customer has been created the token can't be re-used for the purchase so I want to use the customer_id instead of the token in the purchase request, however I run into the issue explained here. The solution described seems to involve creating a card, but I don't want to handle any card data for PCI compliance reasons.
It works if I only use the token in the purchase request and not when creating the customer, but I want to create a susbscription and to do that I believe the customer first requires a source/card.
https://stripe.com/docs/api#idempotent_requests
\Stripe\Charge::create(array(
"amount" => 400,
"currency" => "usd",
"source" => "tok_16WQ672eZvKYlo2CBqe851Hy", // obtained with Stripe.js
"description" => "Charge for [email protected]"
), array(
"idempotency_key" => "96rNdGLJrIvJan5X",
));
which comes out as a header Idempotency-Key: 96rNdGLJrIvJan5X
I don't know exactly where this fits in with the various other omni-pay drivers, but it would be nice to be able to print, on the customer receipt / thank you page, for example, the bank reply; something like
Message: Payment Complete. // $charge['data']['outcome']['seller_message']
Status: approved_by_network // $charge['data']['outcome']['network_status']
Type: authorized // $charge['data']['outcome']['type']
I was thinking of adding a getOutcome method for this purpose, which would be used on charge
objects. Any reason why the outcome
sub-node of $data
has no corresponding getter method?
There's change in Stripe API https://stripe.com/docs/upgrades#2018-08-23. So if we want to cancel at the period end we need to send UPDATE request instead of DELETE
Hi there,
I'm getting this error in the context of the Craft Commerce Plugin, on the last step of checkout.
The data I feed to the form is correct (a valid Stripe token), and it works fine with the Test API Keys. So the error only happens when working with the Live Keys.
https://github.com/thephpleague/omnipay-stripe/blob/master/src/Message/Response.php#L308
Here's an example of the data I get using Stripe.js (I'm "blurring" the token because real card)
{
id: "tok_19J5meHOW6ChjHQ7djwPxxxx",
object: "token",
card: Object,
client_ip: "83.32.118.217",
created: 1479926872,
livemode: true,
type: "card",
used: false
}
Any ideas?
Please let me know If I should be asking somewhere else.
Thank you!
As I work with Stripe Connect there are to way of creating payments
https://stripe.com/docs/connect/payments-fees
Currently lib supports only direct charge with application fee. It would be great to support destination parameter. Also source parameter seems to be not supported.
Is it possible to add support of different charging types ?
From the Stripe API reference:
... If you also pass a customer ID, the source must be the ID of a source belonging to the customer. Otherwise, if you do not pass a customer ID, the source you provide must either be a token, like the ones returned by Stripe.js, or a dictionary containing a user's credit card details, with the options described below.
(Inference: you cannot pass a customer ID and the customer's credit card details, you must either pass a customer ID and a card token, or a customer ID without a card token, or card data without a customer ID).
https://stripe.com/docs/connect/destination-charges#collecting-platform-fees
$charge = \Stripe\Charge::create(array(
"amount" => 1000,
"currency" => "usd",
"source" => "tok_visa",
"destination" => array(
"amount" => 877,
"account" => "{CONNECTED_STRIPE_ACCOUNT_ID}",
),
));
Noticed there's no support for this in this library. If there is a way, please direct me to the correct documentation
related: #80
I had a dive into the CreateCustomerRequest class and it doesn't look as though it is currently possible to add the optional shipping
parameter into your request. Is this possible or are there plans to make this possible?
How hard would it be to add description and metadata support to this?
I'm new to omnipay.
Are we able to add description while using transfer group?
I actually added the description but no luck. Please help.
$data = array(
'amount' => $this->getAmountInteger(),
'currency' => strtolower($this->getCurrency()),
'destination' => $this->getDestination(),
);
It is possible to create cards (which then creates a Stripe customer) but after the customer is created, a transaction using the customer ID as the token isn't successful. Passing in the parameter 'customer' instead of token results in a card error being thrown stating that card details need to be passed.
Ideally, you should be able to pass a customer id and perform the transaction according to Stripe's payment API using the customer data instead of a token.
When trying to process payments for new Stripe accounts, we now receive the error:
Stripe no longer supports API requests made with TLS 1.0. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at https://stripe.com/blog/upgrading-tls.
I'm about to start to integrate Stripe in my site. I would like to use the new object PaymentIntent
( https://stripe.com/docs/payments/payment-intents ) instead of Source
.
This new object has a series of new features and it support 3DS2.
Does this library supports PaymentIntent
Should the setting of the auth header in AbstractRequest::send()
:
https://github.com/thephpleague/omnipay-stripe/blob/master/src/Message/AbstractRequest.php#L194-L197
Be moved into the top of sendData()
, as to remove the additional param for headers?
The additional header param doesn't meet the request interface: https://github.com/thephpleague/omnipay-common/blob/master/src/Common/Message/RequestInterface.php#L51
It also looks like the original intent of splitting send() and sendData() was to allow the full modification of the request body, and not the request authentication:
thephpleague/omnipay#162
Right now this gateway implementation is breaking the interface with that additional $headers
param in sendData().
Thoughts? Can we move the setting of the auth header into the top of the sendData()
? Will make PR after feedback.
There is a subscription example?
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.