# Overview

> Antom SDK provides secure and reliable cross-platform payment capabilities, helping developers quickly integrate payment processes into Flutter applications. This topic introduces how to integrate the Flutter SDK resource package using pubspec.yaml file.

 Antom SDK provides secure and reliable cross-platform payment capabilities, helping developers quickly integrate payment processes into Flutter applications. This topic introduces how to integrate the Flutter SDK resource package using _pubspec.yaml_ file.

## Integration preparations {#mKMme}

 Before beginning the integration, ensure that you have completed the following environment preparations:

 - Flutter is installed in version 3.29.2 stable or later.
- Dart is version 3.7.2 or later.
- "Integration preparations" of [Android SDK](https://docs.antom.com/ac/sdks/android.md#mKMme) has been completed.
- "Integration preparations" of [iOS SDK](https://docs.antom.com/ac/sdks/ios.md#mKMme) has been completed.

## Getting started {#wrRoP}

### Step 1: Integrate the SDK package {#gyciq}

 Add the `payment_component` Flutter plugin to the _pubspec.yaml_ file. Replace X.X.X in the sample code with [the latest version number](https://docs.antom.com/ac/sdks/sdk_release_note.md):

 > **Notes**： - Flutter SDK is added as a private Git dependency, and accessing this repository requires whitelisting specific IP addresses. Contact Antom Technical Support for assistance.
> - You can choose to integrate Google Pay plugin SDK or security extension on Android or iOS according to your business needs. Refer to the [Android SDK](https://docs.antom.com/ac/sdks/android.md) or [iOS SDK](https://docs.antom.com/ac/sdks/ios.md) integration guides for specific steps.

 ```plaintext
dependencies:
  flutter:
    sdk: flutter
  
  payment_component:
    git:
      url: http://antomsdk%40aliyun.com:Admin1234@globaltech-git.alipay.com/aplus-mobile/antom-sdk-flutter.git
      ref: release_X.X.X
```

 <details>
<summary>[Additional iOS integration]</summary>

1. For security reasons, the Antom SDK uses proprietary CocoaPods sources to distribute pods. To access private sources, you need to update the _.netrc_ file containing the required credentials and restart the terminal. Copy the code below into your _.netrc_ file to update the _.netrc_ file.  > **[INFO]** **Note**    : The     *.netrc*     file is located in the    *~/.netrc*    directory. If it does not exist, you need to create a     *.netrc*     file. For more information about        *.netrc*     files, refer to   [_.netrc_ files](https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html)  .

 ```plain
machine globaltech.alipay.com
    login antomsdk@aliyun.com
    password Admin1234
```

 2. Add the corresponding CocoaPods private source and dependency code to your Podfile according to your needs.
 ```objectivec
source 'https://globaltech.alipay.com/api/v1/file/common/5700989804217335/antom'

    target 'YOUR_TARGET' do

    end
```

</details>

### (Optional) Step 2: Preload the SDK  **[Client]** {#caoWK}

 Before creating a payment session or vaulting session, it is highly recommended that you preload the SDK to improve the rendering speed of the checkout page, reducing the waiting time for buyers during the payment. Follow the code example below to perform the preloading:

 > **[INFO]** **Note**    : Replace {ClassName} in the sample code with the corresponding class name based on your business requirements. Such as   `AMSPaymentElement`  .

 ```dart
{ClassName}.preload();
```

### Step 3: Create a session  **[Server]** {#nlnfw}

 Based on your business scenario, call the corresponding APIs by passing order information to create a payment or vaulting session, and obtain _paymentSessionData_ or _vaultingSessionData_ to invoke the SDK:

 - Payment Element: Call the   [**createPaymentSession (One-time Payments)**](https://docs.antom.com/ac/ams/session_cashier.md)  API to create a payment session.
- Vaulting Element: Call the **[createVaultingSession](https://docs.antom.com/ac/ams/vaulting_session.md)** API to create a vaulting session.

## Next steps {#OkNgC}

 After completing the SDK integration, you can use the SDK in your desired payment scenarios. For specific operations, refer to the corresponding integration guides:

 - [Payment Element integration](https://docs.antom.com/ac/cashierpay/element.md)
- Vaulting Element integration