# Assign Payment Method By Source and SubSource

<figure><img src="https://2079576606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFRkrZGowwT8Xbb5HKclZ%2Fuploads%2Fn5fOROKfVMIn4UlVqxWf%2Fassign%20payment%20method%20by%20source%20and%20sub%20source.png?alt=media&#x26;token=4ab3bbfc-1525-4ac5-aac6-597f32f5e2ee" alt=""><figcaption></figcaption></figure>

The "Assign Payment Method By Source and SubSource" is a macro that runs as an action of the [*Rules Engine*](https://docs.linnworks.com/articles/#!documentation/rules-engine)*.* It is designed to automate the assignment of payment methods to orders based on their specified source and subsource within the Linnworks platform. This macro provides users with a convenient way to streamline payment method assignment, enhancing order processing efficiency.

This guide provides a step-by-step explanation of how to install and set up the macro in Linnworks.

### Start using the macro&#x20;

There are three steps you need to complete to start using the macro:

1. Install the application.
   * Go to *Apps > Application Store > Assign Payment Method >* click Install and follow the on-screen instructions until the installation is complete.
2. Configure the macro.
3. Configure the rule in the *Rules Engine* screen.

#### Configure the macro&#x20;

Once the *Assign Payment Method* app is installed:

1. Go to *Apps > Macro Configuration* and click  <mark style="color:purple;">+ Add new configuration.</mark><br>

   <figure><img src="https://2079576606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFRkrZGowwT8Xbb5HKclZ%2Fuploads%2FEL30iZpLp2bUs5FHna98%2Fpayment%20method%201.PNG?alt=media&#x26;token=9f56932b-39e3-4d84-b6f5-bdc9c14d98db" alt=""><figcaption></figcaption></figure>
2. Select the *Assign Payment Method* macro and click  <mark style="color:purple;">Create Configuration.</mark><br>

   <figure><img src="https://2079576606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFRkrZGowwT8Xbb5HKclZ%2Fuploads%2F579BznRZjO4k8NrOpY79%2Fpayment%20method%202.PNG?alt=media&#x26;token=a01b93cd-aeba-40fd-936e-0b2161ee5801" alt=""><figcaption></figcaption></figure>
3. In the *Macro Configuration* screen, specify the below details and click *Save*:

   <figure><img src="https://2079576606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFRkrZGowwT8Xbb5HKclZ%2Fuploads%2F4Bfn6I8EKSoIq3Kmrvl4%2Fpayment%20method%203.PNG?alt=media&#x26;token=41c9c087-703a-4d83-ab53-33ca3aec7459" alt=""><figcaption></figcaption></figure>
4. Make sure to enable the macro to continue with the *Rules Engine* configuration.<br>

   <figure><img src="https://2079576606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFRkrZGowwT8Xbb5HKclZ%2Fuploads%2Fta1zI5NclT2L7jLMgHon%2Fimg_v3_029p_c69237f7-b93b-42de-8cc1-3e001e75870h.png?alt=media&#x26;token=a6e4fa3a-0472-4bb4-be98-d180933481af" alt=""><figcaption></figcaption></figure>

#### &#x20;**Functionality:** <a href="#h3_1063100331" id="h3_1063100331"></a>

1. **Payment Method Assignment:** Automatically assigns payment methods to orders based on their defined source and subsource.
2. **Source and SubSource Matching:** Matches orders with specified source and subsource criteria to ensure accurate payment method assignment.
3. **Payment Method Lookup:** Retrieves available payment methods from the Linnworks platform for selection.

**Usage:**

1. **Input Parameters(In Sequential Order):**
   * `OrderIds`: Array of order IDs to process.
   * `Source`: Comma-separated list of source values to match against orders.
   * `SubSource`: Comma-separated list of subsource values to match against orders.
   * `PaymentMethods`: Comma-separated list of payment method names to assign to matching orders.
2. **Execution:**
   * Call the macro with the necessary input parameters to initiate the payment method assignment process.
3. **Outcome:**
   * The macro iterates through the specified orders and matches them with the provided source and subsource criteria.
   * If a match is found, the corresponding payment method from the provided list is assigned to the order.
