Post by fireatwire » Sun Jul 24, 2016 5:28 pm

I would like to modify an existing payment extension which probably already is available in the standard installation of OC 2.2. The reason for it is that there's not a payment extension available.
I would highly appreciate if someone could help me to say which extension I should use to start modifying!

Here's a documentation: https://payunity.docs.oppwa.com/tutoria ... tion-guide
1. Prepare the checkout

First, perform a server-to-server POST request to prepare the checkout with the required data, including the order type, amount and currency. The response to a successful request is a JSON string with an id, which is required in the second step to create the payment form.

Code: Select all

function request() {
	$url = "https://test.oppwa.com/v1/checkouts";
	$data = "authentication.userId=8a8294174e0078ad014e1a2781e035ab" .
		"&authentication.password=8Dy7awrPX3" .
		"&authentication.entityId=8a8294174e0078ad014e1a2781d035a7" .
		"&amount=92.00" .
		"&currency=EUR" .
		"&paymentType=DB";

	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// this should be set to true in production
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$responseData = curl_exec($ch);
	if(curl_errno($ch)) {
		return curl_error($ch);
	}
	curl_close($ch);
	return $responseData;
}
$responseData = request();
2. Create the payment form

To create the payment form you just need to add the following lines of HTML/Javascript to your page and populating the following variables

The checkout's id that you got in the response from step 1

Code: Select all

<script src="https://test.oppwa.com/v1/paymentWidgets.js?checkoutId={checkoutId}"></script>
The shopperResultUrl, which is the page on your site where the customer should be redirected to after the payment is processed and the brands that will be available.

Code: Select all

<form action="{shopperResultUrl}" class="paymentWidgets">VISA MASTER AMEX</form>
3. Get the payment status

Once the payment has been processed, the customer is redirected to your shopperResultUrl along with a GET parameter resourcePath.

Important: The baseUrl must end in a "/", e.g. "https://test.oppwa.com/".

Then, to get the status of the payment, you should make a GET request to the baseUrl + resourcePath, including your authentication parameters.

Example of a resourcePath: resourcePath=/v1/checkouts/{checkoutId}/payment

Code: Select all

function request() {
	$url = "https://test.oppwa.com/v1/checkouts/{id}/payment";
	$url .= "?authentication.userId=8a8294174e0078ad014e1a2781e035ab";
	$url .= "&authentication.password=8Dy7awrPX3";
	$url .= "&authentication.entityId=8a8294174e0078ad014e1a2781d035a7";

	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// this should be set to true in production
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$responseData = curl_exec($ch);
	if(curl_errno($ch)) {
		return curl_error($ch);
	}
	curl_close($ch);
	return $responseData;
}
$responseData = request();

New member

Posts

Joined
Wed Feb 03, 2010 5:21 am

Post by straightlight » Tue Jul 26, 2016 1:02 am

Contact their support to see if they can assist you with your enquiry. If they cannot assist you, you can always submit a custom job request in the Commercial Support section of the forum.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com contractor officials representative


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 2 guests