Setup Mapping Object

1. Creating a mapping record in the Mapping Object

Add Mapping Data on ‘Mappings’ object if you want to use the charge component with already populated amount and contact field.  Below is an example of mapping for an Opportunity object. 

Mapping details

Mapping Name The unique name for the mapping you want to create. 
Object This is the API name of the Salesforce object (like Account, Opportunity, CustomObject__c) that you’re working with. 
Payment Gateway The payment gateway where these mappings should work. 
Contact This is the API name of the contact field on the above selected Salesforce object used to map contact field data on selected object to the contact on charge component. 
Amount This is the API name of the amount field on the above selected Salesforce object used to map amount field data on selected object to the contact on charge component. 
Transaction Lookup This is the API name for the selected object’s field on the transaction object used to show related data. 
 
For e.g. You have created mappings & lookup fields of Opportunity on transaction & Subscription objects. When you charge a customer from Opportunity then it will be automatically populated on transaction & subscription. And on opportunity you can show it as related records. 
Subscription Lookup This is the API name for the selected object’s field on the subscription object used to show related data. 

2. Add ‘Charge’ button to perform payments from any object (Opportunity). 

In this case, the object is opportunity. 

Create a new Action by going to Buttons, Links and Actions from the Opportunity Object and clicking on ‘New Action’ button. 

Select the Action Type as ‘Lightning web component’ from the picklist and select Lightning web component as ‘aob_stripe:charge’. Label the button and click Save.

To add the Charge button to the opportunity page. Go to Opportunity Object Settings and then Page Layout, select ‘Opportunity Layout’. Click on ‘Mobile & Lightning Actions’ and search for Charge button in that. Drag that button to the ‘Salesforce Mobile and Lightning Experience Actions’. Then click Save.

Now you can start payments using Charge from the Opportunity object. The “Charge” button will be visible on the opportunity page. Please populate the contact and the amount field of the opportunity.