Forum
array_merge() error on Stripe checkout process
Hey there,
Just integrating Stripe payments, and getting the following two errors after perch_shop_checkout() is called.
Warning: array_merge(): Argument #1 is not an array in /Users/Gaz/Sites/dev/shop/perch/addons/apps/perch_shop/lib/PerchShop_Base.class.php on line 80
Warning: Cannot modify header information - headers already sent by (output started at /Users/Gaz/Sites/dev/shop/perch/addons/apps/perch_shop/lib/PerchShop_Base.class.php:80) in /Users/Gaz/Sites/dev/shop/perch/core/lib/PerchUtil.class.php on line 194
Here is my checkout code, which is nothing complicated yet:
<?php
if (perch_member_logged_in() && perch_post('stripeToken')) {
// your 'success' and 'failure' URLs
$return_url = '/shop/payment/stripe';
$cancel_url = '/shop/payment/error';
perch_shop_checkout('stripe', [
'return_url' => $return_url,
'cancel_url' => $cancel_url,
'token' => perch_post('stripeToken')
]);
} else {
perch_layout('global/header');
perch_shop_payment_form('stripe');
perch_layout('global/footer');
}
Any idea what could be causing this?
Diagnostic report:
Perch Runway: 2.8.29, PHP: 5.6.10, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29), perch_shop_orders (1.0.3), perch_shop_products (1.0.3), perch_shop (1.0.3), perch_members (1.5)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_members', 'perch_shop' );
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/Gaz/Sites/dev/shop/perch
PERCH_CORE: /Users/Gaz/Sites/dev/shop/perch/core
PERCH_RESFILEPATH: /Users/Gaz/Sites/dev/shop/perch/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: No
HTTP_HOST: shop.dev.local
DOCUMENT_ROOT: /Users/Gaz/Sites/dev/shop
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Thanks!
Can you try clicking Save on the products you're purchasing?
Yep, that fixed it. Why was it necessary to re-save those products?
Cheers for your help though. I know it's a common trouble-shooting solution, but I didn't expect that to help for some reason.
Were these new products that had only been saved once?
Yeah, I created them as tests then moved onto seeing if I could nail the checkout process before doing any proper product-creation.
Ok, great. I'll fix that flow in a future update.