This addon plugin allows you to easily add the PayPal Pro payment gateway checkout to WooCommerce.
Install and activate the plugin, then enter your PayPal Pro API details in the settings and you will be ready to accept credit card on your site.
Table of Contents
- How The Checkout Works
- Installing the PayPal Pro Extension
- Configuring the Settings
- Credit Card Checkout
- Block Checkout Example Screenshot
- Force SSL/Secure Checkout Setting
- Action and Filter Hooks (For Developers)
- wcpprog_checkout_icon
- wcpprog_before_rendering_payment_fields
- wcpprog_card_number_field_placeholder
- wcpprog_cvv_field_placeholder
- wcpprog_cvv_image_hint_src
- wcpprog_cc_last_digits_for_post_meta
- wcpprog_request_txn_description
- wcpprog_invnum_woo_order_number
- wcpprog_get_user_ip
- wcpprog_request_query_arg_paymentaction
How The Checkout Works
The following video demonstrates how the credit card checkout works with this extension.
Installing the PayPal Pro Extension
Do the following to install the extension:
- Upload the ‘woocommerce-paypal-pro.zip’ file from the Plugins -> Add New page in the WordPress administration panel.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
Configuring the Settings
After you activate the extension, you need to configure some details. Go to the following settings area and enter your PayPal Pro API details:
WooCommerce Settings -> Checkout -> PayPal-Pro
Getting Your PayPal Pro API Credentials
PayPal frequently makes changes to their interface. So the following steps may not match 100% according to the interface you see in your PayPal account right now. However, the general guideline will still be helpful for you to retrieve your PayPal Pro API details.
- Log into your PayPal account.
- Hover over the gear icon and select Account Settings.
- Go to the Account Access section and select Update next to API Access.
- Find the NVP/SOAP API Integration (Classic) and select Manage API credentials.
- Select Show next to API Username, API Password, and Signature.
- If you have never activated this API, then you may need to request permission for the API first. Select the Request an API signature option and submit.
- Once you can see the API Details, copy and paste the details into the fields under WooCommerce > Settings > Payments > PayPal-Pro.
Credit Card Checkout
Your customers will now be able to select “credit card” payment option from WooCommerce checkout page. Your customers won’t have to leave the site to do the transaction.
After the transaction is complete, the customers will be redirected to the order received page. Below is an example of the order received page:
Block Checkout Example Screenshot
Below is an example of how it appears on the block checkout page.
Force SSL/Secure Checkout Setting
When you go live, the Secure checkout option (force SSL) should be enabled in the Advanced settings menu of WooCommerce. See the following screenshot for reference as to where the Secure checkout option is located.
Action and Filter Hooks (For Developers)
The following action and filter hooks are available in this addon. If you are a developer, you can use these to override or customize some values.
wcpprog_checkout_icon
This filter is triggered for the credit card icon image displayed on the checkout form. It can be used to override the card checkout icon image.
wcpprog_before_rendering_payment_fields
This filter is triggered before the various credit card payment fields are rendered on the checkout form.
wcpprog_card_number_field_placeholder
This filter is triggered for the credit card number field’s placeholder.
wcpprog_cvv_field_placeholder
This filter is triggered for the CVV field’s placeholder.
wcpprog_cvv_image_hint_src
This filter is triggered for the CVV field’s hint image.
wcpprog_cc_last_digits_for_post_meta
This filter is triggered for the last 4 digits when the order is processed.
wcpprog_request_txn_description
Used to set a transaction description for the PayPal payments pro API request.
wcpprog_invnum_woo_order_number
This filter hook is triggered for the invoice number sent in the PayPal API request. You can use it to customize the invoice number. For example, the following code adds a prefix to the invoice number.
add_filter('wcpprog_invnum_woo_order_number', 'add_my_custom_inv_prefix');
function add_my_custom_inv_prefix( $inv_num ){
$inv_num = 'my_prefix' . $inv_num;
return $inv_num;
}
wcpprog_get_user_ip
This filter is triggered for the customer’s IP Address field that gets set in the PayPal pro API request. The following is an example snippet of code that shows how it can be used:
add_filter( 'wcpprog_get_user_ip', 'custom_user_ip_function' ); function custom_user_ip_function ( $ip_address ){ //Do something custom with the IP address then return it. return $ip_address; }
wcpprog_request_query_arg_paymentaction
This filter is triggered for the paymentaction query argument of the request. It can be used to change the transaction type from “Capture/Sale” to “Authorizaton” only. You can then manually capture the transaction from your account at a later time.
The following is an example snippet of code that you can use to customize your site to an “authorization” only transaction model.
function wcpprog_authorize_only( $action ){ $action = 'Authorization'; return $action; } add_filter('wcpprog_request_query_arg_paymentaction', 'wcpprog_authorize_only');