Posted on by

Setting up payment options in Member Payments

When you configure your payment button in PayPal, one of the things you can do is set up a control where the user can choose an “option” when making a payment. The value of this option can be carried back to the user’s record by using a Last Value Field.

As you probably know from reading the Member Payments documentation, “Last Value Fields” are a way to display a value from the last logged payment in the user’s record. These are very handy for showing the user’s current payment status.

Configuring the PayPal Button

When you are setting up your payment button in your PayPal account, you can choose to add an option control where the user can select an option. In our example, it is the membership type: newbie, regular and gold star. Each of these has a different price.

Creating the Last Value Field

Once you have configured your payment button at PayPal, the next step to configuring this is to create a new field on the Manage Database Fields page to hold the value. When PayPal posts back to the site to tell it a payment has been made, the value of this selected option will be in a field named “option_selection1” so you will need to create a new field with that name. You can change the title to be anything you want after the field is created.

Example of a field configured to hold the payment option value.

Make sure you have the exact same options defined in the field as you set up in your PayPal button.

Once you have that in place, you need to add that field to your payment log so that the value will be logged when the user makes a payment.

It’s All Set Up

Now, when the user makes a payment, the value they selected in the option you set up in the payment button will be logged, then reflected in the value of the “Membership Type” field we set up. When the user’s record is displayed, it can show which membership level they paid for.

Since the value is saved in the record, you can also use that value to search for records, for instance we can see a list of all the “Gold Star” members if we want.

9 thoughts on “Setting up payment options in Member Payments

  1. Hi Roland,
    I was hoping to use this plugin to process Member Payments from a form I have built for my sailing club. There are multiple options that each member can choose, that I am calculating using the Numeric calculation fields with the currency attribute. I end up with an overall total field. I’m using a multi page form, so the total is calculated before the final page.
    From reading this article I can’t see that there is a way of transferring the total to PayPal. Am I correct in that assumption or am I missing something?
    Thanks
    David

    1. The numeric calculation fields you set up are for storing and presenting data, they can’t be used for the purpose of submitting a payment. The primary reason you can’t do this is the actual calculations are performed after the form is submitted, which is too late to provide the value to the PayPal payment.

      Providing payment options that calculates the total payment amount needs to be done in the payment submission form (the payment button) as a select field of some kind. The best place to start that is in your PayPal account, where you set up your Payment Buttons. PayPal provides a way to set up a simple selector where the user can select the amount. Once that is set up in PayPal, this provides you with the HTML you will use in the plugin configuration.

      Once you have that, you can see how the data that is sent to PayPal must be structured. You can now modify your payment button (if you want) to use a different way of selecting or totaling the payment, as long as the submitted data matches the expected format. You will need to have a technical understanding of how HTML forms work to do this successfully.

  2. I was adding to the log table and I somehow lost it. When I went back to reinstate it I am not given an option for a log table in the form element as shown above. Has it been renamed or is there another way to recover it?

    1. Can you be more specific about what you were doing and what you saw? I don’t understand the problem you’re facing. Did you delete the “Payment Log” field?

      You can try deactivating/reactivating the plugin.

      1. I was trying to add another field to the log. I added a field called Payment Purpose as a drop down with three options. I then tried to to add it to the log. as payment_purpose:: Payment Purpose. When I updated the fields the payment log changed to text-line as the form element and there was no choice for log table.
        I understand what was there but I can’t re-enter if the log table form element isn’t available.

        1. I deactivated the Participants Database Member Payments plugin and then the Participants Database plugin. Reactivated the Participants Database and then Participants Database Member Payments. There was no change.

        2. Thanks, I see the problem, and it looks like it’s not possible to update that field without changing the form element type. I will need to fix this, but in the meantime, you can restore the field by editing it directly in the database. Open your database using phpMyAdmin (or similar) then find the wp_participants_database_fields table. In the content of that table, you’ll find a field named “pdbmps_payment_log” on this line, you’ll see the form_element column. Change the value in that column to “log-table” and your field will be restored. Note that if you try to save it again, you’ll run into the same problem.

  3. hi i need some help with setting and testing using sandbox for paypal

    1. I cannot help with this, but PayPal has an excellent guide for getting you started on this:

      PayPal sandbox testing guide

Leave a Reply
You have to agree to the comment policy.

9 thoughts on “Setting up payment options in Member Payments

  1. Hi Roland,
    I was hoping to use this plugin to process Member Payments from a form I have built for my sailing club. There are multiple options that each member can choose, that I am calculating using the Numeric calculation fields with the currency attribute. I end up with an overall total field. I’m using a multi page form, so the total is calculated before the final page.
    From reading this article I can’t see that there is a way of transferring the total to PayPal. Am I correct in that assumption or am I missing something?
    Thanks
    David

    1. The numeric calculation fields you set up are for storing and presenting data, they can’t be used for the purpose of submitting a payment. The primary reason you can’t do this is the actual calculations are performed after the form is submitted, which is too late to provide the value to the PayPal payment.

      Providing payment options that calculates the total payment amount needs to be done in the payment submission form (the payment button) as a select field of some kind. The best place to start that is in your PayPal account, where you set up your Payment Buttons. PayPal provides a way to set up a simple selector where the user can select the amount. Once that is set up in PayPal, this provides you with the HTML you will use in the plugin configuration.

      Once you have that, you can see how the data that is sent to PayPal must be structured. You can now modify your payment button (if you want) to use a different way of selecting or totaling the payment, as long as the submitted data matches the expected format. You will need to have a technical understanding of how HTML forms work to do this successfully.

  2. I was adding to the log table and I somehow lost it. When I went back to reinstate it I am not given an option for a log table in the form element as shown above. Has it been renamed or is there another way to recover it?

    1. Can you be more specific about what you were doing and what you saw? I don’t understand the problem you’re facing. Did you delete the “Payment Log” field?

      You can try deactivating/reactivating the plugin.

      1. I was trying to add another field to the log. I added a field called Payment Purpose as a drop down with three options. I then tried to to add it to the log. as payment_purpose:: Payment Purpose. When I updated the fields the payment log changed to text-line as the form element and there was no choice for log table.
        I understand what was there but I can’t re-enter if the log table form element isn’t available.

        1. I deactivated the Participants Database Member Payments plugin and then the Participants Database plugin. Reactivated the Participants Database and then Participants Database Member Payments. There was no change.

        2. Thanks, I see the problem, and it looks like it’s not possible to update that field without changing the form element type. I will need to fix this, but in the meantime, you can restore the field by editing it directly in the database. Open your database using phpMyAdmin (or similar) then find the wp_participants_database_fields table. In the content of that table, you’ll find a field named “pdbmps_payment_log” on this line, you’ll see the form_element column. Change the value in that column to “log-table” and your field will be restored. Note that if you try to save it again, you’ll run into the same problem.

  3. hi i need some help with setting and testing using sandbox for paypal

    1. I cannot help with this, but PayPal has an excellent guide for getting you started on this:

      PayPal sandbox testing guide

Leave a Reply
You have to agree to the comment policy.