I. Getting Started
Download and extract the sample gateway: wpjobster-sample-gateway-v3.0.3.zip
If you want to do the implementation only for the withdrawal part (without payment) download and extract the sample gateway simplified: wpjobster-sample-withdrawal-only-gateway.zip
Open “wpjobster-sample-gateway.php” with your favourite code editor, then search and replace “sample” and “Sample” (both case sensitive) with your gateway name (lowercase and normal case, respectively). Rename the file and plugin folder too.
Example:
‘sample’ => ‘mygateway’
‘Sample’ => ‘MyGateway’
Structure
The sample gateway consists in three main parts:
- Construct functions
- __construct()
- checkCompatibility()
- Admin functions
- saveExtraAdminOptions( $options)
- displayAdminAutomaticWithdrawalButton( $default, $row )
- displayProcessPaymentRequestButton( $payment_type )
- processPaymentRequest
- Front functions
- addGatewayToPaymentsWithdrawalList( $default_gateways )
- addGatewayDetailsInputToPaymentsWithdrawalList( $gateway )
- addGatewayDetailsInputToSettingsPaymentsList
Normally you should be able to create your gateway only by adding your code in those functions from above, leaving all the rest of the code untouched.
Below we’ll take and explain one by one all of the functions that you may need to touch.