PayU-EMEA / openpayu_php

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

Api to capture payment from the card, user entered using custom form #124

Closed TayyabAslam123 closed 2 years ago

TayyabAslam123 commented 2 years ago

I am using payU to make payments . I have explore the Api to create new order but after successful request of this Api it gives me redirect url that took me to new page where user should enter card details. I want to make custom design for the form where user enter its card details ,expiration month ,year and cvv , but couldn't find any api to send card details of user and capture payment accordingly. Is there any api available that make payment from the card details that are entered by user, rather than going to page provided by payU. Thanks

regdos commented 2 years ago

Please use Secure Form https://developers.payu.com/en/card_tokenization.html#secureform. After tekenization use token to create order in PayU with paymethod:

      "payMethods": {
          "payMethod": {
               "type":  "CARD_TOKEN",
               "value": "TOKEN_FROM_SECUREFORM"
          }
      }
TayyabAslam123 commented 2 years ago

Thank you so much Regdos , It worked for me :)

TayyabAslam123 commented 2 years ago

@regdos Is there any api to do the card tokenization in Payu instead of secure form. Because when I generate token one time it create order and function successfully but second time it gives error. Kindly tell me regarding any api which do this card tokenization Thanks

regdos commented 2 years ago

You may create reusable token (MULTI) https://developers.payu.com/en/card_tokenization.html#_method_tokenize or if you have PCI DSS env use https://developers.payu.com/en/card_tokenization.html#plain_card_data

TayyabAslam123 commented 2 years ago

@regdos I need help regarding this matter and want to confirm some things from you. Actually I am already using stripe in my project and want to integrate PayU for the poland version of the project. In my project user enter the card details and we make payment method on stripe and capture the payment . Then after every month we charge from user using payment method and user don't need to enter the card details.

While implementing PayU as you give the solution to tokenize the card details , I have implemented that and it worked accordingly. Again as per our discussion I use resusable token (multi) in secure form , but its not working according and again give me exception after doing payment one time.
### MULTI Card saved - multi-use token will be returned after the it is charged via REST API. While doing this no token is returned . I am seding it like this. var optionsForms = { cardIcon: true, style: { basic: { fontSize: '24px' } }, placeholder: { number: '', date: 'MM/YY', cvv: '' }, lang: 'pl', type: 'MULTI' }

regdos commented 2 years ago

@TayyabAslam123 You must use the MULTI parameter in tokenize function not options eg.:

const payuSdkForms = PayU(POS_ID);
const secureForms = payuSdkForms.secureForms(optionsSecureForms);
secureForms.tokenize('MULTI').then((res) => {})

Additionally, for the recurring payment you need to have a properly configured POS in PayU. Please contact with PayU BOK.

TayyabAslam123 commented 2 years ago

@regdos Thank you so much buddy Now all API things are working proper and as required. Last thing that left is I want to add USD in my account too as now my sandbox account is using PLN currency only. How I can add USD so I can charge in both USD and PLN Thanks

regdos commented 2 years ago

For USD you must contact with BOK PayU https://poland.payu.com/en/support/ because you need a store with USD currency that you cannot create by yourself.

TayyabAslam123 commented 2 years ago

Okay sure @regdos Thank you let me discuss regarding that on Monday I will notify you and ask you if any thing required.

Bundle of thanks for helping me in issues I faced. :)

TayyabAslam123 commented 2 years ago

Hi @regdos

My all flow was working according to my requirements. But today I face a issue. Actually I can use my card for multiple payments as you guide me accordingly on this.

But today on second api call its giving this. On my dashboard it is still capturing the payment and showing me correct transaction.

  'status' => 
  array (
    'statusCode' => 'WARNING_CONTINUE_3DS',
    'severity' => 'WARNING',
  ),
  'redirectUri' => 'https://merch-prod.snd.payu.com/front/threeds/?authenticationId=cf74bcd1-0800-4e65-b461-d3536f98c740&refReqId=4d4d68da5b2c2c537a6b756b4915acc8',
  'iframeAllowed' => true,
  'threeDsProtocolVersion' => '3DS2',
  'orderId' => 'WRHVQN6BNN220801u4uvw1fnP01',
)  

PLZ help me in this matter . Thanks