• Resolved ans11

    (@ans11)


    Hi

    I want to ask how can I know that if the payment has been made of not? I have made a custom form with php and javascript in wordpress and embedded a payment form in it through short code. Now how can I know that if the payment is successful or rejected? I mean is there any way to know this, please help me in this regard. Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Nayan Das

    (@hellonayan)

    Hello There,
    We apologize for the delayed response.

    In Paymattic, navigate to the “Entries” section of your form, where you will find a dedicated segment labeled “Payment Status.” Here, you can view the payment status for each form entry. For a more visual guide, please refer to the screenshot provided: https://prnt.sc/Qtq1G4atsmIa

    Thank you!

    Thread Starter ans11

    (@ans11)

    Hi,

    Thank you for your reply. I want to know about programmatically. I am using a custom form that I have programmed with PHP and Javascript. I want to get payment in that form. I have used a custom field and enter amount in it with javascript. Now I want to know if the payment has maid so that I can add the data to the database. So is there a way I can know with code that the payment has been made successfully. Thank you.

    Plugin Author Hasanuzzaman Shamim

    (@hasanuzzamanshamim)

    Hi,
    Yes, you can easily hook the payment success action.
    Action you may hook:
    do_action('wppayform/form_payment_success', $submission, $transaction, $transaction->form_id, $updateData);

    You should use it like this:
    Example:
    add_action('wppayform/form_payment_success',function($submission, $transaction, $form_id, $updateData){ //your code here}, 10, 4);

    Nb: If you want to hook any specific payment method, the hook will be.
    Example for Paystack:
    wppayform/form_payment_success_paystack
    Thanks

    Thread Starter ans11

    (@ans11)

    Hi @hasanuzzamanshamim,

    Thank you for your response. Can you please explain what these parameters are:

    $submission, $transaction, $form_id, $updateData

    I mean what data will be there in these function parameters? And also how can I send data to this hook? For example, upon payment success, I want certain data to be stored into the database so how can I send that form data to this hook?

    WP Miners

    (@wpminers)

    Hi,
    You don’t need to send data to this hook. You have to receive data from this hook.
    Here you get the submitted data of the form entry $submission, and the $transaction has the vendor transaction data. If you want to validate a specific form use $form_id then. If you want certain data to be stored in the database no need to receive or use those $submission, $transaction, $form_id, $updateData
    variables just call the action to do whatever you want.
    Example use case for your purpose:
    add_action('wppayform/form_payment_success',function($submission, $transaction, $form_id, $updateData){
    // store your data on your database
    }, 10, 4);

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to know if the payment has been made or not’ is closed to new replies.