使用 RMA 进行交换的 Salesforce 付款
如果交易所需要额外资金,请使用 Salesforce 付款无缝收取和接受这些资金。
所需的 Edition
| 查看支持版本。 |
Salesforce 付款可以使用 B2C、B2B 或 D2C Commerce 与 Exchange RMA 协作。
由于 Salesforce 付款网关不会自动显示为可用的集成,因此 B2B 和 D2C 商店需要额外的步骤才能与 Salesforce 付款一起使用。
在“付款”页面上设置备选提供商。此备选提供商必须是由 Salesforce 付款创建的信用卡网关。要为 Salesforce 付款配置 StoreIntegratedService,请运行此脚本。使用您自己的网络商店名称和商户账户名称作为付款网关。
示例
// 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;
}
本文章是否解决您的问题?
请与我们共享您的想法,以便我们进行改进!

