Konfigurera en betalningsgateway för Exchanges RMA (endast B2C)
Om du inte använder Salesforce Payments kan du konfigurera en betalningsgateway för att hantera betalningar. Betalningspaket för vissa leverantörer finns på AppExchange.
Versioner som krävs
Viktig Om du använder utbyten med B2B eller D2C Commerce har steg 1-4 redan konfigurerats under implementeringen av Orderhantering. Gå direkt till steg 5.
-
Skapa en adapterklass för betalningsgateway med Salesforce Apex.
För att hjälpa dig komma igång, se dessa referensklasser.
- Skapa en leverantörspost för betalningsgateway som pekar till den adapterklass du skapade.
- I Inställningar, definiera en autentiseringsuppgift som innehåller gateway-leverantörens autentiserings- och inloggningsinformation. Definitionen av adapterklassanrop anropar autentiseringsuppgiften.
- Länka leverantörsposten för betalningsgateway och autentiseringsuppgiften genom att skapa en betalningsgatewaypost.
- Associera betalningsgateway till webbutiksposten.
Exempel
För att associera betalningsgateway till webbbutiksposten, använd ett skript som detta
// Script to add a connection between the web store and the payment gateway for B2C Commerce stores
String webStoreName = 'SiteGenesis';
String paymentGatewayName = 'SalesforceAdapter';
// 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 payment gateway id from the payment gateway name
List<PaymentGateway> paymentGateways = [SELECT Id, PaymentGatewayName FROM PaymentGateway WHERE PaymentGatewayName = :paymentGatewayName];
System.debug('paymentGateways: ' + paymentGateways);
if(paymentGateways.isEmpty()){
System.debug('Error obtaining payment gateway with name ' + paymentGatewayName);
}
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;
}
Löste denna artikel ditt problem?
Berätta för oss vad vi kan förbättra!

