Loading
Feature degradation | Gmail Email delivery failureRead More
Salesforce Order Management
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Salesforce Payments for Order on Behalf Of

          Salesforce Payments for Order on Behalf Of

          Place orders on behalf of customers seamlessly with Salesforce Payments.

          Required Editions

          View supported editions.

          Salesforce Payments can work with both Order Entry and OOBO, using B2C, B2B, or D2C Commerce.

          Because Salesforce Payment Gateways don’t automatically appear as available integrations, there’s an extra step for Order on Behalf Of B2B and D2C stores to work with Salesforce Payments.

          Set up an alternative provider on the Payments page. This alternative provider must be a credit card gateway that’s created by Salesforce Payments. To configure the StoreIntegratedService for Salesforce payments, run this script. Use your own web store name and merchant account name for the payment gateway.

          Example
          Example
          // Script to add a connection between the webstore and the payment gateway for stores using
          // Salesforce Payments (SFP) as the payment gateway for SFP does not show in the the Payment 
          // Alternate Integration.
          
          String merchantAccountName = 'DemoTest';
          String webStoreName = 'B2B Store';
          
          // obtain webstoreid
          List<WebStore> webstores = [SELECT Id, Name FROM WebStore WHERE Name = :webStoreName];
          System.debug('Webstores: ' + webstores);
          if(webstores.isEmpty()){
              System.debug('Error obtaining webstore with name ' + webStoreName);
          }
          String webStoreId = webstores[0].Id;
          System.debug('WebStoreId: ' + webStoreId);
          
          // obtain merchant account 
          List<MerchAccPaymentMethodSet> merchAccPaymentMethodSet = [SELECT Id, MerchantAccountId, DeveloperName FROM MerchAccPaymentMethodSet WHERE MerchantAccount.Name = :merchantAccountName];
          System.debug('Details: ' + merchAccPaymentMethodSet);
          if(merchAccPaymentMethodSet.isEmpty()){
              System.debug('Error obtaining MerchAccPaymentMethodSet with name ' + merchantAccountName);
          }
          String merchantAccountId = merchAccPaymentMethodSet[0].MerchantAccountId;
          System.debug('merchantAccountId: ' + merchantAccountId);
          
          // obtain payment gateway id from the merchant account
          List<PaymentGateway> paymentGateways = [SELECT Id, PaymentGatewayName FROM PaymentGateway WHERE MerchantAccountId = :merchantAccountId];
          System.debug('paymentGateways: ' + paymentGateways);
          if(paymentGateways.isEmpty()){
              System.debug('Error obtaining payment gateway with merchant account id ' + merchantAccountId);
          }
          String paymentGatewayId = paymentGateways[0].Id;
          System.debug('paymentGatewayId: ' + paymentGatewayId);
          
          // If a StoreIntegratedService already exists for Payment on the WebStore then update the Integration field with the paymentGatewayId
          List<StoreIntegratedService> storeServices = [SELECT Id FROM StoreIntegratedService WHERE StoreId = :webStoreId AND ServiceProviderType ='Payment' ];
          System.debug('storeServices: ' + storeServices);
          if(storeServices.isEmpty()){
              StoreIntegratedService storeService = new StoreIntegratedService(
                  StoreId = webStoreId,
                  Integration = paymentGatewayId,
                  ServiceProviderType ='Payment');
              insert storeService;
          } else {
              StoreIntegratedService existingStoreService = storeServices[0];
              existingStoreService.Integration = paymentGatewayId;
              update existingStoreService;
          }
          
           
          Loading
          Salesforce Help | Article