Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4806 มุมมอง

Hi guys,

I am triying to integrate Payflow  to Odoo, because now, Paypal does not accept REST API.

In the first step, when I send account information and tokenid to Payflowpro test server to generate a token, I get an error RESULT=1&RESPMSG=User authentication failed

I am sure that the account information is correct.  So I dont know why I get it.

token = uuid.uuid4().hex

        url = 'https://pilot-payflowpro.paypal.com'

        values = {

          'PARTNER' : 'PayPal',

          'USER' : 'MyUser',

          'PWD' : 'MyPassword',

          'CREATESECURETOKEN' : 'Y',

          'TRXTYPE' : 'S',

          'AMT' : '141',

          'TENDER': 'C',

          'SECURETOKENID' : token

        }

        respone = requests.post(url=url, data=json.dumps(values), timeout=5)



I try usng curl to send the message and it works well. I also try to use HTML form with action, and it works well too.

So, why did my Python code get this error? Please help!

Thanks

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

SOLVED IT, Sorry I can not edit the title

The solution is you must add header when sending request to server

headers = {

'Host': urlparse.urlsplit(url)[1],

'X-VPS-REQUEST-ID': str(token.int),

'X-VPS-CLIENT-TIMEOUT': '5', # Doc says to do this

'X-VPS-Timeout': '5', # Example says to do this

'X-VPS-INTEGRATION-PRODUCT': 'python-payflowlink',

'X-VPS-INTEGRATION-VERSION': '4',

'X-VPS-VIT-OS-NAME': sys.platform,

'Connection': 'close',

'Content-Type': 'text/namevalue',

}


อวตาร
ละทิ้ง
ผู้เขียน

Use this to convert cUrl to Python coe

Link: https://curl.trillworks.com/

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ส.ค. 25
3503
2
มี.ค. 24
5951
Third-party payment integration แก้ไขแล้ว
2
ม.ค. 25
2213
1
มี.ค. 23
2834
0
มี.ค. 23
1850