由於某些原因,我沒有很好地實現Stripe API。我一直致力於創建客戶和收費標準,但是當我嘗試向現有客戶添加新卡時,我無法使其工作。PHP - 使用Stripe API創建卡的問題
下面是從API(很簡單)的基本實現,但它一直提供錯誤:
$customer = Stripe_Customer::retrieve($stripe_customer_id);
$customer->sources->create(array("card" => $token));
https://stripe.com/docs/api#create_card
錯誤日誌:
PHP Fatal error: Uncaught exception 'Stripe_InvalidRequestError' with message 'Missing required param: source' in/... /scripts/stripe/stripe_library/lib/Stripe/ApiRequestor.php:142
Stack trace:
0/... /scripts/stripe/stripe_library/lib/Stripe/ApiRequestor.php(254): Stripe_ApiRequestor->handleApiError('{\n "error": {\n...', 400, Array)
1/... /scripts/stripe/stripe_library/lib/Stripe/ApiRequestor.php(104): Stripe_ApiRequestor->_interpretResponse('{\n "error": {\n...', 400)
2/... /scripts/stripe/stripe_library/lib/Stripe/List.php(19): Stripe_ApiRequestor->request('post', '/v1/customers/c...', Array)
3/... /join/update-card-stripe.php(34): Stripe_List->create(Array)
4 {main} thrown in/... /scripts/stripe/stripe_library/lib/Stripe/ApiRequestor.php on line 142
任何幫助,將不勝感激。謝謝!
'缺少必需的參數:源',可能會給你一些東西.. – JonasCz 2015-04-01 14:28:49