|
| 1 | +--- |
| 2 | +description: Learn how to send a payment link to customers in Umbraco Commerce. |
| 3 | +--- |
| 4 | + |
| 5 | +# Sending Payment Links to Customers |
| 6 | + |
| 7 | +A common scenario in e-commerce is when a store owner wants to send a pre-filled cart to a customer for them to complete. This can be useful in many scenarios. It could be when customers request a quote, and the store owner wants to send a link to the customer to make the payment. |
| 8 | + |
| 9 | +In Umbraco Commerce, it only takes a few clicks to create and send a payment link. The customer can then click the link and complete the purchase. |
| 10 | + |
| 11 | +{% hint style="info" %} |
| 12 | +The payment links feature was introduced in Umbraco Commerce version 15.3.0 |
| 13 | +{% endhint %} |
| 14 | + |
| 15 | +## Generating a Payment Link |
| 16 | + |
| 17 | +1. Go to the **Commerce** section in the Umbraco backoffice. |
| 18 | +2. Expand the associated store and click on the **Carts** menu item. |
| 19 | +3. Click on the **Create Cart** button. |
| 20 | +4. Populate the cart with the products you want to include in the payment link. |
| 21 | +5. Click on the **Save** button to save the cart. |
| 22 | +6. Click on the **Generate Payment Link** button to launch the payment link generator modal. |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +7. Configure the payment link settings in the Payment Link Generator modal. You can set the following options: |
| 27 | + |
| 28 | + - **Validity Period**: The period in minutes for which the payment link will be valid. |
| 29 | + - **Landing Page URL**: The URL to which the customer will be directed when clicking on the payment link. |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +8. Use one of the two options to send the payment link to the customer: |
| 34 | + |
| 35 | + - [**Copy to Clipboard**](#copy-to-clipboard) |
| 36 | + - [**Send via Email**](#send-via-email) |
| 37 | + |
| 38 | +### Copy to Clipboard |
| 39 | + |
| 40 | +Clicking on the **Copy to Clipboard** button generates the payment link and then copies it to the clipboard. A notification will display to confirm the copy was successful. You can paste the link into an email or other communication form. |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +### Send via Email |
| 45 | + |
| 46 | +Clicking on the **Send via Email** button launches the Send Email modal. From here, you can select an email template and set the recipient's email address. |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | +Clicking the **Send** button will send the email to the recipient with the payment link. |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +{% hint style="info" %} |
| 57 | +Umbraco Commerce includes a default email template for sending payment links. You can customize this template by going to the **Settings** section in the Umbraco backoffice and selecting the **Email Templates** menu item. |
| 58 | +{% endhint %} |
| 59 | + |
| 60 | +## Payment Link Usage |
| 61 | + |
| 62 | +When the customer receives the payment link, they can click on the link to open the cart in the store. The cart will be pre-filled with the products and quantities that were added when the payment link was generated. |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +The customer can proceed to the checkout and complete the purchase as normal. |
| 67 | + |
| 68 | +{% hint style="info" %} |
| 69 | +The payment link cart will be held in session until the cart is completed or the session expires. Once completed, any previously open carts will be restored. |
| 70 | +{% endhint %} |
| 71 | + |
| 72 | +## Handling Expired Payment Links |
| 73 | + |
| 74 | +If a customer tries to use an expired payment link, they will be redirected to the configured landing page URL along with a `payment_link_error` querystring parameter. The value of this parameter will contain the reason for the error. |
| 75 | + |
| 76 | +Developers should use this querystring parameter to display a message to the customer explaining that the payment link has expired. |
| 77 | + |
| 78 | +## Headless Considerations |
| 79 | + |
| 80 | +The payment links handling is done automatically for standard Razor site implementations. You need to handle the payment links manually for headless Storefront API implementations. |
| 81 | + |
| 82 | +Developers should check for a `payment_link_token` querystring parameter when a customer lands on the site. If present, the developer should use the [Storefront API](../reference/storefront-api/endpoints/order.md#umbraco-commerce-storefront-api-v1-order-paymentlinktoken) to retrieve the cart associated with the payment link token. This can then be loaded into the session for the customer to complete payment. |
| 83 | + |
| 84 | +## Configuration Options |
| 85 | + |
| 86 | +The payment links feature has different configuration options you can set via `appsettings.json`: |
| 87 | + |
| 88 | +{% code title="appsettings.json" %} |
| 89 | +```json |
| 90 | +{ |
| 91 | + "Umbraco": { |
| 92 | + "Commerce": { |
| 93 | + "PaymentLinks": { |
| 94 | + "TokenSigningSecret": "your_secret_here", |
| 95 | + "TokenQueryParameterName": "payment_link_token", |
| 96 | + "ErrorQueryParameterName": "payment_link_error", |
| 97 | + } |
| 98 | + } |
| 99 | + } |
| 100 | +} |
| 101 | +``` |
| 102 | +{% endcode %} |
| 103 | + |
| 104 | +By default, Umbraco Commerce payment link tokens are based on the JSON Web Token (JWT) format and are signed using the `TokenSigningSecret` value. The `TokenQueryParameterName` value is used to configure the querystring parameter name used for the payment link token. The `ErrorQueryParameterName` value is used to configure the querystring parameter name used for an error message. |
0 commit comments