Supported payment methods and transaction types
Creating a gateway integration using the Generic Payment webhook is similar to creating an integration using the Credit Card Payment webhook. However, the Generic Payment webhook supports a wider range of options in order to handle a variety of payment methods.
The following table summarizes the available payment methods and the transaction types they support. Note that in addition to the methods listed here for the Generic Payment webhook, Commerce supports loyalty point payments using the Custom Currency webhook.
Payment Method | Supported Transaction Types |
---|---|
card |
|
cash |
|
generic |
|
physicalGiftCard |
|
invoice |
authorization -- approve payment for an
order
|
storeCredit |
|
The payment and transaction types are specified in the gateway.json
file. For example:
{
"provider": "Sample Payment Gateway",
"paymentMethodTypes": ["physicalGiftCard", "cash"],
"transactionTypes": {
"physicalGiftCard": ["balanceInquiry", "authorize", "void", "refund"],
"cash": ["initiate", "cancel"]
}
}
User interface configuration controls that appear in the Payment Processing page of the administration interface are specified in the config.json
file. For example:
{
"configType": "payment",
"titleResourceId": "title",
"descriptionResourceId": "description",
"instances" : [
{
"id": "agent",
"instanceName": "agent",
"labelResourceId": "agentInstanceLabel"
},
{
"id": "preview",
"instanceName": "preview",
"labelResourceId": "previewInstanceLabel"
},
{
"id": "storefront",
"instanceName": "storefront",
"labelResourceId": "storefrontInstanceLabel"
}
],
"properties": [
{
"id": "paymentMethodTypes",
"type": "multiSelectOptionType",
"name": "paymentMethodTypes",
"required": false,
"helpTextResourceId": "paymentMethodsHelpText",
"labelResourceId": "paymentMethodsLabel",
"defaultValue": "physicalGiftCard",
"displayAsCheckboxes": true,
"public": true,
"options": [
{
"id": "cash",
"value": "cash",
"labelResourceId": "cashPayLabel"
},
{
"id": "physicalGiftCard",
"value": "physicalGiftCard",
"labelResourceId": "physicalGiftCardPayLabel"
}
]
},
{
"id": "includeOrderInWebhookPayload",
"type": "booleanType",
"name": "includeOrderInWebhookPayload",
"helpTextResourceId": "includeOrderHelpText",
"labelResourceId": "includeOrderLabel",
"defaultValue": true,
"public": true
}
]
}
Notice that in this example the type
attribute of the
paymentMethodTypes
property is set to
multiSelectOptionType
, which means that multiple methods can be selected
(for example, physicalGiftCard
and cash
). By default the
control created for selecting the methods is a drop-down list, but setting
displayAsCheckboxes
to true
specifies that a set of
checkboxes should be used instead.
The includeOrderInWebhookPayload
property creates a checkbox for specifying
whether or not to include the order data in the webhook call.