Hi Don, I may be able to help a bit here.
Currently I support 2 payment vendors, Repay and PayNearMe.
With Repay I use SFTP with a private and public key pair. It can be a bit of a hassle as the keys need to be on client and server side.
PayNearMe is very similar, using SFTP however there are no ssh key pairs necessary.
Neither of these run automatically. At the end of the day as part of their daily closeout process i.e. reconciling cash register, generating deposit reports etc. the client clicks a series of buttons and prompts. 3 buttons “Get Payments” - “Post Payments” - “Upload Accounts”. At each button step the user can generate a report or potentially back out of the process for whatever reason.
I use stripe with curl through the api, it is very simple
SendRequest ROUTINE
DATA
curl TCurlHttpClass
res CURLcode
qIndex LONG, AUTO
!respBuffer &IDynStr
respBuffer STRING(65000) !big enuff to hold received response
CODE
!respBuffer &= NewDynStr()
curl.Init()
curl.FreeHttpHeaders()
SSLInfo:bUseSSL = TRUE
p_web.ssv('PaymentFrom','Afiliacion')
IF SSLInfo:bUseSSL
res = curl.SetSSLVerifyHost(SSLInfo:bVerifyHost)
IF res <> CURLE_OK
! MESSAGE('SetSSLVerifyHost failed: '& curl.StrError(res), 'libcurl', ICON:Exclamation)
END
res = curl.SetSSLVerifyPeer(SSLInfo:bVerifyPeer)
IF res <> CURLE_OK
!MESSAGE('SetSSLVerifyPeer failed: '& curl.StrError(res), 'libcurl', ICON:Exclamation)
END
res = curl.SetSSLVersion(SSLInfo:Version)
IF res <> CURLE_OK
! MESSAGE('SetSSLVersion failed: '& curl.StrError(res), 'libcurl', ICON:Exclamation)
END
IF SSLInfo:Certificate
res = curl.SetCAInfo(SSLInfo:Certificate)
IF res <> CURLE_OK
! MESSAGE('SetCAInfo failed: '& curl.StrError(res), 'libcurl', ICON:Exclamation)
END
END
END
curl.SetCustomRequest('POST')
!-H "Content-Type: application/json"
!-H "Authorization: Bearer Access-Token"
CASE p_Web.gsv('Com:PaymentEnviroment')
OF 'sandbox'
curl.AddHttpHeader('Authorization: Bearer '&p_web.gsv('Com:StripteSandBoxToken'))
OF 'production'
curl.AddHttpHeader('Authorization: Bearer '&p_web.gsv('Com:StripteProductionToken'))
END
curl.SetHttpHeaders()
!----Create a Token --------!
Send:Url = 'https://api.stripe.com/v1/tokens'
Send:PostParams ='card[number]='&p_web.gsv('CardNumber')&'&card[exp_month]='&p_web.GSV('ExpMonth')&'&card[exp_year]='&p_web.GSV('ExpYear')&'&card[cvc]='&p_web.GSV('Cvv')
!----Create a Token -------!
CLEAR(TokenError)
CLEAR(Token)
res = curl.SendRequestStr(Send:Url, Send:PostParams, respBuffer)
Loc:CantidadaPagarSend = p_web.gsv('Loc:CantidadaPagar')*100
!Loc:CantidadaPagarSend = 1*100
IF res = CURLE_OK
jsonStr = CLIP(respBuffer)
DO ParseJSON
IF Token<>'' AND TokenError=''
CLEAR(pJsonString)
curl.FreeHttpHeaders()
curl.SetCustomRequest('POST')
CASE p_web.gsv('Com:PaymentEnviroment')
OF 'sandbox'
curl.AddHttpHeader('Authorization: Bearer '&p_web.gsv('Com:StripteSandBoxToken'))
OF 'production'
curl.AddHttpHeader('Authorization: Bearer '&p_web.gsv('Com:StripteProductionToken'))
END
curl.SetHttpHeaders()
Send:Url = 'https://api.stripe.com/v1/charges'
Send:PostParams ='currency=usd&amount='&p_web.gsv('Loc:CantidadaPagar')*100&'&description=charge&source='&clip(Token)&'&receipt_email='&p_web.gsv('Use:EMAIL')&'&metadata[afiliacionid]='&p_web.gsv('Afi:AfiliacionId')
res = curl.SendRequestStr(Send:Url, Send:PostParams, respBuffer)
IF res = CURLE_OK
pJsonString = CLIP(respBuffer)
DO ParseJSON2
IF TokenError<>''
loc:alert = TokenError
p_web.SetValue('SelectField','CardNumber')
EXIT
END
Loc:Status=1
DO AddPayment
END
do Refresh::b1
DO SendEmail
p_web.Script( p_web.WindowOpen( 'PaymentSucessfull' ))
ELSE
loc:alert = CLIP(TokenError)
p_web.SetValue('SelectField','NameonCard')
EXIT
END
ELSIF res = -1
loc:alert = 'Cannot open local file Contact System Administrator'
p_web.SetValue('SelectField','NameonCard')
ELSE
loc:alert = 'SendRequest failed2: '& curl.StrError(res)&' Contact System Administrator'
p_web.SetValue('SelectField','NameonCard')
END