Newer Version Available
Configuring Response Code Metadata in Your Payment Gateway Package
The fields used to store gateway request and response values vary between payment gateway packages. Let’s look at a few examples from the custom metadata created for the AuthorizeDotNet, CyberSource, Payeezy, and PayFlowPro packages. In each, we’ve provided a recommended metadata name.
| Package | Metadata Name | API Names | Field Labels |
|---|---|---|---|
| AuthorizeDotNet | adnblng__GatewayStatusMApping__mdt |
|
|
| CyberSource | csblng__GatewayStatusMapping__mdt |
|
|
| Payeezy | pyzblng__GatewayStatusMapping__mdt |
|
|
| PayFlowPro | pfpblng__GatewayStatusMapping__mdt |
|
|
Example
1<?xml version="1.0" encoding="UTF-8"?>
2<CustomMetadata xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3 <label>100</label>
4 <values>
5 <field>ResponseCode__c</field>
6 <value xsi:type="xsd:string">100</value>
7 </values>
8 <values>
9 <field>GatewayStatus__c</field>
10 <value xsi:type="xsd:string">Success</value>
11 </values>
12</CustomMetadata>Example
Some payment gateways return multiple response codes for one gateway transaction. Responses with multiple codes can occur when the gateway processes the transaction successfully but then the customer card provider responds with another value. For example, the AuthorizeDotNet code I00001 indicates that the payment gateway successfully processed a request. However, the card provider can then send a response code of 3, which indicates that the transaction was declined. The provider can also send a response code of 7, which indicates that the credit card expiration date is invalid. Let’s look at metadata samples for processing I00001 - 3 and I00001 - 7 respectively.
In this case, we assign I00001 - 3 to a Salesforce Billing value of Permanent Fail.
1<?xml version="1.0" encoding="UTF-8"?>
2<CustomMetadata xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3<label>I00001-3</label>
4 <values>
5 <field>ResponseCode__c</field>
6 <value xsi:type="xsd:string">I00001</value>
7 </values>
8 <values>
9 <field>ResponseCode2__c</field>
10 <value xsi:type="xsd:string">3</value>
11 </values>
12 <values>
13 <field>GatewayStatus__c</field>
14 <value xsi:type="xsd:string">PermanentFail</value>
15 </values>
16</CustomMetadata>In this case, we assign I00001 - 7 to a Salesforce Billing value of Decline.
1<?xml version="1.0" encoding="UTF-8"?>
2<CustomMetadata xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3<label>I00001-2</label>
4 <values>
5 <field>ResponseCode__c</field>
6 <value xsi:type="xsd:string">I00001</value>
7 </values>
8 <values>
9 <field>ResponseCode2__c</field>
10 <value xsi:type="xsd:string">2</value>
11 </values>
12 <values>
13 <field>GatewayStatus__c</field>
14 <value xsi:type="xsd:string">Decline</value>
15 </values>
16</CustomMetadata>