Warning: A non-numeric value encountered in /home/simpliko/wpadverts.com/public_html/wp-content/themes/Divi/functions.php on line 5806

Payments

Posted in: Modules and Extensions

Payments Module allows accepting payments from site visitors for posting ads. From administrator panel, you can configure multiple pricing levels.

In order to enable Payments go to wp-admin / Classifieds / Options panel and click Activate next to Payments box. Note that Payments requires that you enable at least one payment method so enable either PayPal IPN Module or Bank Transfer Module or both of them.

Configuring Payments

After activating Payments you will notice that where the Enable button was there is now Settings button, click it to get to main Payments Options, it should look as below

payments-options

As you can see there are just two options:

  • first allows selecting default payment method (the dropdown should have some options if you activated at least one payment method in wp-admin / Classifieds / Options panel).
  • second allows selecting default pricing, that is pricing that will be checked by default when user will try to post an ad. In order to have some options here, you need to go to Pricing tab first.

While settings this options is not required it really makes your classifieds site more user-friendly and easier to use.

Pricing

payments-pricing

The Pricing tab allows to Add New pricing, edit or delete one of existing, in order to use the Payments module you need to define at least one Pricing.

wpadverts-payments-pricing-edit

The fields in pricing form should be self-explanatory:

  • Pricing Type – select if the pricing can be used when posting a new Ad (New Advert Posting option) or when renewing and Ad from [adverts_manage] panel (Advert Renewal option)
  • Title – this should be a 2 or 3 words name of the pricing
  • Description – this field should explain what is included in this pricing
  • Price – how much using this pricing will cost
  • Visible – how long (in days) the Ad will be displayed
  • Feature this ad – this checkbox will appear only if you have Featured Ads module enabled.

Using Payments In The Frontend

Pricing defined like in the screenshot above will be displayed in the Post Ad form like this when user will try to post new Ad.

wpadverts-payments-add

If the user will select Premium, then in the third step of Ad posting process he will need to select Payment Method and fill the payment form (if any) to complete payment.

payments-frontend-save

Managing User Payments

In wp-admin / Classifieds / Payment History panel (it will appear only if you have the Payments Module enabled) you can browse all payments (pending, completed, failed and refunded).

payments-history

You can click on each order ID to see all order details, including payment log which allows to troubleshot problems with payments or check when and by whom the payment was accepted.

If you set payment status to Completed when editing the payment then associated Ad will be automatically approved and published or renewed.

Integration with Emails Module

Emails Module is available since WPAdverts 1.3.0, if you are using older WPAdverts version then you will need to upgrade to the latest one to use the Emails Module and the Integration with Payments.

Before using this integration please read the Emails Module documentation to learn what it does and how it can make your classifieds site better.

The Payments Module will register in the Emails Module following messages:

on_advert_pending_notify_user

This message is sent when the user goes from “Preview” to “Save” step in [adverts_add] shortcode. It informs the user who posted an Advert that his Ad was saved in the database

Variables: {$advert}

on_payment_pending_notify_user

This message is sent when the Payment object is created, that is in the [adverts_add] third step when user clicks a “Place Order” button. It informs the user that payment object was created and should include in the message body a complete payment link (in case the user abandoned the payment for some reason).

Variables: {$advert}, {$payment}

on_payment_completed_notify_user

This message is sent to the user when payment changes status from Pending to Completed. It informs the user that payment was received and accepted.

Variables: {$advert}, {$payment}

on_payment_pending_notify_admin

This message is sent in [adverts_add] third step to the administrator to inform him that a paid Advert was saved in the database as pending.

Variables: {$advert}

on_payment_completed_notify_admin

This message is sent to the Administrator to inform him that the payment status was changed from Pending to Completed.

Variables: {$advert}, {$payment}

on_paid_pending_to_publish_notify_user

This message is sent to the user when Ad changes status from Pending to Published. It informs the user that the payment was approved or accepted and the Advert is now available on site.

Variables: {$advert}

on_paid_pending_to_publish_notify_admin

This message is sent to the administrator when Ad changes status from Pending to Published. It informs the admin that the payment was approved or accepted and the Advert is now available on site.

Variables: {$advert}

on_expired_to_publish_notify_user

This message is sent to the user when Advert changes status from Expired to Publish, this usually happens when the user renews an Advert from [adverts_manage] page and his payment is approved.

Variables: {$advert}

on_expired_to_pending_notify_user

This message is sent to the user when Advert changes status from Expired to Pending, this usually happens when the user renews an Advert from [adverts_manage] page and his payment is approved.

Variables: {$advert}

on_expired_to_publish_notify_admin

This message informs the Administrator that some Advert was renewed and published on site again.

Variables: {$advert}

on_expired_to_pending_notify_admin

This message informs the Administrators that some Advert was renewed and is pending publication. The Advert will not be visible on site until the administrator approves it.

Variables: {$advert}

Variables

{$payment}

The {$payment} variable introduced by Payments Module contains information about the payment object.

{$payment.ID}                             (int)    - The ID of the payment
{$payment.post_author}                    (string) - The post author's user ID (numeric string)
{$payment.post_name}                      (string) - The post's slug
{$payment.post_type}                      (string) - Post Type in this case it is always 'adverts-payment'
{$payment.post_title}                     (string) - The buyer full name
{$payment.post_date}                      (string) - Format: 0000-00-00 00:00:00
{$payment.post_date_gmt}                  (string) - Format: 0000-00-00 00:00:00
{$payment.post_content}                   (string) - For future use (usually empty)
{$payment.post_excerpt}                   (string) - For future use
{$payment.post_status}                    (string) - Usually one of: pending, failed, refunded, completed
{$payment.post_modified}                  (string) - Format: 0000-00-00 00:00:00
{$payment.post_modified_gmt}              (string) - Format: 0000-00-00 00:00:00

{$payment|meta:adverts_person}            (string) - Buyer name
{$payment|meta:adverts_email}             (string) - Buyer email address
{$payment|meta:_adverts_user_ip}          (string) - User ID (from wp_users table)
{$payment|meta:_adverts_user_id}          (int)    - User ID or 0
{$payment|meta:_adverts_object_id}        (int)    - ID of an object (usually Advert ID)
{$payment|meta:_adverts_pricing_id}       (int)    - ID of a selected pricing
{$payment|meta:_adverts_payment_type}     (string) - For future use currently defaults to "adverts-payment"
{$payment|meta:_adverts_payment_gateway}  (string) - Payment gateway name
{$payment|meta:_adverts_payment_for}      (string) - For future use currently default to "post"
{$payment|meta:_adverts_payment_paid}     (float)  - How much user already paid
{$payment|meta:_adverts_payment_total}    (float)  - Total to pay

Useful Functions
1. Format price using adverts_price function
{$payment|meta:_adverts_payment_paid|adverts_price}
2. Secure complete payment URL
{$payment|payment_complete_url}
3. Formatted order ID (for example #000123)
{$payment|payment_order_id}
4. To Pay (formatted price)
{$payment|payment_to_pay}
5. Paid (formatted price)
{$payment|payment_paid}