APIs & Integrations

jasongjs
HubSpot Employee
HubSpot Employee

Integrate Payflow Pro to HubSpot Form

I am posting this on behalf of a customer. Customer will like to integrate Payflow Pro into one of HubSpot Form but he is not sure what is the best way of doing so.

Hearing from him, the code used seems to be a php code, hence I am not too sure whether the ‘Submit data to a form’ API is still workable here. Any insights on what is the best way to go about implementing this would be great, I will share them with the customer.

The php code:

˂?php

    $arr = array(

        'properties' => array(

            array(

                'property' => 'email',

                'value' => 'apitest@hubspot.com'

            ),

            array(

                'property' => 'firstname',

                'value' => 'hubspot'

            ),

            array(

                'property' => 'lastname',

                'value' => 'user'

            ),

            array(

                'property' => 'phone',

                'value' => '555-1212'

            )

        )

    );

    $post_json = json_encode($arr);

    $hapikey = readline("Enter hapikey: (demo for the demo portal): ");

    $endpoint = 'https://api.hubapi.com/contacts/v1/contact?hapikey=' . $hapikey;

    $ch = @curl_init();

@curl_setopt($ch, CURLOPT_POST, true);

@curl_setopt($ch, CURLOPT_POSTFIELDS, $post_json);

@curl_setopt($ch, CURLOPT_URL, $endpoint);

@curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’));

@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $response = @curl_exec($ch);

    $status_code = @curl_getinfo($ch, CURLINFO_HTTP_CODE);

    $curl_errors = curl_error($ch);

@curl_close($ch);

    echo "curl Errors: " . $curl_errors;

    echo "\nStatus code: " . $status_code;

    echo "\nResponse: " . $response;

?>

0 Upvotes
4 Replies 4
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Integrate Payflow Pro to HubSpot Form

Hi @Jason_HubSpot,

They could potentially make use of the onFormSubmit callback built into HubSpot form embeds to make the request to the PayFlow Pro API at the moment of form submission. This requires the use of a HubSpot form embed though; if they’re using a custom HTML form and simply submitting the info to the forms API, they’ll need to manage the PayFlow Pro API call and submission on their end.

0 Upvotes
jasongjs
HubSpot Employee
HubSpot Employee

Integrate Payflow Pro to HubSpot Form

Thanks for this information, Derek! I will share it with the customer and see what he thinks about this. Will comment back if we require further help. You are amazing

Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Integrate Payflow Pro to HubSpot Form

Hi @Jason_HubSpot,

Submitting data to the forms API is language agnostic, and should work fine with PHP. I’m not entirely sure what the goal is; are they trying to submit info to HubSpot after checkout? That code looks about right, though I’m not entirely fluent in PHP.

0 Upvotes
jasongjs
HubSpot Employee
HubSpot Employee

Integrate Payflow Pro to HubSpot Form

Hey there Derek, thanks so much for getting back, you are a savior! Currently, the customer’s visitors are being directed to another page for payment after submitting a HS form, at this directed page the team make use of the PayFlow Pro API to generate a timestamp before the information is being sent to PayFlow.

He is looking at a way to reduce this by making use of the PayFlow Pro API to generate a time stamp immediately when a form submission is made. Hence there wouldn’t be a need for another page. Would this be possible?

If you need to clarify on any question, do let me know. I can help to reach out to the customer for more information. Really thank you for your help!

0 Upvotes