Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialUtku Turna
15,090 PointsWordpress WooCommerce Custom Payment Gateway Order Status
Hi i created a woocommerce custom payment gateway for my project. I works fine except for one thing. When i get the payment successfully the order status in admin area still listed as on-hold and after a while cancelled. I should be successful after payment.
This gateway redirects user to an external payment page after that it redirects them back to my thank you page if there is an error at payment it redirects to my error page etc.
Can you help me with that :( Thank you.
2 Answers
Thiago Tardioli
18,054 PointsHi Utku,
What is the parameter that your gateway returns to success or failure?
Could you put the snippet of your code that receives the parameter of your gateway?
Cheers, Thiago Tardioli
Utku Turna
15,090 Points'''http://www.webpage.com/servissayfasi.php
?order=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
&gsm=5XXXXXXXXX
&status=0
&state=100
&date=14.03.2012+17%3a11%3a59
&errorcode=1000
list goes on etc. etc... '''
state=100 means successful. If its above 100 it fails.
They gave 3 options for confirmation actually, 1 email (thats not what i want) 2. HTTP/GET on webpage 3. Webservice
The codes above are for the 2nd option. HTTP GET.
In my plugin code i do that "'SuccessfulPageUrl' => 'http://webpage.com/thank-you'," i think i can write a php template for this page to execute status update am i right ?
I give parameters like this
$param =
array('token' => array(
'UserCode' => 'xxxx',
'Pin' => 'xxxxxxxxxxxxxx'
),
'input' => array(
'MPAY' => '',
'Content' => $urunler,
'SendOrderResult' => true,
'PaymentTypeId' => 1,
etc. ....
I do that at the bottom "
$client = new nusoap_client($endpoint, true);
$response = $client->call('SaleWithTicket', $param, $mynamespace);
$woocommerce->cart->empty_cart();
return array(
'result' => 'success',
'redirect' => $response['SaleWithTicketResult']['RedirectUrl'],
);
"
Nothing wrong with payment etc. just i couldnt figure out how to update status in woocommerce panel after a successful payment.
Thank you so much for help :)