Knowledge BaseCustom Payment Module Example: DocData

Custom Payment Module Example: DocData

Introduction

We will take the DocData payment module as an example on how to create a custom payment module. DocData is a payment service provider that follows the flow of most other payment service providers. After reading the documentation about DocData implementations you will notice that some things have to be changed from as they are now in the default external payment method implementation. This includes:
  • Before we can redirect the user to the DocData payment site we need to create a cluster by making a call to an URL sending order data. This will return a cluster which we will need to supply when redirecting the user;
  • We need to supply some user data like email, address to this create cluster call;
  • Instead of passing the status to the confirm page DocData requires us to make another call to them to get the status. The benefit of this is increased security.
Furthermore the following things always have to be changed or verified when creating a custom PSP implementation:
  • We need to map the PSP status and Payment method to the right Sana Commerce field;
  • We need to pass the correct order Id to the confirm pipeline;
  • We need to add configuration values needed in DocData;
  • We need to configure the default configuration values to work with DocData.
Knowledge BaseCustom Payment Module Example: DocData