Comments (6)
Hello, i already found out how to make this
$tra = $gateway->updateCustomer(array('customerReference' => $clientID, 'card' => $formData));
$response = $tra->send();
if ($response->isSuccessful()) {
echo $response->getCustomerReference()." ___ ".$response->getCardReference();
return $response->getCardReference();
} else {
echo $response->getMessage(); //failed
}
return null;
But the problem now is that getCardReference() is giving the customer reference
echo $response->getCustomerReference()." ___ ".$response->getCardReference();
//cus_80wgOIqnxL5VvB ___ cus_80wgOIqnxL5VvB
from omnipay-stripe.
This is what works for me and I believe to be the correct flow:
$response = $gateway->createCustomer(array(
'description' => 'Test Customer',
'email' => '[email protected]',
))->send();
if ($response->isSuccessful()) {
echo "Gateway createCustomer was successful.\n";
// Find the card ID
echo "\nfetch customer ID\n=================\n";
$customer_id = $response->getCustomerReference();
echo "Customer ID = " . $customer_id . "\n";
} else {
echo "Gateway createCustomer failed.\n";
echo "Error message == " . $response->getMessage() . "\n";
}
The createCard request now follows the above call. You do not need to call updateCustomer() to add a card to a customer, instead you should use createCard()
Note that this is just a cut and paste from the code in the CreateCardRequest class docblock, it's all documented there.
$new_card = new CreditCard(array(
'firstName' => 'Example',
'lastName' => 'Customer',
'number' => '5555555555554444',
'expiryMonth' => '01',
'expiryYear' => '2020',
'cvv' => '456',
'email' => '[email protected]',
'billingAddress1' => '1 Lower Creek Road',
'billingCountry' => 'AU',
'billingCity' => 'Upper Swan',
'billingPostcode' => '6999',
'billingState' => 'WA',
));
// Do a create card transaction on the gateway
$response = $gateway->createCard(array(
'card' => $new_card,
'customerReference' => $customer_id,
))->send();
if ($response->isSuccessful()) {
echo "Gateway createCard was successful.\n";
// Find the card ID
$card_id = $response->getCardReference();
echo "Card ID = " . $card_id . "\n";
}
from omnipay-stripe.
Its not working also by this way.
$formInputData = array(
'number' => $formData['number'],
'expiryMonth' => $formData['expiry_month'],
'expiryYear' => $formData['expiry_year'],
'cvv' => $formData['cvv'],
);
$new_card = new CreditCard($formInputData);
$response = $gateway->createCard(array(
'card' => $new_card,
'customerReference' => $clientID,
))->send();
What stripe revived
source:
object: "card"
number: "************4242"
exp_month: "6"
exp_year: "2019"
cvc: "***"
name: ""
address_line1: ""
address_line2: ""
address_city: ""
address_zip: ""
address_state: ""
address_country: ""
email: ""
And this is the error
error:
type: "invalid_request_error"
message: "Received unknown parameter: email"
param: "card[email]"
from omnipay-stripe.
@delatbabel
I've just tried the full createCard example you provided and I get the error:
error: type: "invalid_request_error" message: "Received unknown parameter: email" param: "card[email]"
According to the docs: https://stripe.com/docs/api#create_card email is not a valid parameter for this call.
Omission of the email parameter in the CreditCard data does not work. Only way I've found to prevent this happening is to comment out:
$data['email'] = $card->getEmail();
on the last line of getCardData within AbstractRequest
from omnipay-stripe.
Are you sure you're running the latest code? The card[] parameters including the card[email] parameter was deprecated some versions ago.
Here is my card data as an example:
$card = new CreditCard(array(
'firstName' => 'Example',
'lastName' => 'Customer',
'number' => '4242424242424242',
'expiryMonth' => '01',
'expiryYear' => '2020',
'cvv' => '123',
'email' => '[email protected]',
'billingAddress1' => '1 Scrubby Creek Road',
'billingCountry' => 'AU',
'billingCity' => 'Scrubby Creek',
'billingPostcode' => '4999',
'billingState' => 'QLD',
));
The call to createCard works like this. Assume that $customer_id has been set by a previous call to createCustomer():
$createCard = $gateway->createCard(array(
'card' => $card,
));
if (! empty($customer_id)) {
$createCard->setCustomerReference($customer_id);
}
$createCardData = $createCard->getData();
echo "Gateway createCard request data == " . print_r($createCardData, true) . "\n";
The request data looks like this:
Gateway createCard request data == Array
(
[source] => Array
(
[object] => card
[number] => 4242424242424242
[exp_month] => 1
[exp_year] => 2020
[cvc] => 123
[name] => Example Customer
[address_line1] => 1 Scrubby Creek Road
[address_line2] =>
[address_city] => Scrubby Creek
[address_zip] => 4999
[address_state] => QLD
[address_country] => AU
[email] => [email protected]
)
)
There is no card parameter in the above at all, and no card[email] parameter either.
from omnipay-stripe.
Hi,
Facing the same issue here ! You don't have a card
parameter but you have an email
key in your source
parameter which is basically the same.
It's reference in a fork repo's issue.
Could someone look into this ?
from omnipay-stripe.
Related Issues (20)
- Redirect to checkout HOT 1
- Unable to send Stripe request HOT 1
- PHP 8 support ? HOT 1
- SetupIntents - release?
- undefined method getPaymentIntentReference() HOT 2
- Stripe not Receiving Customer Info HOT 3
- get POST data on isRedirect() HOT 1
- ListPaymentIntentsRequest
- `transactionFee` parameter does nothing
- Refund API method not implemented at all when using SCA
- New work not tagged or documented?
- Clarify when to use purchase/authorize/capture and confirm in README
- No release since fix was merged HOT 2
- Checkout gateway purchase request issues
- As per Indian regulations, export transactions require a customer name and address.
- can't use it with klarna or sofort HOT 1
- How to add local stripe other payment method ? HOT 1
- Stripe Payment Intents are not working. HOT 3
- Stripe confirming 3Ds PaymentIntent (with a failed authorization) gives wrong error HOT 1
- CreatePaymentMethodRequest - should billing details be attached to having a card?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from omnipay-stripe.