> For the complete documentation index, see [llms.txt](https://docs.digitalriver.com/salesforce-lightning/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalriver.com/salesforce-lightning/salesforce-lightning-b2b-commerce-app-1.2/extend-the-salesforce-lightning-app/customer-credit/publishing-connector-events.md).

# Publishing connector events

To implement the customer credit feature, in addition to calling the methods described above, you must publish the events that interact with the components included in the connector. This section describes those events.

## Reloading Drop-In

You should publish the event to reload Drop-in after applying or removing a partial amount from customer credit.

### Publishing an event to reload the Drop-in component

{% hint style="info" %}
**Prerequisite**: Publish this event after calling [`addCustomerCreditSourceToCheckout` ](/salesforce-lightning/salesforce-lightning-b2b-commerce-app-1.2/extend-the-salesforce-lightning-app/customer-credit/addcustomercreditsourcetocheckout.md)or [`deattachPaymentToCheckout` ](/salesforce-lightning/salesforce-lightning-b2b-commerce-app-1.2/extend-the-salesforce-lightning-app/customer-credit/deattachpaymenttocheckout.md)methods.
{% endhint %}

To publish the event to reload the Drop-in (drb2b\_dropin) component, import the `DigitalRiverMessageChannel__c` **message channel** and **message service** into the customer credit javascript file.

{% code title="Import example" %}

```javascript
import {publish, MessageContext } from 'lightning/messageService';
import dr_lms from '@salesforce/messageChannel/ digitalriverv3__ DigitalRiverMessageChannel__c';
```

{% endcode %}

Declare the `messageContext` variable as shown in below.

{% code title="messageContext example" %}

```javascript
@wire(MessageContext) messageContext; 
```

{% endcode %}

Publish the event. When publishing the event, use the `reloadDropin` value for the `purpose` parameter as shown in the following example:

{% code title="Publish example" %}

```javascript
publish(this.messageContext, dr_lms, {
  purpose: 'reloadDropin' 
  });
```

{% endcode %}

### Reloading the checkout summary component

{% hint style="info" %}
**Prerequisite**: Publish this event after calling [`addCustomerCreditSourceToCheckout` ](/salesforce-lightning/salesforce-lightning-b2b-commerce-app-1.2/extend-the-salesforce-lightning-app/customer-credit/addcustomercreditsourcetocheckout.md)or [`deattachPaymentToCheckout` ](/salesforce-lightning/salesforce-lightning-b2b-commerce-app-1.2/extend-the-salesforce-lightning-app/customer-credit/deattachpaymenttocheckout.md)methods.
{% endhint %}

Reload the checkout summary component to reflect the latest values whenever a shopper adds or removes a source from the checkout. This will update the UI with the latest values, including the amount contributed and the amount remaining to be contributed.

To publish an event to reload the checkout summary (`drb2b_checkoutSummary`) component, import the `DigitalRiverMessageChannel__c` **message channel** and **message service** into the customer credit javascript file.

{% hint style="info" %}
If you already imported the `DigitalRiverMessageChannel__c` **message channel** and **message service** into the customer credit JavaScript file, you can skip this step.
{% endhint %}

{% code title="Import example" %}

```javascript
import {publish, MessageContext } from 'lightning/messageService';
import dr_lms from '@salesforce/messageChannel/ digitalriverv3__ DigitalRiverMessageChannel__c';
```

{% endcode %}

Declare the `messageContext` variable as shown below.

{% code title="messageContext example" %}

```javascript
 @wire(MessageContext) messageContext;
```

{% endcode %}

{% hint style="info" %}
If you already declared the `messageContext` variable, you can skip this step.
{% endhint %}

Publish the event. When publishing the event, use the `reloadCheckoutSummary` value for the `purpose` parameter as shown in the following example:

{% code title="Publish example" %}

```javascript
publish(this.messageContext, dr_lms, {
            purpose: 'reloadCheckoutSummary' 
        });
```

{% endcode %}

###


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.digitalriver.com/salesforce-lightning/salesforce-lightning-b2b-commerce-app-1.2/extend-the-salesforce-lightning-app/customer-credit/publishing-connector-events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
