4
客戶我使用Omnipay-stripe,我試圖用Create a customer下面的代碼:如何創建omnipay條紋
$gateway = Omnipay::create('Stripe');
$gateway->setApiKey('sk_test_....');
$token = $this->input->post('stripeToken'); // Code Igniter for $_POST['stripeToken']
$customer = $gateway->createCard(array(
"source" => $token,
"description" => "Example Customer")
);
echo 'Customer: ';
echo '<pre>';
print_r($customer);
echo '</pre>';
,我還沒有任何運氣。我檢查了CreateCardRequest,它說:「這實際上並沒有創建一個卡,它創建了一個客戶。」
我從解析API請求POST主體是:
key: "pk_test_...."
payment_user_agent: "stripe.js/6a67cf0"
card:
number: "************4242"
cvc: "***"
exp_month: "12"
exp_year: "2017"
和我的迴應的身體:
id: tok_15v8exD17chNNDaoGMbDebAL
livemode: false
created: 1429889047
used: false
object: "token"
type: "card"
card:
id: card_15v8exD17chNNDao92nWH2rP
object: "card"
last4: "4242"
brand: "Visa"
funding: "credit"
exp_month: 12
exp_year: 2017
country: "US"
name: null
address_line1: null
address_line2: null
address_city: null
address_state: null
address_zip: null
address_country: null
cvc_check: "unchecked"
address_line1_check: null
address_zip_check: null
dynamic_last4: null
client_ip: "x.x.x.x"
感謝。
感謝您的回覆。我會檢查一下。我也注意到https://github.com/thephpleague/omnipay-stripe/pull/13所以也許客戶支持即將到來?儘管現在我可能最終會使用stripe api。 – Rob
@Rob:有趣的公關,我想知道爲什麼這還沒有合併。在V3客戶管理中可能會這樣讀,但如果我是你,我不會等待。無論如何,您必須抽象該庫,所以值得留意,以便稍後切換。 – hakre