我正在尝试将omnipay整合到一个网站中。我想创建一张卡的第一次,我遇到了这个问题:
Omnipay: InvalidRequestException "The source parameter is required"
这是我的代码:
$gateway = Omnipay::create('Stripe');
$gateway->setApiKey('sk_test_4IHf5iPTXVaZ8SF5GDcLTrqY');
$name_arr = explode(" ", $this->req['card-name']);
$card_data = [
'firstname' => $name_arr[0],
'surname' => $name_arr[1],
'expiryMonth' => $this->req['exp-month'],
'expiryYear' => $this->req['exp-year'],
'number' => $this->req['card-number'],
'email' => $client['email'],
'cvv' => $this->req['cvv']
];
$response = $gateway->createCard($card_data)->send();
我错过了什么或做错了什么? 谢谢!
答案 0 :(得分:0)
好的,对不起,我找到了解决方案!数据必须采用以下格式:
$card_data = ['card' =>[
'firstname' => $name_arr[0],
'surname' => $name_arr[1],
'expiryMonth' => $this->req['exp-month'],
'expiryYear' => $this->req['exp-year'],
'number' => $this->req['card-number'],
'cvv' => $this->req['cvc']
]];