PayU-EMEA / openpayu_php

OpenPayu SDK
http://developers.payu.com
Apache License 2.0
184 stars 86 forks source link

Credit Card payment status #131

Open prugala opened 6 months ago

prugala commented 6 months ago

Hello, I have a problem with creating order with credit card. My array with order data (simplified):

$order['payMethods'] = [
                'payMethod' => [
                    'value' => 'Token from frontend widget or from previous user order',
                    'type' => 'CARD_TOKEN',
                ],
            ];

$response = \OpenPayU_Order::create($order);

I'm using sandbox and card listed on your website, order is created and I get response but when I get information about order, order has status pending

$data = \OpenPayU_Order::retrieve($orderId);

$data->getResponse()->orders[0]->status - PENDING

I can't find information what should I do for the order to have the SUCCESS status.

peterpp commented 6 months ago

Hello, PENDING is a regular order state and can last really long. You have two options:

a) Implement asynchronous notification mechanism If you set notifyUrl parameter while creating an order, PayU will call this URL with every status change.

b) Actively wait for the order to be finished You can call OpenPayU_Order::retrieve in some smart cycle (let's say every 5 seconds, up to 30 seconds). But be beware, that finishing the order can take much longer! I've seen 5 minutes interval even with Apple Pay in real life. So you still need to handle longer payments in some asynchronous way.

regdos commented 6 months ago

Hello.

In $response should be redirect url to 3DS, you need to redirect to it.

prugala commented 6 months ago

@peterpp @regdos thank you for you response. I'm using sandbox card 4444333322221111 and there is no 3DS. In response don't have redirectUri property.

Im checking status with OpenPayU_Order::retrieve after 10-15 minutes and still is pending

Example orderId: X46VN8NSD2240110iafvzis8P01

I attach screenshots with order response, order payload, and response from retrieve method.

Screenshots are from two different orders but response is always same for all orders.

Order response: Zrzut ekranu 2024-01-10 o 17 24 47

Order payload:

Zrzut ekranu 2024-01-10 o 17 25 18

retrieve response:

Zrzut ekranu 2024-01-10 o 17 28 22
regdos commented 6 months ago

I can see that use stored card token to recurring payment. First transaction this token must be with 3DS so please use card with challenge from https://developers.payu.com/europe/pl/docs/testing/sandbox/#sandbox-test-cards

Please reffer with https://developers.payu.com/europe/pl/docs/payment-solutions/cards/tokenization/ and if you will have problem please contact to BOK PayU.