/flutterflow-integrations

FlutterFlow and 2Checkout (now Verifone) integration: Step-by-Step Guide 2024

Learn to integrate FlutterFlow with 2Checkout (now Verifone) using our easy step-by-step guide. Simplify your payment processing setup effortlessly.

What is 2Checkout (now Verifone)?

2Checkout, which is now known as Verifone, is a global payment processing solution that allows businesses to accept mobile and online payments from buyers worldwide. Verifone also provides an all-in-one monetization platform that supports ongoing business expansion, repeat customers, and global payments. This tool makes it easy for businesses to expand into international markets by managing currency and language barriers, while taking care of local payment methods. With high security standards, it ensures a secure transaction process.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web or mobile app? RapidDev builds Bubble apps with your growth in mind.

Book a free No-Code consultation

How to integrate FlutterFlow with 2Checkout (now Verifone)?

 

Step-by-Step Guide on How to Integrate FlutterFlow with 2Checkout (now Verifone)

 

Prerequisites:

  • A FlutterFlow project set up and running
  • A 2Checkout (now Verifone) account with access to API credentials
 

Step 1: Setting Up Your 2Checkout (now Verifone) Account

  • Create a 2Checkout Account:
    • Sign Up: Visit the 2Checkout registration page and create an account.
    • Activate the Account: Verify your email and complete any necessary onboarding steps.
    • Know Your Environment: Ensure you're aware of the differences between the sandbox and production environments.
  • Obtain API Credentials:
    • Login to your 2Checkout account.
    • Navigate to ‘Integrations’ > ‘Webhooks & API’.
    • Enable API: Ensure that the API is enabled.
    • Generate Keys: Obtain your Merchant Code, Secret Word, and API Key. Store these securely.
 

Step 2: Configuring Webhooks in 2Checkout

  • Setup Webhooks for Transaction Events:
    • Go to the ‘Webhooks & API’ section.
    • Add a Webhook URL: Specify the URL endpoint in your FlutterFlow backend to handle payment notifications. For example, `https://yourapp.com/webhooks` or your equivalent.
    • Select Events: Choose the event types you want to listen for, such as `payment_received`, `invoice_paid`, `invoice_cancelled`, etc.
    • Save the webhook configuration.
 

Step 3: Preparing Your FlutterFlow Project

  • Install Necessary Packages:
    • Open your FlutterFlow project.
    • Navigate to the `pubspec.yaml` file.
    • Add dependencies for HTTP and JSON parsing:
    •   
        dependencies:
          flutter:
            sdk: flutter
          http: ^0.13.3
          provider: ^6.0.0  
          json\_annotation: ^4.4.0
        
            
    • Run `flutter pub get` to install the new dependencies.
  • Set Up A Payment Model:
    • Create a Dart model class to represent the payment data.
    •   
        import 'package:json_annotation/json_annotation.dart';
      
        part 'payment.g.dart';
      
        @JsonSerializable()
        class Payment {
          final String paymentId;
          final double amount;
          final String currency;
          final String status;
      
          Payment({required this.paymentId, required this.amount, required this.currency, required this.status});
      
          factory Payment.fromJson(Map json) => \_$PaymentFromJson(json);
          Map toJson() => \_$PaymentToJson(this);
        }
        
            
  • Implement HTTP Client:
    • Create an HTTP client to interact with 2Checkout API.
    •   
        import 'package:http/http.dart' as http;
        import 'dart:convert';
      
        class PaymentService {
          final String baseUrl = "https://api.2checkout.com/rest";
      
          Future createPayment(Payment payment) async {
            final response = await http.post(
              Uri.parse('$baseUrl/payments'),
              headers: {
                'Content-Type': 'application/json; charset=UTF-8',
                'Merchant-Id': '<Your Merchant Code>',
                'Secret-Key': '<Your API Key>',
              },
              body: jsonEncode(payment.toJson()),
            );
      
            if (response.statusCode == 201) {
              return response;
            } else {
              throw Exception('Failed to create payment');
            }
          }
        }
        
            
 

Step 4: Integrate Payment Flow in FlutterFlow

  • Create UI for Payment:
    • In FlutterFlow, design your UI for entering payment details.
    • Add TextFields for card number, expiry date, CVV, and an amount to pay.
    • Add a submit button to initiate the transaction.
  • Implement Payment Logic:
    • In the button's `onPressed` event, call the `createPayment` method from your `PaymentService`.
    •   
        import 'package:flutter/material.dart';
        import 'payment\_service.dart'; // Your service file
        import 'payment.dart'; // Your model file
      
        class PaymentScreen extends StatelessWidget {
          final TextEditingController cardNumberController = TextEditingController();
          final TextEditingController expiryDateController = TextEditingController();
          final TextEditingController cvvController = TextEditingController();
          final TextEditingController amountController = TextEditingController();
      
          void performPayment(BuildContext context) async {
            final paymentService = PaymentService();
            final payment = Payment(
              paymentId: '12345',
              amount: double.parse(amountController.text),
              currency: 'USD',
              status: 'pending',
            );
      
            try {
              final response = await paymentService.createPayment(payment);
              if (response.statusCode == 201) {
                ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Payment Successful')));
              } else {
                ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Payment Failed')));
              }
            } catch (e) {
              ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Error: $e')));
            }
          }
      
          @override
          Widget build(BuildContext context) {
            return Scaffold(
              appBar: AppBar(
                title: Text('Make a Payment'),
              ),
              body: Padding(
                padding: const EdgeInsets.all(16.0),
                child: Column(
                  children: [
                    TextField(
                      controller: cardNumberController,
                      decoration: InputDecoration(labelText: 'Card Number'),
                    ),
                    TextField(
                      controller: expiryDateController,
                      decoration: InputDecoration(labelText: 'Expiry Date'),
                    ),
                    TextField(
                      controller: cvvController,
                      decoration: InputDecoration(labelText: 'CVV'),
                    ),
                    TextField(
                      controller: amountController,
                      decoration: InputDecoration(labelText: 'Amount'),
                    ),
                    SizedBox(height: 20),
                    ElevatedButton(
                      onPressed: () => performPayment(context),
                      child: Text('Submit'),
                    ),
                  ],
                ),
              ),
            );
          }
        }
        
            
 

Step 5: Handling Webhook Data in the Backend

  • Set Up FlutterFlow Backend:
    • Configure your FlutterFlow backend to handle webhook events from 2Checkout.
    • Create a new endpoint, for example, `/webhooks`, to capture webhook data.
  • Parse Webhook Data:
    • In your backend, extract and validate the data received from 2Checkout.
    •   
        from flask import Flask, request, jsonify
      
        app = Flask(**name**)
      
        @app.route('/webhooks', methods=['POST'])
        def handle\_webhook():
            data = request.get\_json()
            payment\_status = data.get('status')
            # Perform actions based on payment status
            if payment\_status == 'completed':
                # Update your database or application state
                return jsonify({'status': 'success'}), 200
            else:
                return jsonify({'status': 'failed'}), 400
      
        if **name** == '**main**':
            app.run(debug=True)
        
            
 

Step 6: Testing the Integration

  • Test in Sandbox Environment:
    • Perform multiple transactions in the 2Checkout sandbox environment to ensure everything works as expected.
    • Check if webhooks are correctly reaching your backend and updating your application state.
  • Move to Production:
    • Once validated in the sandbox, switch your credentials to use live keys.
    • Conduct a few live transactions to confirm the setup before full deployment.
  By following these steps, you should be able to successfully integrate FlutterFlow with 2Checkout (now Verifone), enabling secure payment processing within your Flutter app.

FlutterFlow and 2Checkout (now Verifone) integration usecase

Scenario

An e-commerce startup wants to streamline its payment processing for a new mobile app they are developing. They use FlutterFlow to design and create the mobile app, and they decide to integrate it with 2Checkout (now Verifone) for seamless payment processing. This integration aims to provide a smooth checkout experience for users and to automate transaction records for better financial tracking.

Solution: Integrating FlutterFlow with 2Checkout (now Verifone)

Mobile App Creation

  • The startup uses FlutterFlow to design and develop their mobile app, which includes a product catalog and a checkout section.
  • Within the app, the checkout section allows users to review their cart, enter payment details, and complete their purchases.

Setting Up the Integration

  • The startup installs the 2Checkout API integration within FlutterFlow and configures it using their 2Checkout (Verifone) API credentials.
  • They set up workflows in FlutterFlow that trigger when the checkout form is submitted by the user.

Payment Processing Workflow

  • When a user submits the checkout form, the workflow is triggered in FlutterFlow.
  • The submitted transaction data (e.g., product details, amount, user information) is automatically sent to 2Checkout using the configured API action.
  • 2Checkout processes the payment and returns a status update (e.g., success, failure) that is captured by FlutterFlow.
  • Based on the response from 2Checkout, FlutterFlow updates the user interface to show a transaction confirmation or an error message.

Financial Tracking

  • All transaction details are automatically logged within 2Checkout, providing a comprehensive record for financial tracking.
  • The startup configures 2Checkout to send periodic transaction reports to their financial team, ensuring that all sales data is up-to-date.

Benefits

  • Seamless User Experience: Integrating with 2Checkout provides a smooth and secure payment process, enhancing user satisfaction.
  • Automated Transactions: The integration automates the entire transaction process, from payment capture to status updates, reducing manual effort and minimizing errors.
  • Real-time Updates: Users receive immediate feedback on their transaction status, which improves transparency and trust.
  • Centralized Financial Data: All payment data is stored and managed in 2Checkout, providing a single source of truth for the financial team.
  • Scalable Solution: As the business grows, the integration can easily handle increased transaction volumes without additional development overhead.

Conclusion

By integrating FlutterFlow with 2Checkout (now Verifone), the e-commerce startup can offer a seamless checkout experience within their mobile app, automate payment processing, and maintain accurate transaction records. This integration helps in providing a better user experience, efficient transaction management, and reliable financial tracking.

Explore More Valuable No-Code Resources

No-Code Tools Reviews

Delve into comprehensive reviews of top no-code tools to find the perfect platform for your development needs. Explore expert insights, user feedback, and detailed comparisons to make informed decisions and accelerate your no-code project development.

Explore

WeWeb Tutorials

Discover our comprehensive WeWeb tutorial directory tailored for all skill levels. Unlock the potential of no-code development with our detailed guides, walkthroughs, and practical tips designed to elevate your WeWeb projects.

Explore

No-Code Tools Comparison

Discover the best no-code tools for your projects with our detailed comparisons and side-by-side reviews. Evaluate features, usability, and performance across leading platforms to choose the tool that fits your development needs and enhances your productivity.

Explore
Want to Enhance Your Business with Bubble?

Then all you have to do is schedule your free consultation. During our first discussion, we’ll sketch out a high-level plan, provide you with a timeline, and give you an estimate.

Book a free consultation

By clicking “Accept”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.

Cookie preferences