--- title: "PayLink: Automated PayLink with Opportunities" slug: "payments-use-cases-paylink-automated-opportunities" updated: 2023-10-06T15:07:16Z published: 2023-10-06T15:07:16Z canonical: "docs.blackthorn.io/payments-use-cases-paylink-automated-opportunities" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.blackthorn.io/llms.txt > Use this file to discover all available pages before exploring further. # PayLink: Automated PayLink with Opportunities ## Scenario A common use case is that a salesperson will close an Opportunity and send the customer a link to the payment request. To do this, you can build three things without using code. - A Process Builder process to automatically create a Transaction record when the Opportunity **Stage** = "Closed Won". - A Process Builder process to automatically roll-up the PayLink on to the Opportunity record. - A Workflow Rule with an Email Alert to automatically email the PayLink to the customer. ## Instructions ### Step One 1. Create a custom URL type field on the Opportunity object called **PayLink**. 2. Create a lookup type field on the Opportunity object called **Billing Contact** that looks to the Contact object and is filtered by the Account record on the Opportunity. This is for sending a Workflow email all from one object (Opportunity). 3. Alternatively, roll-up a related Opportunity Contact Role record from the Opportunity to populate this value too. ![G_01_03 instructions pic 1](https://cdn.document360.io/f977eec0-500f-40a3-b663-724a51f78075/Images/Documentation/G_01_03%20instructions%20pic%201.png) ### Step Two *Auto-create the Blackthorn Payments Transaction from the "Closed Won" Opportunity.* 1. Create a new Process Builder. 2. Set **The process starts when** to "A record changes". 3. Click **+ Add Object**. 4. Type in "Opportunity", and select "when a record is created or edited". 5. Click **Save**. 6. Click **+ Add Criteria**. 7. Enter a **Criteria Name** and select "Conditions are met" for **Criteria for Executing Actions**. 8. Under **Field**, find the Opportunity **Stage**, set **Operator** to "Equals", and pick "Closed Won" for the **Value**. 9. Under IMMEDIATE ACTIONS, click **+ Add Action**. 10. **Action Type** = "Create a Record" 11. Ender an **Action Name** and set **Record Type** to "Transaction". 12. Under Set Field Values, enter the following information. | Field | Type | Value | | --- | --- | --- | | Amount | Formula | [Opportunity].Amount | | Opportunity | Field Reference | [Opportunity].Id | | Description | Formula | [Opportunity].Description | | Due Date | Formula | [Opportunity].CloseDate | | Contact | Field Reference | [Opportunity].Billing_Contact | 1. Activate the Process Builder. As an alternative to the **Contact** field, you can populate the **Account** lookup field on the Transaction object with the Opportunity **Account Name** field. However, if you want both lookup fields on the Transaction, the **Account** lookup will supersede the **Account Name** lookup when viewing the PayLink form. ![G_01_03 instructions pic 2](https://cdn.document360.io/f977eec0-500f-40a3-b663-724a51f78075/Images/Documentation/G_01_03%20instructions%20pic%202.png) ### Step Three *Auto roll-up the PayLink from Transaction to Opportunity. This will allow you to use the PayLink in the Email Alert.* 1. Create a new Process Builder. 2. Set **The process starts when** to "A record changes". 3. Click **+ Add Object**, type in "Transaction", and select "only when a record is created". 4. Click **Save**. 5. Click **+ Add Criteria**, name your criteria and select " Conditions are met". 6. Under field, find Transaction **Opportunity**, set operator to "IS NULL", type to "Boolean" and pick "False" for the value. *This criteria tells the process to only fire when the Transaction has a related Opportunity.* 7. Under Immediate Actions, click **+ Add Action**. 8. **Action Type** = Update Records, enter your **Action Name** and set **Record Type** = "Opportunity". 9. No criteria-just update the records! 10. Field = **PayLink**; Type = Formula; Value = "[bt_stripe**Transaction**c].bt_paylink**PayLink**c". 11. Activate the Process Builder. ![G_01_03 instructions pic 3](https://cdn.document360.io/f977eec0-500f-40a3-b663-724a51f78075/Images/Documentation/G_01_03%20instructions%20pic%203.png) ### Step Four *Create a Workflow Rule with an Email Alert to automatically email the PayLink to the customer.* 1. Create the Email Template. *Here is an example Email Template.* ![G_01_03 instructions pic 4](https://cdn.document360.io/f977eec0-500f-40a3-b663-724a51f78075/Images/Documentation/G_01_03%20instructions%20pic%204.png) 2. Create the Workflow Rule and Email Alert. This will email your customer when the Opportunity **Stage** = "Closed Won", and there is a **PayLink** value. *Here is an example Workflow Rule and Email Alert.* ![G_01_03 instructions pic 5](https://cdn.document360.io/f977eec0-500f-40a3-b663-724a51f78075/Images/Documentation/G_01_03%20instructions%20pic%205.png) *When **PayLink** field is not empty and the Opportunity **Stage** = "Closed Won" then send PayLink to customer.* ![G_01_03 instructions pic 6](https://cdn.document360.io/f977eec0-500f-40a3-b663-724a51f78075/Images/Documentation/G_01_03%20instructions%20pic%206.png) Boom! Done. ## Additional Use Cases If you have any suggestions for a use case with Blackthorn Payments please contact [Blackthorn Support](https://community.blackthorn.io/s/support) and provide details on your use case. We always appreciate hearing the solutions our customers create and love sharing that with our other customers!