TOPIC:

Payment gateways 1 week 4 days ago #243271

  • Topic Author
  • Rokhi
  • Away
  • Junior Breezer
  • Junior Breezer
  • Posts: 58
  • Thanks: 1
Hi. I would like to use POLi payment gateway I have the code samples and api info. ( www.polipayments.com/InitiateTransaction ).

How would you suggest I incorporate it on a BF form?

Or would you know if I can adapt/use the PayPal element? Apparently the interface strategy is similar to PayPal in terms of using a target URL and pipe-delimited data.

Please Log in or Create an account to join the conversation.

Last edit: Post by Rokhi.

Payment gateways 1 week 4 days ago #243276

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 9069
  • Karma: 167
  • Thanks: 737
Hi,

I don't think you need to derive from these.

General Procedure:

I assume they provide some overlay for card payments, these would need to be loaded into the form, for example through a custom button click event.

Then at some point the form would be sent.

In a custom end submit (=PHP) which is executed after the form has been submitted, I would contact their API and forward the payment data to their API (either forwarding a new page load to their site, similar to paypal OR forward the data using their API, ex. Rest if they offer one).

Then they for sure got a payment confirmation message that will be returned. If it is similar to Stripe's or PayPal's notification APIs, I would use a before form piece to check for incoming approval notifications and store these in a custom field of the previously made records.

However, if you have an API/Developer documentation on this, we could go more into details. On a quick look I wasn't able to find any. Maybe they hand these out for actual customers, only?

Regards,
Markus

Please Log in or Create an account to join the conversation.

Payment gateways 1 week 4 days ago #243280

  • Topic Author
  • Rokhi
  • Away
  • Junior Breezer
  • Junior Breezer
  • Posts: 58
  • Thanks: 1
Thanks for the quick reply Markus

That link page has php and java transaction initiation sample code at the bottom which I assume I can use as you suggest.

Can you see it? www.polipayments.com/InitiateTransaction

cheers

Please Log in or Create an account to join the conversation.

Payment gateways 1 week 4 days ago #243282

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 9069
  • Karma: 167
  • Thanks: 737
Ok, try it out, with some slight modifications (mostly due to SSL, for testing):

The below is just for testing. Please make sure to use the correct auth code, in the code below (between the base64_encde('')) and you also might need to change the url in curl_init if they are using a different testing url.

The code below should foward to the payment at Poli and return back on successful/failed payments and cancellations.

If that works, then we can go on further and add some spice to it.
There might be an issue with SSL, since they suggest to use a cert but I turned off all SSL checks for testing.
If that happens, we will need to adjust it a bit and add a certificate file on your server.

Copy this into your form => advanced => more options => submit pieces => end submit, and do a form submission:
$json_builder = '{
    "Amount":"1.2",
    "CurrencyCode":"AUD",
    "MerchantReference":"CustomerRef12345",
    "MerchantHomepageURL":'.json_encode(JURI::getInstance()->toString() . ',
    "SuccessURL":'.json_encode(JURI::getInstance()->toString() . '&poli_success=true').',
    "FailureURL":'.json_encode(JURI::getInstance()->toString() . '&poli_success=false').',
    "CancellationURL":'.json_encode(JURI::getInstance()->toString() . '&poli_cancel=true').',
    "NotificationURL":'.json_encode(JURI::getInstance()->toString() . '&poli_notification=true').' 
}';
 
$auth = base64_encode('S61xxxxx:AuthCode123');
$header = array();
$header[] = 'Content-Type: application/json';
$header[] = 'Authorization: Basic '.$auth;
 
$ch = curl_init("https://poliapi.apac.paywithpoli.com/api/v2/Transaction/Initiate");
//See the cURL documentation for more information: http://curl.haxx.se/docs/sslcerts.html
//We recommend using this bundle: https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt
//curl_setopt( $ch, CURLOPT_CAINFO, "ca-bundle.crt");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt( $ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
curl_setopt( $ch, CURLOPT_HTTPHEADER, $header);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $json_builder);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
curl_close ($ch);
 
$json = json_decode($response, true);
 
header('Location: '.$json["NavigateURL"]);
                        

Please Log in or Create an account to join the conversation.

Last edit: Post by TheMuffinMan.

Payment gateways 1 week 4 days ago #243283

  • Topic Author
  • Rokhi
  • Away
  • Junior Breezer
  • Junior Breezer
  • Posts: 58
  • Thanks: 1
I submitted via preview and got a page not found error. How can I trace that

Please Log in or Create an account to join the conversation.

Payment gateways 1 week 4 days ago #243284

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 9069
  • Karma: 167
  • Thanks: 737
That's probably the navigation url the API returns not being correct.
To what page it is trying to forward you?

You can debug this in the code by doing it like this in the end:
print_r($json);
exit;
//header('Location: '.$json["NavigateURL"]);

After submission, it should print the contents of the returned response from their server instead of trying to forward. If there is nothing or the response contains an error, it either means we need to adjust the SSL setup for curl and use that cert file or no access has been granted to the API.

Regards,
Markus

Please Log in or Create an account to join the conversation.

Time to create page: 0.053 seconds

July Sale!

Discounts for all of our extensions + support. Ending July 31st!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!