Check if Stripe card is set
This commit is contained in:
parent
3510f749c8
commit
47137e60df
1 changed files with 5 additions and 2 deletions
|
|
@ -151,14 +151,17 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||
protected function creatingPaymentMethod($paymentMethod)
|
||||
{
|
||||
$data = $this->tokenResponse;
|
||||
$source = false;
|
||||
|
||||
if (!empty($data['object']) && ($data['object'] == 'card' || $data['object'] == 'bank_account')) {
|
||||
$source = $data;
|
||||
} elseif (!empty($data['object']) && $data['object'] == 'customer') {
|
||||
$sources = !empty($data['sources']) ? $data['sources'] : $data['cards'];
|
||||
$source = reset($sources['data']);
|
||||
} else {
|
||||
$source = !empty($data['source']) ? $data['source'] : $data['card'];
|
||||
} elseif (!empty($data['source'])) {
|
||||
$source = $data['source'];
|
||||
} elseif (!empty($data['card'])) {
|
||||
$source = $data['card'];
|
||||
}
|
||||
|
||||
if ( ! $source) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue