Forum
Stripe Test Mode Reloads Checkout Page
I'm working my way through setting up Perch Shop. I'm trying to integrate Stripe, however I cannot get past the payment page. When hitting 'pay with card' and entering test payment details, the pop up plays the confirm animation however the page simply refreshes afterwards, it doesn't go to either the $return_url, nor the $cancel_url.
The tokens are created on the stripe control panel, however no order is created within the Perch Shop.
Is there a step I'm missing somewhere?
Checkout page:
<?php
perch_shop_payment_form('stripe');
?>
<?php
if (perch_member_logged_in() && perch_post('stripeToken')) {
// your 'success' and 'failure' URLs
$return_url = '/payment/stripe';
$cancel_url = '/payment/went/wrong';
perch_shop_checkout('stripe', [
'return_url' => $return_url,
'cancel_url' => $cancel_url,
'token' => perch_post('stripeToken')
]);
}
?>
My Diagnostics:
Perch Runway LTM: 3.1.2
Production mode: Production (100)
Installed apps: content (3.1.2), assets (3.1.2), categories (3.1.2), perch_shop_orders (1.2.5), perch_shop_products (1.2.5), perch_shop (1.2.5), perch_members (1.6.2), pipit_catalog (1.2.0)
DB driver: PDO
DB tables: perch3_backup_plans (0), perch3_backup_resources (0), perch3_backup_runs (0), perch3_categories (2), perch3_category_counts (0), perch3_category_sets (1), perch3_collection_index (24), perch3_collection_items (5), perch3_collection_revisions (2), perch3_collections (1), perch3_content_index (0), perch3_content_items (0), perch3_content_locks (0), perch3_content_regions (15), perch3_members (0), perch3_members_forms (0), perch3_members_member_tags (0), perch3_members_sessions (0), perch3_members_tags (0), perch3_menu_items (13), perch3_navigation (0), perch3_navigation_pages (0), perch3_page_routes (3), perch3_page_templates (15), perch3_pages (11), perch3_resource_log (0), perch3_resource_tags (0), perch3_resources (0), perch3_resources_to_tags (0), perch3_settings (47), perch3_shop_addresses (0), perch3_shop_admin_index (30), perch3_shop_brands (1), perch3_shop_cart (7), perch3_shop_cart_data (8), perch3_shop_cart_items (2), perch3_shop_countries (250), perch3_shop_currencies (152), perch3_shop_customers (0), perch3_shop_emails (1), perch3_shop_index (2178), perch3_shop_option_values (10), perch3_shop_options (4), perch3_shop_order_items (0), perch3_shop_order_promotions (0), perch3_shop_order_statuses (9), perch3_shop_orders (0), perch3_shop_orders_meta (1), perch3_shop_product_files (0), perch3_shop_product_option_values (9), perch3_shop_product_options (4), perch3_shop_product_tags (0), perch3_shop_products (41), perch3_shop_promotions (0), perch3_shop_sales (0), perch3_shop_search (3), perch3_shop_shipping_zone_countries (1), perch3_shop_shipping_zones (1), perch3_shop_shippings (1), perch3_shop_tax_exhibits (0), perch3_shop_tax_group_rates (1), perch3_shop_tax_groups (1), perch3_shop_tax_locations (1), perch3_shop_tax_rates (1), perch3_shop_variants (122), perch3_user_passwords (1), perch3_user_privileges (70), perch3_user_role_buckets (0), perch3_user_role_privileges (2), perch3_user_roles (2), perch3_users (1)
Users: 1
App runtimes:
<?php
$apps_list = [
'content',
'categories',
'perch_members',
'perch_shop',
];
Editor plug-ins:
H1: bb75dac6e6c9125d72b5e84a59602842
L1: 98c2516a5052f9231f1aec4cbc572b17
F1: 3b606135b33e6a102526838f4152a807
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 0
content_collapseList: 1
lang: en-gb
installedAt: 3.0.14
update_3.0.14: done
headerColour: rgb(54,54,54)
headerScheme: dark
update_runway_3.0.14: done
latest_version:
on_sale_version: 3.1.2
perch_shop_update: 1.2.5
perch_members_login_page: /members/login.php?r={returnURL}
perch_shop_price_tax_mode: inc
perch_shop_trade_price_tax_mode: exc
perch_shop_site_url: https://
perch_shop_product_url: /shop/products/{slug}
perch_shop_default_currency: 47
perch_shop_reporting_currency: 47
perch_shop_invoice_number_format: Invoice%d
dashboard: 0
sidebar_back_link: 0
hide_pwd_reset: 0
keyboardShortcuts: 0
siteOffline: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
content_skip_region_list: 0
assets_restrict_buckets: 0
pipit_catalog_productsSet: 1
pipit_catalog_lowStok:
pipit_catalog_thumbW:
pipit_catalog_thumbH:
pipit_catalog_thumbDensity:
pipit_catalog_hideCat: 0
pipit_catalog_hideBrand: 0
pipit_catalog_hideStatus: 1
pipit_catalog_hideSale: 1
pipit_catalog_hideShipping: 1
pipit_catalog_hideSearch: 0
pipit_catalog_hideProductImages: 0
pipit_catalog_displaySalePrices: 0
pipit_catalog_thumbCrop: 0
perch_members_update: 1.4
update_runway_3.1.2: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_SITEPATH: /Volumes/Jobs/Websites/Perch_Shop_4/site-folder
PERCH_SCHEDULE_SECRET: 4iFCTmAcmEYTNaVH
PERCH_DB_USERNAME: root
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: perchshop4
PERCH_DB_PREFIX: perch3_
PERCH_EMAIL_FROM: my@emailaddress.co.uk
PERCH_EMAIL_FROM_NAME: Tony Astley
PERCH_LOGINPATH: /perch
PERCH_PATH: /Volumes/Jobs/Websites/Perch_Shop_4/site-folder/perch
PERCH_CORE: /Volumes/Jobs/Websites/Perch_Shop_4/site-folder/perch/core
PERCH_RESFILEPATH: /Volumes/Jobs/Websites/Perch_Shop_4/site-folder/perch/resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_TZ: UTC
PERCH_DEBUG: 1
PERCH_RUNWAY: 1
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_ASSET_VERSION: 6738d5d5f5664f7c5e34
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /Volumes/Jobs/Websites/Perch_Shop_4/site-folder/perch/templates
PERCH_TEMPLATE_FILTERS:
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_XHTML_MARKUP:
PERCH_RWD: 1
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_DEFAULT_BUCKET: default
PERCH_TRANSLATION_ASSIST:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_PRIV_ASSIST:
PERCH_CUSTOM_EDITOR_CONFIGS:
PERCH_ENABLE_EXIF: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SHOP_VERSION: 1.2.5
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown
Hosting settings
PHP: 7.1.12
Zend: 3.1.0
OS: Darwin
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $
MySQL server: 5.6.38
Free disk space: 23.44 GB
Extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, intl, json, ldap, mbstring, session, standard, mysqlnd, PDO, pdo_mysql, pdo_sqlite, Phar, posix, readline, Reflection, mysqli, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, cgi-fcgi, imap, gettext, mcrypt, pgsql, pdo_pgsql, igbinary, memcached
GD: Yes
ImageMagick: No
PHP max upload size: 32M
PHP max form post size: 32M
PHP memory limit: 256M
Total max uploadable file size: 32M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
PHP_FCGI_CHILDREN: 4
PWD: /Applications/MAMP/fcgi-bin
PHP_FCGI_MAX_REQUESTS: 200
__CF_USER_TEXT_ENCODING: 0x1F6:0x0:0x0
ORIG_SCRIPT_NAME: /fcgi-bin/php7.1.12.fcgi
ORIG_PATH_TRANSLATED: /Volumes/Jobs/Websites/Perch_Shop_4/site-folder/perch/core/settings/diagnostics/index.php
ORIG_PATH_INFO: /perch/core/settings/diagnostics/index.php
ORIG_SCRIPT_FILENAME: /Applications/MAMP/fcgi-bin/php7.1.12.fcgi
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/?extended
QUERY_STRING: extended
REQUEST_METHOD: GET
SERVER_PROTOCOL: HTTP/1.1
GATEWAY_INTERFACE: CGI/1.1
REDIRECT_URL: /perch/core/settings/diagnostics/index.php
REDIRECT_QUERY_STRING: extended
REMOTE_PORT: 51417
SCRIPT_FILENAME: /Volumes/Jobs/Websites/Perch_Shop_4/site-folder/perch/core/settings/diagnostics/index.php
SERVER_ADMIN: you@example.com
DOCUMENT_ROOT: /Volumes/Jobs/Websites/Perch_Shop_4/site-folder
REMOTE_ADDR: ::1
SERVER_PORT: 8890
SERVER_ADDR: ::1
SERVER_NAME: dev.perchshop4.loc
SERVER_SOFTWARE: Apache
PATH: /usr/bin:/bin:/usr/sbin:/sbin
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_REFERER: https://dev.perchshop4.loc:8890/perch/core/settings/diagnostics/
HTTP_ACCEPT_LANGUAGE: en-us
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6
HTTP_COOKIE: PHPSESSID=8e96667aa335bfea6f3fc0c32e898d79; cmsa=1
HTTP_CONNECTION: keep-alive
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_HOST: dev.perchshop4.loc:8890
SSL_TLS_SNI: dev.perchshop4.loc
HTTPS: on
REDIRECT_STATUS: 200
REDIRECT_HANDLER: php-fastcgi
REDIRECT_SSL_SERVER_A_SIG: sha256WithRSAEncryption
REDIRECT_SSL_SERVER_A_KEY: rsaEncryption
REDIRECT_SSL_SERVER_I_DN: /C=GB/ST=West Midlands/L=Dudley/O=Six Till Nine/emailAddress=my@emailaddress.co.uk/CN=dev.perchshop4.loc
REDIRECT_SSL_SERVER_S_DN: /C=GB/ST=West Midlands/L=Dudley/O=Six Till Nine/emailAddress=my@emailaddress.co.uk/CN=dev.perchshop4.loc
REDIRECT_SSL_SERVER_V_END: Aug 11 19:20:10 2019 GMT
REDIRECT_SSL_SERVER_V_START: Aug 11 19:20:10 2018 GMT
REDIRECT_SSL_SERVER_M_SERIAL: 9D22924A140C99CC
REDIRECT_SSL_SERVER_M_VERSION: 3
REDIRECT_SSL_CLIENT_VERIFY: NONE
REDIRECT_SSL_CIPHER_ALGKEYSIZE: 256
REDIRECT_SSL_CIPHER_USEKEYSIZE: 256
REDIRECT_SSL_CIPHER_EXPORT: false
REDIRECT_SSL_CIPHER: ECDHE-RSA-AES256-GCM-SHA384
REDIRECT_SSL_COMPRESS_METHOD: NULL
REDIRECT_SSL_SECURE_RENEG: true
REDIRECT_SSL_PROTOCOL: TLSv1.2
REDIRECT_SSL_VERSION_LIBRARY: OpenSSL/1.0.2j
REDIRECT_SSL_VERSION_INTERFACE: mod_ssl/2.2.34
REDIRECT_SSL_SERVER_I_DN_CN: dev.perchshop4.loc
REDIRECT_SSL_SERVER_I_DN_Email: my@emailaddress.co.uk
REDIRECT_SSL_SERVER_I_DN_O: Six Till Nine
REDIRECT_SSL_SERVER_I_DN_L: Dudley
REDIRECT_SSL_SERVER_I_DN_ST: West Midlands
REDIRECT_SSL_SERVER_I_DN_C: GB
REDIRECT_SSL_SERVER_S_DN_CN: dev.perchshop4.loc
REDIRECT_SSL_SERVER_S_DN_Email: my@emailaddress.co.uk
REDIRECT_SSL_SERVER_S_DN_O: Six Till Nine
REDIRECT_SSL_SERVER_S_DN_L: Dudley
REDIRECT_SSL_SERVER_S_DN_ST: West Midlands
REDIRECT_SSL_SERVER_S_DN_C: GB
REDIRECT_SSL_TLS_SNI: dev.perchshop4.loc
REDIRECT_HTTPS: on
FCGI_ROLE: RESPONDER
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1534015664.39
REQUEST_TIME: 1534015664
argc: 1
Hello Tony,
perch_shop_checkout()
should be called at the top of the page before any output.https://docs.grabaperch.com/addons/shop/gateways/stripe/
Thanks Hussein,
However the problem was that I had jumped ahead of myself. For it to process the order you must be logged in as a customer (member) - seems obvious now.
Once I had created the account in a step before the payment page, it worked fine. The url redirects functioned fine and the order was generated on the back end.
That's also true. If the user isn't logged in, you ideally shouldn't let them access the payment page:
perch_shop_checkout()
should be called before you output anything to the page regardless though. From the docs: