mirror of
https://gh.wpcy.net/https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2026-05-01 04:52:18 +08:00
2.3 KiB
2.3 KiB
Zettle OAuth Setup Instructions
Prerequisites
- You need a Zettle developer account
- Create an OAuth application at https://developer.zettle.com
Setup Steps
1. Get your Zettle Client ID
- Go to https://developer.zettle.com
- Create a new OAuth application or use an existing one
- Copy your Client ID (not the client secret)
- Set the redirect URI to:
https://yoursite.com/wp-admin/admin.php?page=wc-zettle-settings
2. Configure the Plugin
- In WordPress admin, go to WooCommerce > Zettle
- Enter your Zettle Client ID
- Click Save Settings
3. Authorize with Zettle
- Click Connect to Zettle button
- You'll be redirected to Zettle to authorize
- Log in with your Zettle account
- Approve the permissions
- You'll be redirected back to WordPress
4. Verify Connection
- The status should show "Connected to Zettle"
- You'll see the token expiration time
- The mobile app can now use PayPal card readers
Troubleshooting
Check Logs
Enable WordPress debug logging to see detailed error messages:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
Check the debug log at: wp-content/debug.log
Common Issues
-
"Zettle Client ID is not configured"
- Go to WooCommerce > Zettle
- Enter your Client ID and save
-
"Invalid OAuth state"
- The authorization process timed out (10 minutes)
- Try clicking "Connect to Zettle" again
-
"Failed to exchange code for token"
- Check that your redirect URI in Zettle matches exactly
- Ensure your Client ID is correct
Testing the Token Endpoint
Once connected, test the token endpoint:
curl -X GET https://yoursite.com/wp-json/wc/v3/zettle/access-token \
-u consumer_key:consumer_secret
You should get a response with an access token:
{
"access_token": "eyJ...",
"token_type": "Bearer",
"expires_in": 7200,
"scope": "READ:PAYMENT READ:USERINFO WRITE:PAYMENT WRITE:REFUND2 WRITE:USERINFO",
"issued_at": 1234567890
}
Mobile App Configuration
The mobile app will automatically use the site-managed tokens when:
- The site is connected to Zettle (completed above)
- PayPal card reader is selected in the app
- Card reader discovery is initiated
The app fetches fresh tokens from the backend automatically - no manual configuration needed in the app!