# GoCardless Payment Gateway Integration

GoCardless is a UK-based payment gateway that simplifies bank-to-bank payments, focusing on Direct Debit and Instant Bank Pay solutions. It supports payments in over 30 countries, integrating with schemes like BACS (UK), SEPA (Europe), ACH (US), and others, with fees as low as 1% + £0.20 per transaction. GoCardless offers features like automated recurring payments, intelligent retries (Success+), and open banking capabilities, making it ideal for businesses handling subscriptions, invoices, or one-off payments with minimal admin overhead.

This guide walks you through integrating GoCardless into your application, from account creation to live deployment.

### Step 1: Log in or Sign Up

1. Visit GoCardless: Go to GoCardless and click Sign Up to create a new account or Log In if you already have one.
2. Account Creation: Provide your email, password, and business details (e.g., company name, country). Select a plan (Standard or Pro) based on your needs—Pro is required for API access.
3. Email Verification: Check your inbox for a verification email from GoCardless and click the link to activate your account.
4. Dashboard Access: Log in to the GoCardless Dashboard at manage.gocardless.com to manage payments, API credentials, and settings. A Sandbox account is available for testing.

### Step 2: Set Up Your Account

Before processing payments, configure your GoCardless account:

1. Complete Your Profile:

- In the Dashboard, go to Settings > About Your Business.
- Enter your business details: legal name, address, phone number, and website URL (required for live transactions).
- For individuals, provide personal details instead.

1. Business Verification (Required for Live Mode):

- Navigate to Settings > Verification.
- Submit documents like a business registration certificate, ID, and proof of address (varies by country, e.g., Companies House registration for UK).
- Verification takes 1-2 business days; you’ll be notified via email once approved.

1. Add a Settlement Bank:

- Go to Settings > Payouts.
- Add your bank details (e.g., IBAN for SEPA, sort code/account number for UK) for payouts. GoCardless supports local currency accounts or converts via Wise at real exchange rates.
- A test deposit may verify the account.

1. Sandbox Mode: Use the Sandbox at developer.gocardless.com with test credentials to simulate payments without verification.

### Step 3: Obtain API Credentials

GoCardless provides credentials for integration:

- Access Token: A key for authenticating API requests (e.g., `live_abc123xyz` or `sandbox_xyz789abc`).
- Test vs. Live: Sandbox Access Token is available immediately; live Access Token requires verification.

##### How to Get Your Credentials:

1. Log in to the GoCardless Dashboard.
2. Go to Developers > API Access.
3. Generate an Access Token:

- Click Create Access Token, name it (e.g., "MyApp"), and copy the token.
- Sandbox tokens are prefixed with `sandbox_`, live tokens with `live_`.

1. Key Security: Keep the Access Token confidential—use it only in server-side code. Store it securely.
2. Add this to your application’s Admin Panel under System Settings > Payment Gateways > GoCardless.

### Step 4: Configure Payment Methods

GoCardless supports bank payment methods, activated based on your region:

1. Go to Settings > Payment Schemes in the Dashboard.
2. Available methods include:

- Direct Debit: BACS (UK), SEPA (Europe), ACH (US), BECS (Australia), etc. (enabled by default).
- Instant Bank Pay: Open banking for one-off payments (UK/Europe, requires opt-in).

1. Contact support@gocardless.com to enable additional schemes or currencies (e.g., USD, AUD).
2. These methods will appear in your checkout flow once integrated.

### Step 5: Set Up Webhooks

Webhooks notify your server of payment events (e.g., payment success):

1. In the Dashboard, go to Developers > Webhooks.
2. Click Create Webhook Endpoint.
3. Webhook URL:

- Enter the URL from your application (e.g., `https://yourwebsite.com/webhooks/gocardless`).
- Find this URL in your Admin Panel under GoCardless settings.
- Ensure your endpoint accepts POST requests and returns a 200 OK response.

1. Events: Subscribe to events like:

- `payment.created`: Payment initiated.
- `payment.paid_out`: Funds settled.
- `payment.failed`: Payment failed.

1. Save the webhook. GoCardless signs notifications with a secret (generated during setup) for verification.
2. Testing: Use the Sandbox to send test webhooks and confirm receipt.

### Step 6: Set Up Credentials in Our Dashboard

Integrate GoCardless into your application:

1. Log in to your application’s Admin Panel.
2. Navigate to System Settings > Payment Gateways > GoCardless.

1. Fill out the configuration form:

1. Detailed Fields:

- Supported Currencies: Select currencies enabled on your GoCardless account (e.g., GBP, EUR, USD, AUD). Contact support for additional currencies.
- Active: Toggle “On” to enable GoCardless payments.
- Live Mode: Toggle “Off” for Sandbox, “On” for live transactions.
- Access Token: Enter your Sandbox or Live Access Token (e.g., `sandbox_xyz789abc` or `live_abc123xyz`).
- Webhook URL: Copy this URL and paste it into the GoCardless Dashboard’s webhook settings.
- Minimum Amount: Set a floor (e.g., £1.00) to avoid small transactions.
- Maximum Amount: Set a ceiling (e.g., £10,000) based on your needs.
- Fixed Charge: Add a flat fee (e.g., £0.50) per transaction, if applicable.
- Percentage Charge: Add a percentage fee (e.g., 1%) on top of GoCardless’ fees (1% + £0.20, capped at £4).

1. Click Submit to save. Your GoCardless gateway is now configured.

### Step 7: Test the Integration

Test your setup in Sandbox Mode:

1. Enable Sandbox Mode:

- Sign up at developer.gocardless.com for a Sandbox account.
- In your Admin Panel, ensure Live Mode is off and use the Sandbox Access Token.

1. Simulate Payments:

- Use test bank details from GoCardless Testing Guide:
- UK BACS: Sort code `20-00-00`, account `55779911`.
- SEPA: IBAN `DE89370400440532013000`.
- Test Instant Bank Pay with Sandbox flows.

1. Verify Webhooks:

- Check your server logs for webhook events (e.g., `payment.paid_out`).
- Ensure payment statuses update in your Admin Panel (e.g., “Paid,” “Pending”).

1. Debugging: If issues arise, check the Sandbox Dashboard’s Payments tab for error details (e.g., “Invalid Bank Details”).

### Step 8: Enable Live Mode

After successful testing:

1. GoCardless Dashboard:

- Ensure your account is verified and ready for live transactions.
- Log in to manage.gocardless.com.

1. Admin Panel:

- Go to System Settings > Payment Gateways > GoCardless.
- Toggle Live Mode to “On”.
- Replace the Sandbox Access Token with the Live Access Token.
- Save the changes.

1. Webhook Confirmation: Verify the webhook URL is set in the live Dashboard.

### Step 9: Go Live

Launch your GoCardless integration:

1. Start Accepting Payments:

- Customers can now pay via Direct Debit or Instant Bank Pay at checkout.
- Monitor initial transactions for issues.

1. Live Verification:

- In the GoCardless Dashboard, go to Payments to track transactions in real-time.
- Confirm payouts to your bank account (5-7 business days for Direct Debit, instant for Instant Bank Pay).

1. Troubleshooting:

- If payments fail, review error logs in the Dashboard or contact support@gocardless.com.
- Ensure your webhook endpoint remains active.

## Additional Tips

- GoCardless Fees: 1% + £0.20 per transaction (capped at £4) for UK; 2% + £0.20 for international (with FX via Wise). No setup or monthly fees. See pricing.
- Documentation: Explore the GoCardless Developer Docs for advanced features like Success+ retries or mandate management.
- Support: Contact support@gocardless.com or use the Dashboard’s live chat for assistance.

## Note:

If you need further help, our support team is available 24/7. Reach out at softivus@gmail.com or through the Admin Panel. Let’s streamline your payments with GoCardless!