• Resolved dexdeckers

    (@dexdeckersgmailcom)


    Hi, I am running a membership website with PMP using KlikAndPay for accepting payments. For diverse reasons, I’m not using Woocommerce at the time. KlikAndPay has hosted pages which will handle the payment and afterwards I can redirect users to a specific URL. Since I have no connection between KlikAndPay and PMP, I am wondering if there is a way I can create a membership programatically for a user who just bought a month’s access to the website. I saw there are action- and filter hooks available, but couldn’t find one that would serve this purpose.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Andrew Lima

    (@andrewza)

    Hi @dexdeckersgmailcom

    Thank you for using Paid Memberships Pro.

    You should be able to create a custom function that hooks on ‘init’ and then pass data through query parameters to a specific URL (similar to how a webhook handler page could operate) and then programmatically create the user and assign a membership level.

    You may be able to use Zapier as well to create a user and assign a membership level with the Paid Memberships Pro Zapier Integration – https://www.paidmembershipspro.com/add-ons/pmpro-zapier/

    I hope this helps get you started.

    Thread Starter dexdeckers

    (@dexdeckersgmailcom)

    Hi Andrew, thank you for your quick reply.

    I want to try option one first, as I’m already maintaining quite a few plugins on this website.

    So if I understand correctly, I can set up a function that gets called when a certain URL is visited (this will be the return URL after payment). With the query params passed to that URL (name, email etc), I should be able to programmatically create the user and assign a membership level. That sounds exactly like what I’m looking for.

    Where can I find the docs that explain how to create this user and assign a membership level? I only found this blog article concerning API usage:
    https://www.paidmembershipspro.com/interacting-with-paid-memberships-pro-through-apis/

    Plugin Author Andrew Lima

    (@andrewza)

    You would need to use the default WordPress functions to create the user and then add the user to the membership level.

    You can use the function pmpro_changeMembershipLevel to assign a membership level to a user.

    Here’s an example from hookr.io – http://hookr.io/functions/pmpro_change_membership_level/

    I hope this helps get you started. You may also look at the Zapier Add On as we do something similar with webhooks between Zapier.

    Thread Starter dexdeckers

    (@dexdeckersgmailcom)

    Ah thanks, that is interesting! I can dig into this.
    I read the Zapier add on docs, looks awesome too, thank you for helping out.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Create member programatically after payment’ is closed to new replies.