On This Page
Customization
The Visa Acceptance cartridge for
Salesforce
B2C Commerce has
built-in custom hooks that can be used to customize the request data that is sent to each
service.These hooks can send additional custom data, such as Merchant Defined Data for authorization requests.
How Custom Hooks Work
After a request for a particular service is built, there is a check for any code
registering to the hook
app.payment.modifyrequest
. If present, the
hook is called for that specific request and the request object is passed into the
hook. The return value of the hook is sent to Visa Acceptance for SMB
as the
final request object. Through this process, you can inject your own data into the
request object from the custom code you write in a separate cartridge.Implementation
To customize request objects, register the hook
app.payment.modifyrequest
in your cartridge's hooks.json
file. An example would look like this, replacing the script path with your own
script:{ "name": "app.payment.modifyrequest", "script": "./cartridge/scripts/hooks/modifyRequestExample" }
You can copy the for
information about any field you want to customize or add.
scripts/hooks/modifyRequestExample
script from this cartridge
into your own to use as a template for extending and modifying service request
objects. Note that every hook must return a valid request object for the given
service. Refer to the Visa Acceptance for SMB
REST API Field Reference