大家好,所以我正在使用他们的库使用支付方法IDEAL创建条带源,我偶然发现了这个不寻常的错误。
致命错误:来自API请求的/home/ubuntu/workspace/ideal/stripe-php-4.13.0/lib/ApiRequestor.php:110中带有'无效散列'消息的未捕获异常'Stripe \ Error \ InvalidRequest''第110行/home/ubuntu/workspace/ideal/stripe-php-4.13.0/lib/ApiRequestor.php中的req_S1FAI6czFIggdC'
只有当我尝试在下面的owner
对象下添加这行代码时才会出现该错误(请参阅下面我的实际代码),这会导致错误甚至在正确的地方添加。
"address" => "Test Adress"
实际代码:
\Stripe\Stripe::setApiKey("test_key_here");
$source = \Stripe\Source::create(array(
"type" => $type,
"currency" => $currency,
"amount" => $amount,
"statement_descriptor" => $product,
"owner" => array(
"phone" => $phone,
"email" => $email,
"name" => $name,
"address" => "Test Adress" //this causes the error
),
"redirect" => array (
"return_url" => $returnUrl
),
"ideal" => array(
"bank" => $bank
)
));
答案 0 :(得分:6)
这里的问题是address
不是街道地址,它是一个散列,需要多个子参数(第1行和第2行,城市等),如下所示:{{3} }
代码应该是这样的:
$source = \Stripe\Source::create(array(
"type" => $type,
"currency" => $currency,
"amount" => $amount,
"statement_descriptor" => $product,
"owner" => array(
"phone" => $phone,
"email" => $email,
"name" => $name,
"address" => array(
"line1" => "Test line1",
"city" => "My City",
"postal_code" => "90210",
"state" => "CA",
),
"redirect" => array (
"return_url" => $returnUrl
),
"ideal" => array(
"bank" => $bank
)
));