使用VFP通过NVP或SOAP向Paypal提交信用卡交易



我知道这是一个长远的目标,但是有人有任何VFP (Visual FoxPro)的使用NVP或SOAP提交信用卡交易到paypal支付流pro API的样本吗?所有的样品从贝宝是在c#, vb.net等

下面是一个使用VFP构建HTTP POST的示例。

LOCAL loHttp
LOCAL lnSuccess
LOCAL loReq
LOCAL loResp
loHttp = CreateObject('Chilkat_9_5_0.Http')
*  Any string unlocks the component for the 1st 30-days.
lnSuccess = loHttp.UnlockComponent("Anything for 30-day trial")
IF (lnSuccess <> 1) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    CANCEL
ENDIF
loReq = CreateObject('Chilkat_9_5_0.HttpRequest')
*  Add the request params expected by the server-side:
loReq.AddParam("city","Paris")
loReq.AddParam("country","France")
*  Send the POST  (This is a real URL that may be tested.)
loResp = loHttp.PostUrlEncoded("http://www.chilkatsoft.com/httpTest/cityCountry.asp",loReq)
IF (ISNULL(loResp)) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loReq
    CANCEL
ENDIF
RELEASE loResp
*  The exact HTTP request sent and response received
*  by the example code above is as follows:

/*

---- Sending ----
POST /httpTest/cityCountry.asp HTTP/1.1
Host: www.chilkatsoft.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 25
city=Paris&country=France
---- Received ----
HTTP/1.1 200 OK
Date: Wed, 09 Dec 2009 16:16:00 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Length: 156
Content-Type: text/html
Set-Cookie: ASPSESSIONIDQCDTSSAC=MHJCNFMDENFOKGINOFEDILCM; path=/
Cache-control: private

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
France<br />Paris<br />
</body>
</html>
*/

RELEASE loHttp
RELEASE loReq

你应该能够从那工作,并把它变成一个呼叫贝宝。你只需要将端点URL更改为PayPal的URL,然后添加您正在进行的任何呼叫的所有参数。

您可以使用PayPal的API参考来查看您想要进行的任何呼叫可用的参数

最新更新