|
I am trying to use rest to access usaepay system (https://help.usaepay.info/developer/rest-api/) (code below).
Im getting the following error "HTTP/1.1 401 Valid authentication required". I generated the key using the PHP sample code on the site.
H DFTACTGRP(*NO) BNDDIR('HTTPAPI':'QC2LE')
D myJSON s 500a varying
D authorization s 500a varying
D rc s 10i 0
/copy LIBHTTP/QRPGLESRC,httpapi_h
*inlr = *on;
myjson = ' +
{"command": "cc:sale", +
"amount": "5.00", +
"amount_detail": +
{ +
"tax": "1.00", +
"tip": "0.50" +
}, +
"creditcard": +
{ +
"cardholder": "John doe", +
"number": "4000100011112224", +
"expiration": "0919", +
"cvc": "123", +
"avs_street": "1234 Main", +
"avs_zip": "12345" +
}, +
"invoice": "12356" +
} +
';
http_debug(*on: '/home/tim/result.txt');
http_setOption( 'content-type' : 'application/json' );
http_setOption( 'user-agent' : 'uelib v6.8');
authorization = 'Basic +
v0dIcexyabhyMEdIOTdeSnBVWVNddvFSNevKODl6vVk6czvvYdJvd+
vgmZ2hpamtsbd5vcC8zrDJhYdU1YTEyNT2xMmY4NzVhZmU2M+
zg5NDc4YdNhdjd5MdUdYggdYTJdNvddYzEdOWFkdTvwZTFkdvVldTv2';
http_setOption( 'Authorization' : authorization);
rc = http_post( 'https://sandbox.usaepay.com/api/v2/transactions'
: %addr( myJSON : *data )
: %len( myJSON )
: '/home/tim/result.json'
: HTTP_TIMEOUT
: HTTP_USERAGENT
: 'application/json' );
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.